diff options
| author | Sebastian Law <[email protected]> | 2021-02-28 20:55:37 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-28 23:55:37 -0500 |
| commit | a2730a32dcb2bb32b8852bb000b778eec9507792 (patch) | |
| tree | 6a1413b17154fa28aa1e8c2b8262e9653fa6f36c /discord/raw_models.py | |
| parent | [tasks] remove redundant condition in Loop.next_iteration (diff) | |
| download | discord.py-a2730a32dcb2bb32b8852bb000b778eec9507792.tar.xz discord.py-a2730a32dcb2bb32b8852bb000b778eec9507792.zip | |
Add guild_id attribute to RawMessageUpdateEvent
Diffstat (limited to 'discord/raw_models.py')
| -rw-r--r-- | discord/raw_models.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/discord/raw_models.py b/discord/raw_models.py index bc19aad5..9be268ef 100644 --- a/discord/raw_models.py +++ b/discord/raw_models.py @@ -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. |