Add guild_id attribute to RawMessageUpdateEvent

This commit is contained in:
Sebastian Law 2021-02-28 20:55:37 -08:00 committed by GitHub
parent f7a4bef4ff
commit a2730a32dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,6 +93,10 @@ class RawMessageUpdateEvent(_RawReprMixin):
The channel ID where the update took place.
.. versionadded:: 1.3
guild_id: Optional[:class:`int`]
The guild ID where the message got updated, if applicable.
.. versionadded:: 1.7
data: :class:`dict`
The raw data given by the `gateway <https://discord.com/developers/docs/topics/gateway#message-update>`_
@ -101,7 +105,7 @@ class RawMessageUpdateEvent(_RawReprMixin):
it is modified by the data in :attr:`RawMessageUpdateEvent.data`.
"""
__slots__ = ('message_id', 'channel_id', 'data', 'cached_message')
__slots__ = ('message_id', 'channel_id', 'guild_id', 'data', 'cached_message')
def __init__(self, data):
self.message_id = int(data['id'])
@ -109,6 +113,11 @@ class RawMessageUpdateEvent(_RawReprMixin):
self.data = data
self.cached_message = None
try:
self.guild_id = int(data['guild_id'])
except KeyError:
self.guild_id = None
class RawReactionActionEvent(_RawReprMixin):
"""Represents the payload for a :func:`on_raw_reaction_add` or
:func:`on_raw_reaction_remove` event.