Documentation ¶
Index ¶
- Constants
- type Builder
- type Category
- type Command
- type Context
- func (ctx *Context) CleanUp()
- func (ctx *Context) Collect(time time.Duration, amnt ...int) (chan *discordgo.Message, error)
- func (ctx *Context) Delete(msg ...*discordgo.Message) error
- func (ctx *Context) Edit(content string) (*discordgo.Message, error)
- func (ctx *Context) EditComplex(data *discordgo.MessageEdit) (*discordgo.Message, error)
- func (ctx *Context) EditEmbed(embed *discordgo.MessageEmbed) (*discordgo.Message, error)
- func (ctx *Context) Prompt(prompt string) (int, error)
- func (ctx *Context) Send(content string, deleteTime ...time.Duration) (*discordgo.Message, error)
- func (ctx *Context) SendComplex(data *discordgo.MessageSend, deleteTime ...time.Duration) (*discordgo.Message, error)
- func (ctx *Context) SendEmbed(embed *discordgo.MessageEmbed, deleteTime ...time.Duration) (*discordgo.Message, error)
- func (ctx *Context) SendError(err error)
- type Middleware
- type NextFunc
- type Registry
Constants ¶
const ( // PromptAccept for acceptance of a prompt. PromptAccept = iota // PromptDeny for denial of a prompt. PromptDeny // PromptTimeout is when the prompt times out. PromptTimeout )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder ensures easy command creation.
func (*Builder) Description ¶
Description sets the description of the command
func (*Builder) Use ¶
func (bldr *Builder) Use(middleware Middleware)
Use adds a middleware to the stack.
type Category ¶
type Category struct { Commands []*Command // contains filtered or unexported fields }
Category an incubator for commands of a specific type.
func NewCategory ¶
NewCategory creates new command category.
func (*Category) AddCommand ¶
AddCommand adds a command to the category.
func (*Category) DisplayName ¶
DisplayName provides a string suitable for the help menu.
type Command ¶
type Command struct { Name string Aliases []string Description string Permission int Category *Category // contains filtered or unexported fields }
Command is a command
type Context ¶
type Context struct { Session *discordgo.Session Msg *discordgo.Message Cmd *Command // String used to call the command CallKey string RawArgs []string Args map[string]interface{} StartTime time.Time // contains filtered or unexported fields }
Context is the message context used for command execution
func (*Context) CleanUp ¶
func (ctx *Context) CleanUp()
CleanUp deletes the last recently sent message.
func (*Context) EditComplex ¶
EditComplex edits the last message sent by the bot in the channel with complex content.
func (*Context) SendComplex ¶
func (ctx *Context) SendComplex(data *discordgo.MessageSend, deleteTime ...time.Duration) (*discordgo.Message, error)
SendComplex sends a message of any type to the channel the msg came from.
type Middleware ¶
Middleware runs a chain of commands.
type NextFunc ¶
type NextFunc func(err ...error)
NextFunc runs the next middleware in the chain. Optionally supply an error to cancel the chain and report an error.
type Registry ¶
Registry holds all the commands and uses a radix trie for lookups.
func (*Registry) AddCategory ¶
AddCategory adds a command category and registers all of its commands.
func (*Registry) FindClosestCmdMatch ¶
FindClosestCmdMatch aids in supplying "did you mean" functionality for a command.
func (*Registry) LookupCommand ¶
LookupCommand looks up a command using either its name or alias.