mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 17:36:15 +00:00
Add support for burst reactions
This commit is contained in:
@ -74,20 +74,40 @@ class Reaction:
|
||||
emoji: Union[:class:`Emoji`, :class:`PartialEmoji`, :class:`str`]
|
||||
The reaction emoji. May be a custom emoji, or a unicode emoji.
|
||||
count: :class:`int`
|
||||
Number of times this reaction was made
|
||||
Number of times this reaction was made. This is a sum of :attr:`normal_count` and :attr:`burst_count`.
|
||||
me: :class:`bool`
|
||||
If the user sent this reaction.
|
||||
message: :class:`Message`
|
||||
Message this reaction is for.
|
||||
me_burst: :class:`bool`
|
||||
If the user sent this super reaction.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
normal_count: :class:`int`
|
||||
The number of times this reaction was made using normal reactions.
|
||||
This is not available in the gateway events such as :func:`on_reaction_add`
|
||||
or :func:`on_reaction_remove`.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
burst_count: :class:`int`
|
||||
The number of times this reaction was made using super reactions.
|
||||
This is not available in the gateway events such as :func:`on_reaction_add`
|
||||
or :func:`on_reaction_remove`.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
"""
|
||||
|
||||
__slots__ = ('message', 'count', 'emoji', 'me')
|
||||
__slots__ = ('message', 'count', 'emoji', 'me', 'me_burst', 'normal_count', 'burst_count')
|
||||
|
||||
def __init__(self, *, message: Message, data: ReactionPayload, emoji: Optional[Union[PartialEmoji, Emoji, str]] = None):
|
||||
self.message: Message = message
|
||||
self.emoji: Union[PartialEmoji, Emoji, str] = emoji or message._state.get_reaction_emoji(data['emoji'])
|
||||
self.count: int = data.get('count', 1)
|
||||
self.me: bool = data['me']
|
||||
details = data.get('count_details', {})
|
||||
self.normal_count: int = details.get('normal', 0)
|
||||
self.burst_count: int = details.get('burst', 0)
|
||||
self.me_burst: bool = data.get('me_burst', False)
|
||||
|
||||
def is_custom_emoji(self) -> bool:
|
||||
""":class:`bool`: If this is a custom emoji."""
|
||||
|
Reference in New Issue
Block a user