dismand

package module
v0.0.0-...-0c16f95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2021 License: Unlicense Imports: 4 Imported by: 1

README

Dismand

Dismand aims to be a simple command framework for building Discord bots using Disgord

Getting Started

go get -u github.com/puckzxz/dismand

Take a look at example/main.go for a quick start

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRoleNotFound is returned when the searched role is not found
	ErrRoleNotFound = errors.New("role not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Owner           string
	Prefix          string
	AllowedChannels []uint64
}

Config contains settings for Dismand

type Context

type Context struct {
	Message *disgord.Message
	Client  *disgord.Client
	Session disgord.Session
}

Context contains the recieved message, the Disgord client, and the active session

func (*Context) GetRoleByID

func (c *Context) GetRoleByID(id disgord.Snowflake) (*disgord.Role, error)

GetRoleByID will find the role in the server with the same ID. Returns ErrRoleNotFound if the role was not found.

func (*Context) GetRoleByName

func (c *Context) GetRoleByName(name string) (*disgord.Role, error)

GetRoleByName will try to find the role in the server with the same name. If multiple roles have the same name it will return the first role. Returns ErrRoleNotFound if the role was not found.

func (*Context) MemberHasPermission

func (c *Context) MemberHasPermission(permission disgord.PermissionBit) (bool, error)

MemberHasPermission will check if the user has the specified permission

func (*Context) MemberHasRole

func (c *Context) MemberHasRole(role *disgord.Role) (bool, error)

MemberHasRole will check if the user has the specified role

func (*Context) Reply

func (c *Context) Reply(msg string) (*disgord.Message, error)

Reply will reply to the user that sent the message

It WILL mention the user!

type Dismand

type Dismand struct {
	// contains filtered or unexported fields
}

func New

func New(client *disgord.Client, cfg *Config) *Dismand

New returns a Dismand instance

func (*Dismand) MessageHandler

func (d *Dismand) MessageHandler(s disgord.Session, evt *disgord.MessageCreate)

func (*Dismand) On

func (d *Dismand) On(command string, handler command) *cmd

func (*Dismand) RegisterDefaults

func (d *Dismand) RegisterDefaults() *Dismand

RegisterDefaults registers the default Dismand commands

Ping, Help, Enable, Disable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL