Documentation
¶
Index ¶
- type Command
- type CommandContext
- func (ctx *CommandContext) Args() []string
- func (ctx *CommandContext) Error(err error)
- func (ctx *CommandContext) Reply(msg string)
- func (ctx *CommandContext) SendEmbed(e *embed.Embed)
- func (ctx *CommandContext) SendFile(name string, r io.Reader)
- func (ctx *CommandContext) SetArgs(args []string)
- func (ctx *CommandContext) WithValue(k, v interface{})
- type CommandGroup
- type Handler
- type HandlerFunc
- type HandlerMeta
- type MiddlewareFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { HandlerMeta Callback HandlerFunc parsing.CommandDefinition }
func NewCommand ¶
func NewCommand(definition string, callback HandlerFunc) *Command
func (*Command) Handle ¶
func (cmd *Command) Handle(ctx CommandContext)
func (*Command) Use ¶
func (cmd *Command) Use(middleware ...MiddlewareFunc) *Command
type CommandContext ¶
type CommandContext struct { context.Context Session *discordgo.Session Message *discordgo.MessageCreate OnError func(ctx CommandContext, err error) error // contains filtered or unexported fields }
func CreatContext ¶
func CreatContext(s *discordgo.Session, m *discordgo.MessageCreate) CommandContext
func (*CommandContext) Args ¶
func (ctx *CommandContext) Args() []string
func (*CommandContext) Error ¶
func (ctx *CommandContext) Error(err error)
func (*CommandContext) Reply ¶
func (ctx *CommandContext) Reply(msg string)
context object for discordgo
func (*CommandContext) SendEmbed ¶
func (ctx *CommandContext) SendEmbed(e *embed.Embed)
func (*CommandContext) SetArgs ¶
func (ctx *CommandContext) SetArgs(args []string)
func (*CommandContext) WithValue ¶
func (ctx *CommandContext) WithValue(k, v interface{})
type CommandGroup ¶
type CommandGroup struct { HandlerMeta Commands map[string]Handler DefaultHandler Handler }
func Group ¶
func Group() *CommandGroup
func (*CommandGroup) AddHandler ¶
func (h *CommandGroup) AddHandler(name string, handler Handler)
func (*CommandGroup) Command ¶
func (r *CommandGroup) Command(definition string, f HandlerFunc) *Command
func (*CommandGroup) Default ¶
func (r *CommandGroup) Default(h Handler)
func (*CommandGroup) Handle ¶
func (h *CommandGroup) Handle(ctx CommandContext)
func (*CommandGroup) On ¶
func (r *CommandGroup) On(name string, f HandlerFunc)
type Handler ¶
type Handler interface {
Handle(ctx CommandContext)
}
type HandlerFunc ¶
type HandlerFunc func(ctx CommandContext)
func OnPrefix ¶
func OnPrefix(prefix string, next Handler) HandlerFunc
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(ctx CommandContext)
type HandlerMeta ¶
func (*HandlerMeta) Desc ¶
func (h *HandlerMeta) Desc(text string)
func (*HandlerMeta) Display ¶
func (h *HandlerMeta) Display(text string)
func (*HandlerMeta) Metadata ¶
func (h *HandlerMeta) Metadata() *HandlerMeta
type MiddlewareFunc ¶
type MiddlewareFunc func(h HandlerFunc) HandlerFunc
Source Files
¶
Click to show internal directories.
Click to hide internal directories.