Josh
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
24 additions and
3 deletions
-
discord/flags.py
-
discord/state.py
-
discord/types/threads.py
-
docs/api.rst
|
|
@ -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): |
|
|
|
|
|
@ -1096,11 +1096,22 @@ Stages |
|
|
|
Threads |
|
|
|
~~~~~~~~ |
|
|
|
|
|
|
|
.. function:: on_thread_create(thread) |
|
|
|
|
|
|
|
Called whenever a thread is created. |
|
|
|
|
|
|
|
Note that you can get the guild from :attr:`Thread.guild`. |
|
|
|
|
|
|
|
This requires :attr:`Intents.guilds` to be enabled. |
|
|
|
|
|
|
|
.. versionadded:: 2.0 |
|
|
|
|
|
|
|
:param thread: The thread that was created. |
|
|
|
:type thread: :class:`Thread` |
|
|
|
|
|
|
|
.. function:: on_thread_join(thread) |
|
|
|
|
|
|
|
Called whenever a thread is joined or created. Note that from the API's perspective there is no way to |
|
|
|
differentiate between a thread being created or the bot joining a thread. |
|
|
|
Called whenever a thread is joined. |
|
|
|
|
|
|
|
Note that you can get the guild from :attr:`Thread.guild`. |
|
|
|
|
|
|
|