Versions in this module Expand all Collapse all v0 v0.0.1 Dec 31, 2020 Changes in this version + var CodeblockLanguages = []string + var RegexArguments = regexp.MustCompile("(\"[^\"]+\"|[^\\s]+)") + var RegexBigCodeblock = regexp.MustCompile("(?s)\\n*```(?:([\\w.\\-]*)\\n)?(.*)```") + var RegexChannelMention = regexp.MustCompile("<#(\\d+)>") + var RegexRoleMention = regexp.MustCompile("<@&(\\d+)>") + var RegexSmallCodeblock = regexp.MustCompile("(?s)\\n*`(.*)`") + var RegexUserMention = regexp.MustCompile("<@!?(\\d+)>") + type Argument struct + func (argument *Argument) AsBool() (bool, error) + func (argument *Argument) AsChannelMentionID() string + func (argument *Argument) AsDuration() (time.Duration, error) + func (argument *Argument) AsInt() (int, error) + func (argument *Argument) AsInt64() (int64, error) + func (argument *Argument) AsRoleMentionID() string + func (argument *Argument) AsUserMentionID() string + func (argument *Argument) Raw() string + type Arguments struct + func ParseArguments(raw string) *Arguments + func (arguments *Arguments) Amount() int + func (arguments *Arguments) AsCodeblock() *Codeblock + func (arguments *Arguments) AsSingle() *Argument + func (arguments *Arguments) Get(n int) *Argument + func (arguments *Arguments) Raw() string + func (arguments *Arguments) Remove(n int) + type Codeblock struct + Content string + Language string + type Command struct + Aliases []string + Description string + Example string + Flags []string + Handler ExecutionHandler + IgnoreCase bool + Name string + RateLimiter RateLimiter + SubCommands []*Command + Usage string + func (command *Command) GetSubCmd(name string) *Command + func (command *Command) NotifyRateLimiter(ctx *Ctx) bool + type Ctx struct + Arguments *Arguments + Command *Command + CustomObjects *ObjectsMap + Event *discordgo.MessageCreate + Router *Router + Session *discordgo.Session + func (ctx *Ctx) RespondEmbed(embed *discordgo.MessageEmbed) error + func (ctx *Ctx) RespondText(text string) error + func (ctx *Ctx) RespondTextEmbed(text string, embed *discordgo.MessageEmbed) error + type DefaultRateLimiter struct + Cooldown time.Duration + RateLimitedHandler ExecutionHandler + func (rateLimiter *DefaultRateLimiter) NotifyExecution(ctx *Ctx) bool + type ExecutionHandler func(*Ctx) + type Middleware func(following ExecutionHandler) ExecutionHandler + type ObjectsMap struct + func (om *ObjectsMap) Delete(key string) + func (om *ObjectsMap) Get(key string) (interface{}, bool) + func (om *ObjectsMap) MustGet(key string) interface{} + func (om *ObjectsMap) Set(key string, val interface{}) + type RateLimiter interface + NotifyExecution func(*Ctx) bool + func NewRateLimiter(cooldown, cleanupInterval time.Duration, onRateLimited ExecutionHandler) RateLimiter + type Router struct + BotsAllowed bool + Commands []*Command + IgnorePrefixCase bool + Middlewares []Middleware + PingHandler ExecutionHandler + Prefixes []string + Storage map[string]*ObjectsMap + func Create(router *Router) *Router + func (router *Router) GetCmd(name string) *Command + func (router *Router) Handler() func(*discordgo.Session, *discordgo.MessageCreate) + func (router *Router) Initialize(session *discordgo.Session) + func (router *Router) InitializeStorage(name string) + func (router *Router) RegisterCmd(command *Command) + func (router *Router) RegisterDefaultHelpCommand(session *discordgo.Session, rateLimiter RateLimiter) + func (router *Router) RegisterMiddleware(middleware Middleware)