mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-03-23 02:19:22 +00:00
Fixed bug where MessageCreate middlewares are called for other events
This commit is contained in:
parent
7f2b663dba
commit
b45c0489bb
|
@ -30,7 +30,12 @@ func (ctx *Context) filterEventType(evT reflect.Type) []*CommandContext {
|
|||
}
|
||||
|
||||
if found {
|
||||
middles = append(middles, ctx.mwMethods...)
|
||||
// Search for middlewares with the same type:
|
||||
for _, mw := range ctx.mwMethods {
|
||||
if mw.event == evT {
|
||||
middles = append(middles, mw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, sub := range ctx.subcommands {
|
||||
|
@ -53,7 +58,12 @@ func (ctx *Context) filterEventType(evT reflect.Type) []*CommandContext {
|
|||
}
|
||||
|
||||
if found {
|
||||
middles = append(middles, sub.mwMethods...)
|
||||
// Search for middlewares with the same type:
|
||||
for _, mw := range sub.mwMethods {
|
||||
if mw.event == evT {
|
||||
middles = append(middles, mw)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue