|
1
|
|
|
# Copyright Pincer 2021-Present |
|
|
|
|
|
|
2
|
|
|
# Full MIT License can be found in `LICENSE` at the project root. |
|
3
|
|
|
|
|
4
|
|
|
from __future__ import annotations |
|
5
|
|
|
|
|
6
|
|
|
from dataclasses import dataclass |
|
7
|
|
|
from typing import TYPE_CHECKING |
|
8
|
|
|
|
|
9
|
|
|
from ...utils.api_object import APIObject, GuildProperty |
|
10
|
|
|
from ...utils.types import APINullable, MISSING |
|
11
|
|
|
|
|
12
|
|
|
if TYPE_CHECKING: |
|
13
|
|
|
from typing import List |
|
14
|
|
|
|
|
15
|
|
|
from ..guild.channel import Channel |
|
16
|
|
|
from ..guild.thread import ThreadMember |
|
17
|
|
|
from ...utils.snowflake import Snowflake |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
@dataclass(repr=False) |
|
21
|
|
|
class ThreadListSyncEvent(APIObject, GuildProperty): |
|
22
|
|
|
"""Sent when the current user gains access to a channel. |
|
23
|
|
|
|
|
24
|
|
|
Attributes |
|
25
|
|
|
---------- |
|
26
|
|
|
guild_id: :class:`~pincer.utils.snowflake.Snowflake` |
|
27
|
|
|
The id of the guild |
|
28
|
|
|
threads: List[:class:`~pincer.objects.guild.channel.Channel`] |
|
29
|
|
|
All active threads in the given channels that |
|
30
|
|
|
the current user can access |
|
31
|
|
|
members: List[:class:`~pincer.objects.guild.thread.ThreadMember`] |
|
32
|
|
|
All thread member objects from the synced threads for |
|
33
|
|
|
the current user, indicating which threads the current |
|
34
|
|
|
user has been added to |
|
35
|
|
|
channel_ids: APINullable[List[:class:`~pincer.utils.snowflake.Snowflake`]] |
|
36
|
|
|
The parent channel ids whose threads are being synced. |
|
37
|
|
|
If omitted, then threads were synced for the entire guild. |
|
38
|
|
|
This array may contain channel_ids that have no active |
|
39
|
|
|
threads as well, so you know to clear that data. |
|
40
|
|
|
""" |
|
41
|
|
|
|
|
42
|
|
|
guild_id: Snowflake |
|
43
|
|
|
threads: List[Channel] |
|
44
|
|
|
members: List[ThreadMember] |
|
45
|
|
|
|
|
46
|
|
|
channel_ids: APINullable[List[Snowflake]] = MISSING |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
@dataclass(repr=False) |
|
50
|
|
|
class ThreadMembersUpdateEvent(APIObject, GuildProperty): |
|
51
|
|
|
"""Sent when anyone is added to or removed from a thread. |
|
52
|
|
|
If the current user does not have the `GUILD_MEMBERS` |
|
53
|
|
|
Gateway Intent, then this event will only be sent if |
|
54
|
|
|
the current user was added to or removed from the thread. |
|
55
|
|
|
|
|
56
|
|
|
Attributes |
|
57
|
|
|
---------- |
|
58
|
|
|
id: :class:`~pincer.utils.snowflake.Snowflake` |
|
59
|
|
|
The id of the thread |
|
60
|
|
|
guild_id: :class:`~pincer.utils.snowflake.Snowflake` |
|
61
|
|
|
The id of the guild |
|
62
|
|
|
member_count: :class:`int` |
|
63
|
|
|
The approximate number of members in the thread, capped at 50 |
|
64
|
|
|
added_members: APINullable[List[:class:`~pincer.objects.guild.thread.ThreadMember`]] |
|
65
|
|
|
The users who were added to the thread |
|
66
|
|
|
removed_member_ids: APINullable[List[:class:`~pincer.utils.snowflake.Snowflake`]] |
|
67
|
|
|
The id of the users who were removed from the thread |
|
68
|
|
|
""" |
|
69
|
|
|
|
|
70
|
|
|
# noqa: E501 |
|
71
|
|
|
id: Snowflake |
|
72
|
|
|
guild_id: Snowflake |
|
73
|
|
|
member_count: int |
|
74
|
|
|
|
|
75
|
|
|
added_members: APINullable[List[ThreadMember]] = MISSING |
|
76
|
|
|
removed_member_ids: APINullable[List[Snowflake]] = MISSING |
|
77
|
|
|
|