From b6deecb67d2c7ca5e4711cd54a332e7d5dcf8d19 Mon Sep 17 00:00:00 2001 From: AlexPresso <15526962+AlexPresso@users.noreply.github.com> Date: Thu, 4 Feb 2021 01:13:48 +0100 Subject: [PATCH] Add MessageReactionsRemoveEmoji (#873) * Add MessageReactionsRemove * Add MessageReactionsRemove * Rename MessageReactionsRemove to MessageReactionsRemoveEmoji Co-authored-by: Qais Patankar * Update MessageReactionsRemoveEmoji comments Co-authored-by: Qais Patankar --- restapi.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/restapi.go b/restapi.go index d3df5ed..09c0b41 100644 --- a/restapi.go +++ b/restapi.go @@ -2209,6 +2209,19 @@ func (s *Session) MessageReactionsRemoveAll(channelID, messageID string) error { return err } +// MessageReactionsRemoveEmoji deletes all reactions of a certain emoji from a message +// channelID : The channel ID +// messageID : The message ID +// emojiID : The emoji ID +func (s *Session) MessageReactionsRemoveEmoji(channelID, messageID, emojiID string) error { + + // emoji such as #⃣ need to have # escaped + emojiID = strings.Replace(emojiID, "#", "%23", -1) + _, err := s.RequestWithBucketID("DELETE", EndpointMessageReactions(channelID, messageID, emojiID), nil, EndpointMessageReactions(channelID, messageID, emojiID)) + + return err +} + // MessageReactions gets all the users reactions for a specific emoji. // channelID : The channel ID. // messageID : The message ID.