aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
authorJosh <[email protected]>2021-08-27 05:52:07 +1000
committerGitHub <[email protected]>2021-08-26 15:52:07 -0400
commitd2ea33e5e920683b182d78f8fc49b0adb43d506d (patch)
tree944bb20cf2096dbc2ab57295314251b4aebea6d9 /discord
parentAdd Client.status attribute (diff)
downloaddiscord.py-d2ea33e5e920683b182d78f8fc49b0adb43d506d.tar.xz
discord.py-d2ea33e5e920683b182d78f8fc49b0adb43d506d.zip
Add support for invitable thread option
Diffstat (limited to 'discord')
-rw-r--r--discord/http.py3
-rw-r--r--discord/threads.py11
-rw-r--r--discord/types/threads.py1
3 files changed, 15 insertions, 0 deletions
diff --git a/discord/http.py b/discord/http.py
index 739f0f66..72fab011 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -826,6 +826,7 @@ class HTTPClient:
'archived',
'auto_archive_duration',
'locked',
+ 'invitable',
'default_auto_archive_duration',
)
payload = {k: v for k, v in options.items() if k in valid_keys}
@@ -907,12 +908,14 @@ class HTTPClient:
name: str,
auto_archive_duration: threads.ThreadArchiveDuration,
type: threads.ThreadType,
+ invitable: bool,
reason: Optional[str] = None,
) -> Response[threads.Thread]:
payload = {
'name': name,
'auto_archive_duration': auto_archive_duration,
'type': type,
+ 'invitable': invitable,
}
route = Route('POST', '/channels/{channel_id}/threads', channel_id=channel_id)
diff --git a/discord/threads.py b/discord/threads.py
index 1b016634..6c9a7495 100644
--- a/discord/threads.py
+++ b/discord/threads.py
@@ -111,6 +111,9 @@ class Thread(Messageable, Hashable):
Whether the thread is archived.
locked: :class:`bool`
Whether the thread is locked.
+ invitable: :class:`bool`
+ Whether non-moderators can add other non-moderators to this thread.
+ This is always ``True`` for public threads.
archiver_id: Optional[:class:`int`]
The user's ID that archived this thread.
auto_archive_duration: :class:`int`
@@ -136,6 +139,7 @@ class Thread(Messageable, Hashable):
'me',
'locked',
'archived',
+ 'invitable',
'archiver_id',
'auto_archive_duration',
'archive_timestamp',
@@ -184,6 +188,7 @@ class Thread(Messageable, Hashable):
self.auto_archive_duration = data['auto_archive_duration']
self.archive_timestamp = parse_time(data['archive_timestamp'])
self.locked = data.get('locked', False)
+ self.invitable = data.get('invitable', True)
def _update(self, data):
try:
@@ -521,6 +526,7 @@ class Thread(Messageable, Hashable):
name: str = MISSING,
archived: bool = MISSING,
locked: bool = MISSING,
+ invitable: bool = MISSING,
slowmode_delay: int = MISSING,
auto_archive_duration: ThreadArchiveDuration = MISSING,
) -> Thread:
@@ -543,6 +549,9 @@ class Thread(Messageable, Hashable):
Whether to archive the thread or not.
locked: :class:`bool`
Whether to lock the thread or not.
+ invitable: :class:`bool`
+ Whether non-moderators can add other non-moderators to this thread.
+ Only available for private threads.
auto_archive_duration: :class:`int`
The new duration in minutes before a thread is automatically archived for inactivity.
Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
@@ -571,6 +580,8 @@ class Thread(Messageable, Hashable):
payload['auto_archive_duration'] = auto_archive_duration
if locked is not MISSING:
payload['locked'] = locked
+ if invitable is not MISSING:
+ payload['invitable'] = invitable
if slowmode_delay is not MISSING:
payload['rate_limit_per_user'] = slowmode_delay
diff --git a/discord/types/threads.py b/discord/types/threads.py
index baf8def4..328be131 100644
--- a/discord/types/threads.py
+++ b/discord/types/threads.py
@@ -41,6 +41,7 @@ class ThreadMember(TypedDict):
class _ThreadMetadataOptional(TypedDict, total=False):
archiver_id: Snowflake
locked: bool
+ invitable: bool
class ThreadMetadata(_ThreadMetadataOptional):