You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
need a better way to determine if the reaction emoji is one of the poll emojis. This code does not consider that the question itself may contain an emoji and that emoji would be allowed to be used in the reactions
// TODO: need a better way to determine if the reaction emoji is one of the poll emojis. This code does not consider that the question itself may contain an emoji and that emoji would be allowed to be used in the reactions
command.Handler(session, message, channel, b)
}
func (b*Bot) messageReactionAdd(session*discordgo.Session, message*discordgo.MessageReactionAdd) {
// Ignore all messages created by the bot itself// This isn't required in this specific example but it's a good practice.ifmessage.UserID==session.State.User.ID {
return
}
msg, err:=channelMessageF(session, message.ChannelID, message.MessageID)
iferr!=nil {
infra.Logger.Error().Err(err).Msg("get channel message")
return
}
if!strings.HasPrefix(msg.Content, pollPrefix) {
return
}
// remove emoji if not one of poll emojis// TODO: need a better way to determine if the reaction emoji is one of the poll emojis. This code does not consider that the question itself may contain an emoji and that emoji would be allowed to be used in the reactionsif!strings.Contains(msg.Content, message.Emoji.Name) {
_=messageReactionRemoveF(session, message.ChannelID, message.MessageID, message.Emoji.Name, message.UserID)
return
}
for_, reaction:=rangemsg.Reactions {
ifreaction.Emoji.Name==message.MessageReaction.Emoji.Name {
continue
}
_=messageReactionRemoveF(session, message.ChannelID, message.MessageID, reaction.Emoji.Name, message.UserID)
}
}
fa898684536c7ebecf70cb38d1b6b0beaeb074f5
The text was updated successfully, but these errors were encountered:
need a better way to determine if the reaction emoji is one of the poll emojis. This code does not consider that the question itself may contain an emoji and that emoji would be allowed to be used in the reactions
devy/internal/devy/handlers.go
Line 88 in d862e31
fa898684536c7ebecf70cb38d1b6b0beaeb074f5
The text was updated successfully, but these errors were encountered: