mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Add RawReactionActionEvent.message_author_id field
This commit is contained in:
parent
270fa5f2e0
commit
b1ff8038c8
@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from typing import TYPE_CHECKING, Optional, Set, List, Tuple, Union
|
from typing import TYPE_CHECKING, Literal, Optional, Set, List, Tuple, Union
|
||||||
|
|
||||||
from .enums import ChannelType, try_enum
|
from .enums import ChannelType, try_enum
|
||||||
from .utils import _get_as_snowflake
|
from .utils import _get_as_snowflake
|
||||||
@ -57,6 +57,7 @@ if TYPE_CHECKING:
|
|||||||
from .guild import Guild
|
from .guild import Guild
|
||||||
|
|
||||||
ReactionActionEvent = Union[MessageReactionAddEvent, MessageReactionRemoveEvent]
|
ReactionActionEvent = Union[MessageReactionAddEvent, MessageReactionRemoveEvent]
|
||||||
|
ReactionActionType = Literal['REACTION_ADD', 'REACTION_REMOVE']
|
||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -196,7 +197,10 @@ class RawReactionActionEvent(_RawReprMixin):
|
|||||||
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 ``event_type`` is ``REACTION_ADD`` and the reaction is inside a guild.
|
||||||
|
|
||||||
.. versionadded:: 1.3
|
.. versionadded:: 1.3
|
||||||
|
message_author_id: Optional[:class:`int`]
|
||||||
|
The author ID of the message being reacted to. Only available if ``event_type`` is ``REACTION_ADD``.
|
||||||
|
|
||||||
|
.. versionadded:: 2.4
|
||||||
event_type: :class:`str`
|
event_type: :class:`str`
|
||||||
The event type that triggered this action. Can be
|
The event type that triggered this action. Can be
|
||||||
``REACTION_ADD`` for reaction addition or
|
``REACTION_ADD`` for reaction addition or
|
||||||
@ -205,15 +209,16 @@ class RawReactionActionEvent(_RawReprMixin):
|
|||||||
.. versionadded:: 1.3
|
.. versionadded:: 1.3
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__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, data: ReactionActionEvent, emoji: PartialEmoji, event_type: str) -> None:
|
def __init__(self, data: ReactionActionEvent, emoji: PartialEmoji, event_type: ReactionActionType) -> None:
|
||||||
self.message_id: int = int(data['message_id'])
|
self.message_id: int = int(data['message_id'])
|
||||||
self.channel_id: int = int(data['channel_id'])
|
self.channel_id: int = int(data['channel_id'])
|
||||||
self.user_id: int = int(data['user_id'])
|
self.user_id: int = int(data['user_id'])
|
||||||
self.emoji: PartialEmoji = emoji
|
self.emoji: PartialEmoji = emoji
|
||||||
self.event_type: str = event_type
|
self.event_type: ReactionActionType = event_type
|
||||||
self.member: Optional[Member] = None
|
self.member: Optional[Member] = None
|
||||||
|
self.message_author_id: Optional[int] = _get_as_snowflake(data, 'message_author_id')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.guild_id: Optional[int] = int(data['guild_id'])
|
self.guild_id: Optional[int] = int(data['guild_id'])
|
||||||
|
@ -100,6 +100,7 @@ class MessageReactionAddEvent(TypedDict):
|
|||||||
emoji: PartialEmoji
|
emoji: PartialEmoji
|
||||||
member: NotRequired[MemberWithUser]
|
member: NotRequired[MemberWithUser]
|
||||||
guild_id: NotRequired[Snowflake]
|
guild_id: NotRequired[Snowflake]
|
||||||
|
message_author_id: NotRequired[Snowflake]
|
||||||
|
|
||||||
|
|
||||||
class MessageReactionRemoveEvent(TypedDict):
|
class MessageReactionRemoveEvent(TypedDict):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user