fix color reaction permission check
@@ -50,12 +50,6 @@ func (l *ColorListener) HandlerMessageReaction(s *discordgo.Session, e *discordg
return
}
- allowed, _, _ := l.pmw.CheckPermissions(s, e.GuildID, e.UserID, "sp.chat.colorreactions")
- if !allowed {
- s.MessageReactionRemove(e.ChannelID, e.MessageID, e.Emoji.APIName(), e.UserID)
- return
- }
-
cacheKey := e.MessageID + e.Emoji.ID
if !l.emojiCahce.Contains(cacheKey) {
return
@@ -66,6 +60,12 @@ func (l *ColorListener) HandlerMessageReaction(s *discordgo.Session, e *discordg
return
}
+ allowed, _, _ := l.pmw.CheckPermissions(s, e.GuildID, e.UserID, "sp.chat.colorreactions")
+ if !allowed {
+ s.MessageReactionRemove(e.ChannelID, e.MessageID, e.Emoji.APIName(), e.UserID)
+ return
+ }
+
user, err := s.User(e.UserID)
if err != nil {
return
