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
|
|
|
from __future__ import annotations
|
25
|
|
|
|
26
|
|
|
from dataclasses import dataclass
|
27
|
|
|
|
28
|
|
|
from pincer.utils.timestamp import Timestamp
|
|
|
|
|
29
|
|
|
from pincer.utils.snowflake import Snowflake
|
30
|
|
|
from pincer.utils.api_object import APIObject
|
31
|
|
|
from pincer.utils.constants import APINullable, MISSING
|
32
|
|
|
|
33
|
|
|
@dataclass
|
34
|
|
|
class ThreadMetadata(APIObject):
|
35
|
|
|
"""
|
36
|
|
|
Represents a Discord Thread Metadata object
|
37
|
|
|
|
38
|
|
|
:param archived:
|
39
|
|
|
whether the thread is archived
|
40
|
|
|
|
41
|
|
|
:param auto_archive_duration:
|
42
|
|
|
duration in minutes to automatically archive the thread
|
43
|
|
|
after recent activity, can be set to: 60, 1440, 4320, 10080
|
44
|
|
|
|
45
|
|
|
:param archive_timestamp:
|
46
|
|
|
timestamp when the thread's archive status was last changed,
|
47
|
|
|
used for calculating recent activity
|
48
|
|
|
|
49
|
|
|
:param locked:
|
50
|
|
|
whether the thread is locked; when a thread is locked,
|
51
|
|
|
only users with MANAGE_THREADS can unarchive it
|
52
|
|
|
|
53
|
|
|
:param invitable:
|
54
|
|
|
whether non-moderators can add other non-moderators to a thread;
|
55
|
|
|
only available on private threads
|
56
|
|
|
"""
|
57
|
|
|
archived: bool
|
58
|
|
|
auto_archive_duration: int
|
59
|
|
|
archive_timestamp: Timestamp
|
60
|
|
|
locked: bool
|
61
|
|
|
|
62
|
|
|
invitable: APINullable[bool] = MISSING
|
|
|
|
|
63
|
|
|
|
64
|
|
|
@dataclass
|
65
|
|
|
class ThreadMember(APIObject):
|
66
|
|
|
"""
|
67
|
|
|
Represents a Discord Thread Member object
|
68
|
|
|
|
69
|
|
|
:param join_timestamp:
|
70
|
|
|
the time the current user last joined the thread
|
71
|
|
|
|
72
|
|
|
:param flags:
|
73
|
|
|
any user-thread settings, currently only used for notifications
|
74
|
|
|
|
75
|
|
|
:param id:
|
76
|
|
|
id of the thread
|
77
|
|
|
|
78
|
|
|
:param user_id:
|
79
|
|
|
id of the user
|
80
|
|
|
"""
|
81
|
|
|
join_timestamp: Timestamp
|
82
|
|
|
flags: int
|
83
|
|
|
|
84
|
|
|
id: APINullable[Snowflake] = MISSING
|
|
|
|
|
85
|
|
|
user_id: APINullable[Snowflake] = MISSING
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|