discordgo icon indicating copy to clipboard operation
discordgo copied to clipboard

MessageReactionRemove returns a 404?

Open eslindsey opened this issue 4 years ago • 2 comments

I'm trying to remove a reaction as soon as it is added, so I am trying this:

func messageReactionAdd(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
    err = s.MessageReactionRemove(m.ChannelID, m.MessageID, m.Emoji.ID, m.UserID)
    if err != nil {
        log.WithFields(log.Fields{"err": err}).Warning("Couldn't remove reaction from message")
    }
}

but it returns this:

WARN[Sep 14 06:20:54.821] Couldn't remove reaction from message         err="HTTP 404 Not Found, {\"message\": \"404: Not Found\", \"code\": 0}"

Is this normal behavior?

eslindsey avatar Sep 14 '20 10:09 eslindsey

(*Emoji).ID doesn’t have a valid value on Unicode emojis. See (*Emoji).APIName, which exists specifically for this use case.

CarsonHoffman avatar Sep 14 '20 14:09 CarsonHoffman

In that case might I suggest changing the signature of:

func (s *Session) MessageReactionRemove(channelID, messageID, emojiID, userID string) error

to:

func (s *Session) MessageReactionRemove(channelID, messageID, emojiAPIName, userID string) error

to make things a bit easier on the uninitiated?

Thank you for the reply, by the way; changing to use .APIName() worked!

eslindsey avatar Oct 05 '20 06:10 eslindsey