commands

package
v0.0.0-...-ba647bc Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdAdd

type CmdAdd struct{}

func (*CmdAdd) AdminRequired

func (c *CmdAdd) AdminRequired() bool

func (*CmdAdd) Description

func (c *CmdAdd) Description() string

func (*CmdAdd) Exec

func (c *CmdAdd) Exec(ctx *Context) (err error)

func (*CmdAdd) Invokes

func (c *CmdAdd) Invokes() []string

type CmdHelp

type CmdHelp struct{}

func (*CmdHelp) AdminRequired

func (c *CmdHelp) AdminRequired() bool

func (*CmdHelp) Description

func (c *CmdHelp) Description() string

func (*CmdHelp) Exec

func (c *CmdHelp) Exec(ctx *Context) (err error)

func (*CmdHelp) Invokes

func (c *CmdHelp) Invokes() []string

type CmdList

type CmdList struct{}

func (*CmdList) AdminRequired

func (c *CmdList) AdminRequired() bool

func (*CmdList) Description

func (c *CmdList) Description() string

func (*CmdList) Exec

func (c *CmdList) Exec(ctx *Context) (err error)

func (*CmdList) Invokes

func (c *CmdList) Invokes() []string

type CmdShow

type CmdShow struct{}

func (*CmdShow) AdminRequired

func (c *CmdShow) AdminRequired() bool

func (*CmdShow) Description

func (c *CmdShow) Description() string

func (*CmdShow) Exec

func (c *CmdShow) Exec(ctx *Context) (err error)

func (*CmdShow) Invokes

func (c *CmdShow) Invokes() []string

type CmdUpdate

type CmdUpdate struct{}

func (*CmdUpdate) AdminRequired

func (c *CmdUpdate) AdminRequired() bool

func (*CmdUpdate) Description

func (c *CmdUpdate) Description() string

func (*CmdUpdate) Exec

func (c *CmdUpdate) Exec(ctx *Context) (err error)

func (*CmdUpdate) Invokes

func (c *CmdUpdate) Invokes() []string

type Command

type Command interface {
	Invokes() []string
	Description() string
	AdminRequired() bool
	Exec(ctx *Context) error
}

type CommandHandler

type CommandHandler struct {
	OnError func(err error, ctx *Context)
	// contains filtered or unexported fields
}

func NewCommandHandler

func NewCommandHandler(prefix string) *CommandHandler

func (*CommandHandler) HandleMessage

func (c *CommandHandler) HandleMessage(s *discordgo.Session, e *discordgo.MessageCreate)

func (*CommandHandler) RegisterCommand

func (c *CommandHandler) RegisterCommand(cmd Command)

func (*CommandHandler) RegisterMiddleware

func (c *CommandHandler) RegisterMiddleware(mw Middleware)

type Context

type Context struct {
	Session *discordgo.Session
	Message *discordgo.Message
	Args    []string
	Handler *CommandHandler
}

type Middleware

type Middleware interface {
	Exec(ctx *Context, cmd Command) (next bool, err error)
}

type MwPermissions

type MwPermissions struct{}

func (*MwPermissions) Exec

func (mw *MwPermissions) Exec(ctx *Context, cmd Command) (next bool, err error)

Jump to

Keyboard shortcuts

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