commands

package
v0.0.0-...-7bdc1ae Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdKick

type CmdKick struct{}

func (*CmdKick) AdminRequired

func (c *CmdKick) AdminRequired() bool

func (*CmdKick) Description

func (c *CmdKick) Description() string

func (*CmdKick) Exec

func (c *CmdKick) Exec(ctx *Context) error

func (*CmdKick) Invokes

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

type CmdPing

type CmdPing struct{}

func (*CmdPing) AdminRequired

func (c *CmdPing) AdminRequired() bool

func (*CmdPing) Description

func (c *CmdPing) Description() string

func (*CmdPing) Exec

func (c *CmdPing) Exec(ctx *Context) error

func (*CmdPing) Invokes

func (c *CmdPing) 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, m *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)
}

Jump to

Keyboard shortcuts

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