Documentation ¶
Index ¶
- Variables
- type Argument
- func (argument *Argument) AsBool() (bool, error)
- func (argument *Argument) AsChannelMentionID() string
- func (argument *Argument) AsInt() (int, error)
- func (argument *Argument) AsInt64() (int64, error)
- func (argument *Argument) AsRoleMentionID() string
- func (argument *Argument) AsUserMentionID() string
- type Arguments
- type Command
- type Ctx
- type ExecutionHandler
- type RateLimiter
- type Router
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // RegexUserMention defines the regex a user mention has to match RegexUserMention = regexp.MustCompile("<@!?(\\d+)>") // RegexRoleMention defines the regex a role mention has to match RegexRoleMention = regexp.MustCompile("<@&(\\d+)>") // RegexChannelMention defines the regex a channel mention has to match RegexChannelMention = regexp.MustCompile("<#(\\d+)>") )
Functions ¶
This section is empty.
Types ¶
type Argument ¶ added in v0.3.0
type Argument struct {
Raw string
}
Argument represents a single argument
func (*Argument) AsChannelMentionID ¶ added in v0.3.0
AsChannelMentionID returns the ID of the mentioned channel or an empty string if it is no mention
func (*Argument) AsRoleMentionID ¶ added in v0.3.0
AsRoleMentionID returns the ID of the mentioned role or an empty string if it is no mention
func (*Argument) AsUserMentionID ¶ added in v0.3.0
AsUserMentionID returns the ID of the mentioned user or an empty string if it is no mention
type Arguments ¶ added in v0.3.0
Arguments represents arguments used in a command.
func ParseArguments ¶ added in v0.3.0
type Ctx ¶ added in v0.3.0
type Ctx struct { Session *discordgo.Session Event *discordgo.MessageCreate Args *Arguments Router *Router Command *Command }
func (*Ctx) ReplyEmbed ¶ added in v0.3.0
func (ctx *Ctx) ReplyEmbed(embed *discordgo.MessageEmbed) error
ReplyEmbed responds with the given embed message
func (*Ctx) ReplyTextEmbed ¶ added in v0.3.0
func (ctx *Ctx) ReplyTextEmbed(text string, embed *discordgo.MessageEmbed) error
ReplyTextEmbed responds with the given text and embed message
type ExecutionHandler ¶ added in v0.3.0
ExecutionHandler represents a handler for a context execution
type RateLimiter ¶ added in v0.3.0
func NewRateLimiter ¶ added in v0.3.0
func NewRateLimiter(cooldown time.Duration) *RateLimiter
func (*RateLimiter) Contains ¶ added in v0.3.0
func (r *RateLimiter) Contains(key string) bool
func (*RateLimiter) Expires ¶ added in v0.3.0
func (r *RateLimiter) Expires(key string) (time.Duration, error)
func (*RateLimiter) Set ¶ added in v0.3.0
func (r *RateLimiter) Set(key string)
type Router ¶ added in v0.3.0
type Router struct { Commands map[string]*Command CaseSensitive bool AuthorID string Storage *Storage PrefixResolver func(*discordgo.Session, *discordgo.MessageCreate) []string NotCommandCallback func(*Ctx) error OnErrorCallback func(*Ctx, error) OnRateLimitCallback func(*Ctx) error OnNoPermissionsCallback func(*Ctx) error OnNSFWCallback func(*Ctx) error OnExecuteCallback func(*Ctx) error OnPanicCallBack func(ctx *Ctx, recover interface{}) }
func (*Router) Handler ¶ added in v0.3.0
func (r *Router) Handler() func(*discordgo.Session, *discordgo.MessageCreate)
func (*Router) Initialize ¶ added in v0.3.0
func (*Router) RegisterCmd ¶ added in v0.3.0
type Storage ¶ added in v0.4.0
type Storage struct {
// contains filtered or unexported fields
}
Storage wraps a map[string]interface to provide thread safe access endpoints.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.