Documentation ¶
Index ¶
- Variables
- func CatchReply(message string) func(ctx *astral.Context)
- func ChannelType(t discord.ChannelType, catch CatchFunc) astral.MiddlewareFunc
- func Permission(permission discord.Permissions) astral.MiddlewareFunc
- func Recoverer(rec RecoverFunc) astral.MiddlewareFunc
- func RequireNSFW(catch CatchFunc) astral.MiddlewareFunc
- type CatchFunc
- type RecoverFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrChannelNotNSFW = errors.New("this command can only be used in an NSFW channel") ErrChannelType = errors.New("channel type does not match expected type") )
Errors
Functions ¶
func CatchReply ¶
func CatchReply(message string) func(ctx *astral.Context)
CatchReply returns a function that prints the message you pass it
func ChannelType ¶
func ChannelType(t discord.ChannelType, catch CatchFunc) astral.MiddlewareFunc
ChannelType requires the specific channel type from the message
func Permission ¶
func Permission(permission discord.Permissions) astral.MiddlewareFunc
Permission validates the permission level
func Recoverer ¶
func Recoverer(rec RecoverFunc) astral.MiddlewareFunc
Recoverer is a middleware to catch panics inside calls. Usually, this is best to handle to make sure your code is working right, HOWEVER this is useful to catch errors and log them instead of fatally erroring.
func RequireNSFW ¶
func RequireNSFW(catch CatchFunc) astral.MiddlewareFunc
RequireNSFW requires a message to be sent from an NSFW channel
Types ¶
type CatchFunc ¶
type CatchFunc func(ctx *astral.Context)
CatchFunc function called if one of the middleware experiences an error Can be left as nil
type RecoverFunc ¶
type RecoverFunc func(ctx *astral.Context, v interface{})
RecoverFunc is a function called if a handler is recovered
Click to show internal directories.
Click to hide internal directories.