mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 10:22:59 +00:00
Add on_raw_thread_update event
This commit is contained in:
@ -40,6 +40,7 @@ if TYPE_CHECKING:
|
||||
MessageReactionRemoveEmojiEvent as ReactionClearEmojiEvent,
|
||||
MessageUpdateEvent,
|
||||
IntegrationDeleteEvent,
|
||||
ThreadUpdateEvent,
|
||||
ThreadDeleteEvent,
|
||||
TypingStartEvent,
|
||||
GuildMemberRemoveEvent,
|
||||
@ -61,6 +62,7 @@ __all__ = (
|
||||
'RawReactionClearEvent',
|
||||
'RawReactionClearEmojiEvent',
|
||||
'RawIntegrationDeleteEvent',
|
||||
'RawThreadUpdateEvent',
|
||||
'RawThreadDeleteEvent',
|
||||
'RawTypingEvent',
|
||||
'RawMemberRemoveEvent',
|
||||
@ -294,6 +296,38 @@ class RawIntegrationDeleteEvent(_RawReprMixin):
|
||||
self.application_id: Optional[int] = None
|
||||
|
||||
|
||||
class RawThreadUpdateEvent(_RawReprMixin):
|
||||
"""Represents the payload for a :func:`on_raw_thread_update` event.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Attributes
|
||||
----------
|
||||
thread_id: :class:`int`
|
||||
The ID of the thread that was updated.
|
||||
thread_type: :class:`discord.ChannelType`
|
||||
The channel type of the updated thread.
|
||||
guild_id: :class:`int`
|
||||
The ID of the guild the thread is in.
|
||||
parent_id: :class:`int`
|
||||
The ID of the channel the thread belongs to.
|
||||
data: :class:`dict`
|
||||
The raw data given by the :ddocs:`gateway <topics/gateway#thread-update>`
|
||||
thread: Optional[:class:`discord.Thread`]
|
||||
The thread, if it could be found in the internal cache.
|
||||
"""
|
||||
|
||||
__slots__ = ('thread_id', 'thread_type', 'parent_id', 'guild_id', 'data', 'thread')
|
||||
|
||||
def __init__(self, data: ThreadUpdateEvent) -> None:
|
||||
self.thread_id: int = int(data['id'])
|
||||
self.thread_type: ChannelType = try_enum(ChannelType, data['type'])
|
||||
self.guild_id: int = int(data['guild_id'])
|
||||
self.parent_id: int = int(data['parent_id'])
|
||||
self.data: ThreadUpdateEvent = data
|
||||
self.thread: Optional[Thread] = None
|
||||
|
||||
|
||||
class RawThreadDeleteEvent(_RawReprMixin):
|
||||
"""Represents the payload for a :func:`on_raw_thread_delete` event.
|
||||
|
||||
|
Reference in New Issue
Block a user