mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 18:33:02 +00:00
Add new on_thread_create event
This commit is contained in:
@ -552,6 +552,10 @@ class Intents(BaseFlags):
|
||||
- :func:`on_guild_channel_create`
|
||||
- :func:`on_guild_channel_delete`
|
||||
- :func:`on_guild_channel_pins_update`
|
||||
- :func:`on_thread_create`
|
||||
- :func:`on_thread_join`
|
||||
- :func:`on_thread_update`
|
||||
- :func:`on_thread_delete`
|
||||
|
||||
This also corresponds to the following attributes and classes in terms of cache:
|
||||
|
||||
@ -574,6 +578,8 @@ class Intents(BaseFlags):
|
||||
- :func:`on_member_remove`
|
||||
- :func:`on_member_update`
|
||||
- :func:`on_user_update`
|
||||
- :func:`on_thread_member_join`
|
||||
- :func:`on_thread_member_remove`
|
||||
|
||||
This also corresponds to the following attributes and classes in terms of cache:
|
||||
|
||||
|
@ -850,7 +850,10 @@ class ConnectionState:
|
||||
has_thread = guild.get_thread(thread.id)
|
||||
guild._add_thread(thread)
|
||||
if not has_thread:
|
||||
self.dispatch('thread_join', thread)
|
||||
if data.get('newly_created'):
|
||||
self.dispatch('thread_create', thread)
|
||||
else:
|
||||
self.dispatch('thread_join', thread)
|
||||
|
||||
def parse_thread_update(self, data: gw.ThreadUpdateEvent) -> None:
|
||||
guild_id = int(data['guild_id'])
|
||||
|
@ -64,6 +64,7 @@ class Thread(TypedDict):
|
||||
member: NotRequired[ThreadMember]
|
||||
last_message_id: NotRequired[Optional[Snowflake]]
|
||||
last_pin_timestamp: NotRequired[Optional[Snowflake]]
|
||||
newly_created: NotRequired[bool]
|
||||
|
||||
|
||||
class ThreadPaginationPayload(TypedDict):
|
||||
|
Reference in New Issue
Block a user