Documentation ¶
Index ¶
- func WrapHandler(fn HandlerFunc) dgrouter.HandlerFunc
- func WrapMiddleware(mfn MiddlewareFunc) dgrouter.MiddlewareFunc
- type Args
- type Context
- func (c *Context) Channel(channelID string) (*discordgo.Channel, error)
- func (c *Context) Get(key string) (interface{}, bool)
- func (c *Context) Guild(guildID string) (*discordgo.Guild, error)
- func (c *Context) Member(guildID, userID string) (*discordgo.Member, error)
- func (c *Context) Reply(args ...interface{})
- func (c *Context) ReplyEmbed(e *discordgo.MessageEmbed)
- func (c *Context) ReplyEmbedQuick(args ...interface{})
- func (c *Context) Set(key string, v interface{})
- type HandlerFunc
- type MiddlewareFunc
- type Route
- func (r *Route) Desc(desc string) *Route
- func (r *Route) FindAndExecute(s *discordgo.Session, prefix string, botID string, m *discordgo.Message) error
- func (r *Route) Group(fn func(rt *Route)) *Route
- func (r *Route) On(name string, handler HandlerFunc) *Route
- func (r *Route) Use(mfn ...MiddlewareFunc) *Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapHandler ¶
func WrapHandler(fn HandlerFunc) dgrouter.HandlerFunc
WrapHandler wraps a HandlerFunc into a dgrouter.HandlerFunc
func WrapMiddleware ¶
func WrapMiddleware(mfn MiddlewareFunc) dgrouter.MiddlewareFunc
WrapMiddleware wraps a MiddlewareFunc into a dgrouter.MiddlewareFunc
Types ¶
type Context ¶
type Context struct { Route *dgrouter.Route Msg *discordgo.Message Ses *discordgo.Session Args Args Vars *sync.Map }
Context ...
func NewContext ¶
func NewContext(s *discordgo.Session, m *discordgo.Message, args Args, route *dgrouter.Route) *Context
NewContext returns a new context from a message
func (*Context) Reply ¶
func (c *Context) Reply(args ...interface{})
Reply sends a normal message to the channel the parent message was sent in
func (*Context) ReplyEmbed ¶
func (c *Context) ReplyEmbed(e *discordgo.MessageEmbed)
ReplyEmbed same as Reply but sends and Embed
func (*Context) ReplyEmbedQuick ¶
func (c *Context) ReplyEmbedQuick(args ...interface{})
ReplyEmbedQuick same as ReplyEmbed but has only the Description property
type HandlerFunc ¶
type HandlerFunc func(*Context)
HandlerFunc ...
func UnwrapHandler ¶
func UnwrapHandler(fn dgrouter.HandlerFunc) HandlerFunc
UnwrapHandler unwraps a dgrouter.HandlerFunc into a HandlerFunc
type Route ¶
Route router wrapper
func (*Route) FindAndExecute ¶
func (r *Route) FindAndExecute(s *discordgo.Session, prefix string, botID string, m *discordgo.Message) error
FindAndExecute finds the closest command and executes the callback
func (*Route) On ¶
func (r *Route) On(name string, handler HandlerFunc) *Route
On matches a Route with a name
func (*Route) Use ¶
func (r *Route) Use(mfn ...MiddlewareFunc) *Route
Use specifes what MiddlewareFuncs a Route should have
Click to show internal directories.
Click to hide internal directories.