Documentation
¶
Index ¶
- Variables
- func BuildCheckPrefixes(command *Command) []string
- func Equals(str1, str2 string, ignoreCase bool) bool
- func StringArrayContains(array []string, str string, ignoreCase bool) bool
- func StringHasPrefix(str string, prefixes []string, ignoreCase bool) (bool, string)
- func StringTrimPreSuffix(str string, preSuffix string) string
- type Argument
- func (arg *Argument) AsBool() (bool, error)
- func (arg *Argument) AsChannelMentionID() string
- func (arg *Argument) AsDuration() (time.Duration, error)
- func (arg *Argument) AsInt() (int, error)
- func (arg *Argument) AsInt64() (int64, error)
- func (arg *Argument) AsRoleMentionID() string
- func (arg *Argument) AsUserMentionID() string
- func (arg *Argument) Raw() string
- type Arguments
- type Codeblock
- type Command
- type Ctx
- type ExecutionHandler
- type Middleware
- type ObjectsMap
- type Router
- func (r *Router) GetCmd(name string) *Command
- func (r *Router) Handler(c *disgord.Client) disgord.HandlerMessageCreate
- func (r *Router) Initialize(client *disgord.Client)
- func (r *Router) InitializeStorage(name string)
- func (r *Router) RegisterCMD(command *Command)
- func (r *Router) RegisterCMDList(commands []*Command)
- func (r *Router) RegisterDefaultHelpCommand(c *disgord.Client)
- func (r *Router) RegisterMiddleware(middleware Middleware)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RegexArguments = regexp.MustCompile("(\"[^\"]+\"|[^\\s]+)") RegexUserMention = regexp.MustCompile("<@!?(\\d+)>") RegexRoleMention = regexp.MustCompile("<@&(\\d+)>") RegexChannelMention = regexp.MustCompile("<#(\\d+)>") RegexBigCodeblock = regexp.MustCompile("(?s)\\n*```(?:([\\w.\\-]*)\\n)?(.*)```") RegexSmallCodeblock = regexp.MustCompile("(?s)\\n*`(.*)`") CodeblockLanguages = []string{}/* 315 elements not displayed */ )
Functions ¶
func BuildCheckPrefixes ¶
func StringArrayContains ¶
func StringHasPrefix ¶
StringHasPrefix checks whether or not the string contains one of the given prefixes and returns the string without the prefix
func StringTrimPreSuffix ¶
Types ¶
type Argument ¶
type Argument struct {
// contains filtered or unexported fields
}
func (*Argument) AsChannelMentionID ¶
AsChannelMentionID returns the ID of the mentioned channel or an empty string if it is no mention
func (*Argument) AsDuration ¶
AsDuration parses the given argument into a duration
func (*Argument) AsRoleMentionID ¶
AsRoleMentionID returns the ID of the mentioned role or an empty string if it is no mention
func (*Argument) AsUserMentionID ¶
AsUserMentionID returns the ID of the mentioned user or an empty string if it is no mention
type Arguments ¶
type Arguments struct {
// contains filtered or unexported fields
}
func ParseArguments ¶
func (*Arguments) AsCodeblock ¶
AsCodeblock parses the given arguments as a codeblock
type Command ¶
type Command struct {
Name string
Aliases []string
Description string
Usage string
Example string
Flags []string
IgnoreCase bool
SubCommands []*Command
Handler ExecutionHandler
}
func (*Command) GetSubCommand ¶
type Ctx ¶
type Ctx struct {
Client *disgord.Client
Session *disgord.Session
Event *disgord.MessageCreate
Args *Arguments
Command *Command
Router *Router
}
func (*Ctx) ResponseText ¶
type ExecutionHandler ¶
type ExecutionHandler func(ctx *Ctx)
type Middleware ¶
type Middleware struct {
Trigger func(ctx Ctx)
}
type ObjectsMap ¶
type ObjectsMap struct {
// contains filtered or unexported fields
}
func NewObjectsMap ¶
func NewObjectsMap() *ObjectsMap
func (*ObjectsMap) Delete ¶
func (om *ObjectsMap) Delete(key string)
func (*ObjectsMap) Get ¶
func (om *ObjectsMap) Get(key string) (interface{}, bool)
func (*ObjectsMap) MustGet ¶
func (om *ObjectsMap) MustGet(key string) interface{}
func (*ObjectsMap) Set ¶
func (om *ObjectsMap) Set(key string, val interface{})
type Router ¶
type Router struct {
Prefixes []string
IgnorePrefixCase bool
BotsAllowed bool
Commands []*Command
Client *disgord.Client
Middlewares []Middleware
PingHandler ExecutionHandler
Storage map[string]*ObjectsMap
}
func (*Router) Initialize ¶
func (*Router) InitializeStorage ¶
func (*Router) RegisterCMD ¶
func (*Router) RegisterCMDList ¶
func (*Router) RegisterDefaultHelpCommand ¶
func (*Router) RegisterMiddleware ¶
func (r *Router) RegisterMiddleware(middleware Middleware)
Click to show internal directories.
Click to hide internal directories.