Skip to content

Commit c10022c

Browse files
jordan-dayrootpre-commit-ci[bot]plun1331
authored
fix: Added member data to the raw_reaction_remove event (Pycord-Development#2412)
* fix: Added member data to the raw_reaction_remove event * style(pre-commit): auto fixes from pre-commit.com hooks * Added changelog.md for adding member data to raw reaction remove * Update CHANGELOG.md Signed-off-by: plun1331 <[email protected]> * doc: Updated documentation for the RawReactionActionEvent.member field --------- Signed-off-by: plun1331 <[email protected]> Co-authored-by: root <root@DESKTOP-U7KGUE3> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: plun1331 <[email protected]>
1 parent 2df4ac9 commit c10022c

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ These changes are available on the `master` branch, but have not yet been releas
2020
([#2417](https://github.com/Pycord-Development/pycord/pull/2417))
2121
- Added `Guild.search_members`.
2222
([#2418](https://github.com/Pycord-Development/pycord/pull/2418))
23+
- Added `member` data to the `raw_reaction_remove` event.
24+
([#2412](https://github.com/Pycord-Development/pycord/pull/2412))
2325

2426
### Fixed
2527

discord/raw_models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,7 @@ class RawReactionActionEvent(_RawReprMixin):
205205
emoji: :class:`PartialEmoji`
206206
The custom or unicode emoji being used.
207207
member: Optional[:class:`Member`]
208-
The member who added the reaction. Only available if `event_type` is `REACTION_ADD`
209-
and the reaction is inside a guild.
208+
The member who added the reaction. Only available if the reaction occurs within a guild.
210209
211210
.. versionadded:: 1.3
212211

discord/state.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,17 @@ def parse_message_reaction_remove(self, data) -> None:
783783
emoji_id = utils._get_as_snowflake(emoji, "id")
784784
emoji = PartialEmoji.with_state(self, id=emoji_id, name=emoji["name"])
785785
raw = RawReactionActionEvent(data, emoji, "REACTION_REMOVE")
786+
787+
member_data = data.get("member")
788+
if member_data:
789+
guild = self._get_guild(raw.guild_id)
790+
if guild is not None:
791+
raw.member = Member(data=member_data, guild=guild, state=self)
792+
else:
793+
raw.member = None
794+
else:
795+
raw.member = None
796+
786797
self.dispatch("raw_reaction_remove", raw)
787798

788799
message = self._get_message(raw.message_id)

0 commit comments

Comments
 (0)