diff --git a/changelog/1079.feature.rst b/changelog/1079.feature.rst new file mode 100644 index 0000000000..3c13c28b9f --- /dev/null +++ b/changelog/1079.feature.rst @@ -0,0 +1 @@ +Add :attr:`RawReactionActionEvent.message_author_id`. diff --git a/disnake/raw_models.py b/disnake/raw_models.py index cbd3686644..8c4b57bdea 100644 --- a/disnake/raw_models.py +++ b/disnake/raw_models.py @@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, List, Literal, Optional, Set, Union, cast from .enums import ChannelType, try_enum -from .utils import get_slots +from .utils import _get_as_snowflake, get_slots if TYPE_CHECKING: from .member import Member @@ -169,7 +169,7 @@ class RawReactionActionEvent(_RawReprMixin): 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. + The member who added the reaction. Only available if :attr:`event_type` is ``REACTION_ADD`` and the reaction is inside a guild. .. versionadded:: 1.3 @@ -179,9 +179,25 @@ class RawReactionActionEvent(_RawReprMixin): ``REACTION_REMOVE`` for reaction removal. .. versionadded:: 1.3 + + message_author_id: Optional[:class:`int`] + The ID of the author who created the message that got a reaction. + Only available if :attr:`event_type` is ``REACTION_ADD``. + May also be ``None`` if the message was created by a webhook. + + .. versionadded:: 2.10 """ - __slots__ = ("message_id", "user_id", "channel_id", "guild_id", "emoji", "event_type", "member") + __slots__ = ( + "message_id", + "user_id", + "channel_id", + "guild_id", + "emoji", + "event_type", + "member", + "message_author_id", + ) def __init__( self, @@ -199,6 +215,7 @@ def __init__( self.guild_id: Optional[int] = int(data["guild_id"]) except KeyError: self.guild_id: Optional[int] = None + self.message_author_id: Optional[int] = _get_as_snowflake(data, "message_author_id") class RawReactionClearEvent(_RawReprMixin): diff --git a/disnake/types/gateway.py b/disnake/types/gateway.py index 39d46d3062..d71af27ab6 100644 --- a/disnake/types/gateway.py +++ b/disnake/types/gateway.py @@ -299,6 +299,7 @@ class _BaseReactionEvent(TypedDict): # https://discord.com/developers/docs/topics/gateway-events#message-reaction-add class MessageReactionAddEvent(_BaseReactionEvent): member: NotRequired[MemberWithUser] + message_author_id: NotRequired[Snowflake] # https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove