1
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
2
|
|
|
# MIT License |
3
|
|
|
# |
4
|
|
|
# Copyright (c) 2021 Pincer |
5
|
|
|
# |
6
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining |
7
|
|
|
# a copy of this software and associated documentation files |
8
|
|
|
# (the "Software"), to deal in the Software without restriction, |
9
|
|
|
# including without limitation the rights to use, copy, modify, merge, |
10
|
|
|
# publish, distribute, sublicense, and/or sell copies of the Software, |
11
|
|
|
# and to permit persons to whom the Software is furnished to do so, |
12
|
|
|
# subject to the following conditions: |
13
|
|
|
# |
14
|
|
|
# The above copyright notice and this permission notice shall be |
15
|
|
|
# included in all copies or substantial portions of the Software. |
16
|
|
|
# |
17
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
18
|
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
19
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
20
|
|
|
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
21
|
|
|
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
22
|
|
|
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
23
|
|
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
24
|
|
|
|
25
|
|
|
from dataclasses import dataclass |
26
|
|
|
from typing import List |
27
|
|
|
|
28
|
|
|
from pincer.objects.channel import Channel |
29
|
|
|
from pincer.objects.thread import ThreadMember |
30
|
|
|
from pincer.utils import APIObject, APINullable, MISSING, Snowflake |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
@dataclass |
34
|
|
|
class ThreadListSyncEvent(APIObject): |
35
|
|
|
""" |
36
|
|
|
Sent when the current user gains access to a channel. |
37
|
|
|
|
38
|
|
|
:param guild_id: |
39
|
|
|
the id of the guild |
40
|
|
|
|
41
|
|
|
:param channel_ids: |
42
|
|
|
the parent channel ids whose threads are being synced. |
43
|
|
|
If omitted, then threads were synced for the entire guild. |
44
|
|
|
This array may contain channel_ids that have no active |
45
|
|
|
threads as well, so you know to clear that data. |
46
|
|
|
|
47
|
|
|
:param threads: |
48
|
|
|
all active threads in the given channels that |
49
|
|
|
the current user can access |
50
|
|
|
|
51
|
|
|
:param members: |
52
|
|
|
all thread member objects from the synced threads for |
53
|
|
|
the current user, indicating which threads the current |
54
|
|
|
user has been added to |
55
|
|
|
""" |
56
|
|
|
guild_id: Snowflake |
57
|
|
|
threads: List[Channel] |
58
|
|
|
members: List[ThreadMember] |
59
|
|
|
|
60
|
|
|
channel_ids: APINullable[List[Snowflake]] = MISSING |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
@dataclass |
64
|
|
|
class ThreadMembersUpdateEvent(APIObject): |
65
|
|
|
""" |
66
|
|
|
Sent when anyone is added to or removed from a thread. |
67
|
|
|
If the current user does not have the `GUILD_MEMBERS` |
68
|
|
|
Gateway Intent, then this event will only be sent if |
69
|
|
|
the current user was added to or removed from the thread. |
70
|
|
|
|
71
|
|
|
:param id: |
72
|
|
|
the id of the thread |
73
|
|
|
|
74
|
|
|
:param guild_id: |
75
|
|
|
the id of the guild |
76
|
|
|
|
77
|
|
|
:param member_count: |
78
|
|
|
the approximate number of members in the thread, capped at 50 |
79
|
|
|
|
80
|
|
|
:param added_members: |
81
|
|
|
the users who were added to the thread |
82
|
|
|
|
83
|
|
|
:param removed_member_ids: |
84
|
|
|
the id of the users who were removed from the thread |
85
|
|
|
""" |
86
|
|
|
id: Snowflake |
87
|
|
|
guild_id: Snowflake |
88
|
|
|
member_count: int |
89
|
|
|
|
90
|
|
|
added_members: APINullable[List[ThreadMember]] = MISSING |
91
|
|
|
removed_member_ids: APINullable[List[Snowflake]] = MISSING |
92
|
|
|
|