From bc4082d788ef64de3bd61931d86f44a878fc5395 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Mon, 22 May 2023 17:34:04 +0200 Subject: [PATCH 1/3] feat: support `animated` field for emojis in reaction remove events --- disnake/state.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/disnake/state.py b/disnake/state.py index 5e4725fb4c..ca915aa33f 100644 --- a/disnake/state.py +++ b/disnake/state.py @@ -885,6 +885,7 @@ def parse_message_reaction_remove(self, data: gateway.MessageReactionRemoveEvent emoji = PartialEmoji.with_state( self, id=emoji_id, + animated=emoji.get("animated", False), # may be `None` in gateway events if custom emoji data isn't available anymore # https://discord.com/developers/docs/resources/emoji#emoji-object-custom-emoji-examples name=emoji["name"], # type: ignore @@ -912,6 +913,7 @@ def parse_message_reaction_remove_emoji( emoji = PartialEmoji.with_state( self, id=emoji_id, + animated=emoji.get("animated", False), # may be `None` in gateway events if custom emoji data isn't available anymore # https://discord.com/developers/docs/resources/emoji#emoji-object-custom-emoji-examples name=emoji["name"], # type: ignore From e10358e7f2d05f01f2e7845173c625b0a914d68f Mon Sep 17 00:00:00 2001 From: shiftinv Date: Mon, 22 May 2023 17:38:12 +0200 Subject: [PATCH 2/3] docs: add changelog entry --- changelog/1040.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/1040.feature.rst diff --git a/changelog/1040.feature.rst b/changelog/1040.feature.rst new file mode 100644 index 0000000000..b1119f3542 --- /dev/null +++ b/changelog/1040.feature.rst @@ -0,0 +1 @@ +Support ``animated`` emoji field in reaction removal events (e.g. :func:`on_raw_reaction_remove`). From 278cb44ff023884ab63b11a8330ba3af9eadb984 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Mon, 22 May 2023 23:01:01 +0200 Subject: [PATCH 3/3] docs: add versionchanged to raw models --- disnake/raw_models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/disnake/raw_models.py b/disnake/raw_models.py index af3bec90cd..cbd3686644 100644 --- a/disnake/raw_models.py +++ b/disnake/raw_models.py @@ -164,6 +164,10 @@ class RawReactionActionEvent(_RawReprMixin): The guild ID where the reaction addition or removal took place, if applicable. emoji: :class:`PartialEmoji` The custom or unicode emoji being used. + + .. versionchanged:: 2.9 + This now also includes the correct :attr:`~PartialEmoji.animated` value when a reaction was removed. + member: Optional[:class:`Member`] The member who added the reaction. Only available if `event_type` is `REACTION_ADD` and the reaction is inside a guild. @@ -236,6 +240,9 @@ class RawReactionClearEmojiEvent(_RawReprMixin): The guild ID where the reaction clear took place, if applicable. emoji: :class:`PartialEmoji` The custom or unicode emoji being removed. + + .. versionchanged:: 2.9 + This now also includes the correct :attr:`~PartialEmoji.animated` value. """ __slots__ = ("message_id", "channel_id", "guild_id", "emoji")