mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-03-24 02:49:34 +00:00
Bot: Added AllowBot
This commit is contained in:
parent
86d32bdbe9
commit
70ace8e5e4
|
@ -77,6 +77,10 @@ type Context struct {
|
|||
// NewPrefix().
|
||||
HasPrefix Prefixer
|
||||
|
||||
// AllowBot makes the router also process MessageCreate events from bots.
|
||||
// This is false by default and only applies to MessageCreate.
|
||||
AllowBot bool
|
||||
|
||||
// FormatError formats any errors returned by anything, including the method
|
||||
// commands or the reflect functions. This also includes invalid usage
|
||||
// errors or unknown command errors. Returning an empty string means
|
||||
|
|
|
@ -134,6 +134,11 @@ func (ctx *Context) callCmd(ev interface{}) error {
|
|||
}
|
||||
|
||||
func (ctx *Context) callMessageCreate(mc *gateway.MessageCreateEvent) error {
|
||||
// check if bot
|
||||
if !ctx.AllowBot && mc.Author.Bot {
|
||||
return nil
|
||||
}
|
||||
|
||||
// check if prefix
|
||||
pf, ok := ctx.HasPrefix(mc)
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in a new issue