Documentation ¶
Index ¶
- Variables
- type Args
- type Context
- type HandlerFunc
- type MiddlewareFunc
- type Route
- func (r *Route) Cat() string
- func (r *Route) HandleFunc(name string, handler HandlerFunc) *Route
- func (r *Route) Handler() HandlerFunc
- func (r *Route) Listen(ses *discordgo.Session, evt interface{}) error
- func (r *Route) MatchCat(cat string) []*Route
- func (r *Route) MatchName(name string) *Route
- func (r *Route) MatchType(ty string) []*Route
- func (r *Route) Name() string
- func (r *Route) NewRoute() *Route
- func (r *Route) Prefix() string
- func (r *Route) Routes() []*Route
- func (r *Route) SetCat(cat string) *Route
- func (r *Route) SetHandler(handler HandlerFunc) *Route
- func (r *Route) SetName(name string) *Route
- func (r *Route) SetType(ty string) *Route
- func (r *Route) SetUsage(usage string) *Route
- func (r *Route) Type() string
- func (r *Route) Usage() string
- func (r *Route) Use(mwf ...MiddlewareFunc)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRouteNotFound = errors.New("Error: Router not found")
)
list for available error
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Route *Route Routes []*Route Session *discordgo.Session // discordgo session Event interface{} // discordgo event Args Args // list of available commands arguments // Optional variables for the context using mutex Mut sync.RWMutex Vars map[string]interface{} }
Context is the router context that's stores certain data for the handler
func NewContext ¶
func NewContext(ses *discordgo.Session, evt interface{}, route *Route, routes []*Route, args Args) *Context
NewContext create new router context by the given value
type HandlerFunc ¶
type HandlerFunc func(*Context)
HandlerFunc is the handler function for the router
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
MiddlewareFunc is the middleware function for the router
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is object of the router
func (*Route) HandleFunc ¶
func (r *Route) HandleFunc(name string, handler HandlerFunc) *Route
HandleFunc register new router and the handler
func (*Route) SetHandler ¶
func (r *Route) SetHandler(handler HandlerFunc) *Route
SetHandler set the router handler
func (*Route) Use ¶
func (r *Route) Use(mwf ...MiddlewareFunc)
Use appends appends a MiddlewareFunc tonthe chain
Click to show internal directories.
Click to hide internal directories.