|
@ -27,6 +27,7 @@ from __future__ import annotations |
|
|
from typing import TYPE_CHECKING, Literal, Optional, Set, List, Tuple, Union |
|
|
from typing import TYPE_CHECKING, Literal, Optional, Set, List, Tuple, Union |
|
|
|
|
|
|
|
|
from .enums import ChannelType, ReadStateType, try_enum |
|
|
from .enums import ChannelType, ReadStateType, try_enum |
|
|
|
|
|
from .colour import Colour |
|
|
from .utils import _get_as_snowflake |
|
|
from .utils import _get_as_snowflake |
|
|
|
|
|
|
|
|
if TYPE_CHECKING: |
|
|
if TYPE_CHECKING: |
|
@ -204,9 +205,29 @@ class RawReactionActionEvent(_RawReprMixin): |
|
|
``REACTION_REMOVE`` for reaction removal. |
|
|
``REACTION_REMOVE`` for reaction removal. |
|
|
|
|
|
|
|
|
.. versionadded:: 1.3 |
|
|
.. versionadded:: 1.3 |
|
|
|
|
|
burst: :class:`bool` |
|
|
|
|
|
Whether the reaction was a burst reaction, also known as a "super reaction". |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.4 |
|
|
|
|
|
burst_colours: List[:class:`Colour`] |
|
|
|
|
|
A list of colours used for burst reaction animation. Only available if ``burst`` is ``True`` |
|
|
|
|
|
and if ``event_type`` is ``REACTION_ADD``. |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.0 |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
__slots__ = ('message_id', 'user_id', 'channel_id', 'guild_id', 'emoji', 'event_type', 'member', 'message_author_id') |
|
|
__slots__ = ( |
|
|
|
|
|
'message_id', |
|
|
|
|
|
'user_id', |
|
|
|
|
|
'channel_id', |
|
|
|
|
|
'guild_id', |
|
|
|
|
|
'emoji', |
|
|
|
|
|
'event_type', |
|
|
|
|
|
'member', |
|
|
|
|
|
'message_author_id', |
|
|
|
|
|
'burst', |
|
|
|
|
|
'burst_colours', |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
def __init__(self, data: ReactionActionEvent, emoji: PartialEmoji, event_type: ReactionActionType) -> 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']) |
|
@ -216,12 +237,22 @@ class RawReactionActionEvent(_RawReprMixin): |
|
|
self.event_type: ReactionActionType = 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') |
|
|
self.message_author_id: Optional[int] = _get_as_snowflake(data, 'message_author_id') |
|
|
|
|
|
self.burst: bool = data.get('burst', False) |
|
|
|
|
|
self.burst_colours: List[Colour] = [Colour.from_str(c) for c in data.get('burst_colours', [])] |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
self.guild_id: Optional[int] = int(data['guild_id']) |
|
|
self.guild_id: Optional[int] = int(data['guild_id']) |
|
|
except KeyError: |
|
|
except KeyError: |
|
|
self.guild_id: Optional[int] = None |
|
|
self.guild_id: Optional[int] = None |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def burst_colors(self) -> List[Colour]: |
|
|
|
|
|
"""An alias of :attr:`burst_colours`. |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.4 |
|
|
|
|
|
""" |
|
|
|
|
|
return self.burst_colours |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RawReactionClearEvent(_RawReprMixin): |
|
|
class RawReactionClearEvent(_RawReprMixin): |
|
|
"""Represents the payload for a :func:`on_raw_reaction_clear` event. |
|
|
"""Represents the payload for a :func:`on_raw_reaction_clear` event. |
|
|