mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-06 18:11:59 +00:00
Add support for invitable thread option
This commit is contained in:
parent
2f2c39ed22
commit
d2ea33e5e9
@ -826,6 +826,7 @@ class HTTPClient:
|
|||||||
'archived',
|
'archived',
|
||||||
'auto_archive_duration',
|
'auto_archive_duration',
|
||||||
'locked',
|
'locked',
|
||||||
|
'invitable',
|
||||||
'default_auto_archive_duration',
|
'default_auto_archive_duration',
|
||||||
)
|
)
|
||||||
payload = {k: v for k, v in options.items() if k in valid_keys}
|
payload = {k: v for k, v in options.items() if k in valid_keys}
|
||||||
@ -907,12 +908,14 @@ class HTTPClient:
|
|||||||
name: str,
|
name: str,
|
||||||
auto_archive_duration: threads.ThreadArchiveDuration,
|
auto_archive_duration: threads.ThreadArchiveDuration,
|
||||||
type: threads.ThreadType,
|
type: threads.ThreadType,
|
||||||
|
invitable: bool,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
) -> Response[threads.Thread]:
|
) -> Response[threads.Thread]:
|
||||||
payload = {
|
payload = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'auto_archive_duration': auto_archive_duration,
|
'auto_archive_duration': auto_archive_duration,
|
||||||
'type': type,
|
'type': type,
|
||||||
|
'invitable': invitable,
|
||||||
}
|
}
|
||||||
|
|
||||||
route = Route('POST', '/channels/{channel_id}/threads', channel_id=channel_id)
|
route = Route('POST', '/channels/{channel_id}/threads', channel_id=channel_id)
|
||||||
|
@ -111,6 +111,9 @@ class Thread(Messageable, Hashable):
|
|||||||
Whether the thread is archived.
|
Whether the thread is archived.
|
||||||
locked: :class:`bool`
|
locked: :class:`bool`
|
||||||
Whether the thread is locked.
|
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`]
|
archiver_id: Optional[:class:`int`]
|
||||||
The user's ID that archived this thread.
|
The user's ID that archived this thread.
|
||||||
auto_archive_duration: :class:`int`
|
auto_archive_duration: :class:`int`
|
||||||
@ -136,6 +139,7 @@ class Thread(Messageable, Hashable):
|
|||||||
'me',
|
'me',
|
||||||
'locked',
|
'locked',
|
||||||
'archived',
|
'archived',
|
||||||
|
'invitable',
|
||||||
'archiver_id',
|
'archiver_id',
|
||||||
'auto_archive_duration',
|
'auto_archive_duration',
|
||||||
'archive_timestamp',
|
'archive_timestamp',
|
||||||
@ -184,6 +188,7 @@ class Thread(Messageable, Hashable):
|
|||||||
self.auto_archive_duration = data['auto_archive_duration']
|
self.auto_archive_duration = data['auto_archive_duration']
|
||||||
self.archive_timestamp = parse_time(data['archive_timestamp'])
|
self.archive_timestamp = parse_time(data['archive_timestamp'])
|
||||||
self.locked = data.get('locked', False)
|
self.locked = data.get('locked', False)
|
||||||
|
self.invitable = data.get('invitable', True)
|
||||||
|
|
||||||
def _update(self, data):
|
def _update(self, data):
|
||||||
try:
|
try:
|
||||||
@ -521,6 +526,7 @@ class Thread(Messageable, Hashable):
|
|||||||
name: str = MISSING,
|
name: str = MISSING,
|
||||||
archived: bool = MISSING,
|
archived: bool = MISSING,
|
||||||
locked: bool = MISSING,
|
locked: bool = MISSING,
|
||||||
|
invitable: bool = MISSING,
|
||||||
slowmode_delay: int = MISSING,
|
slowmode_delay: int = MISSING,
|
||||||
auto_archive_duration: ThreadArchiveDuration = MISSING,
|
auto_archive_duration: ThreadArchiveDuration = MISSING,
|
||||||
) -> Thread:
|
) -> Thread:
|
||||||
@ -543,6 +549,9 @@ class Thread(Messageable, Hashable):
|
|||||||
Whether to archive the thread or not.
|
Whether to archive the thread or not.
|
||||||
locked: :class:`bool`
|
locked: :class:`bool`
|
||||||
Whether to lock the thread or not.
|
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`
|
auto_archive_duration: :class:`int`
|
||||||
The new duration in minutes before a thread is automatically archived for inactivity.
|
The new duration in minutes before a thread is automatically archived for inactivity.
|
||||||
Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
|
Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
|
||||||
@ -571,6 +580,8 @@ class Thread(Messageable, Hashable):
|
|||||||
payload['auto_archive_duration'] = auto_archive_duration
|
payload['auto_archive_duration'] = auto_archive_duration
|
||||||
if locked is not MISSING:
|
if locked is not MISSING:
|
||||||
payload['locked'] = locked
|
payload['locked'] = locked
|
||||||
|
if invitable is not MISSING:
|
||||||
|
payload['invitable'] = invitable
|
||||||
if slowmode_delay is not MISSING:
|
if slowmode_delay is not MISSING:
|
||||||
payload['rate_limit_per_user'] = slowmode_delay
|
payload['rate_limit_per_user'] = slowmode_delay
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ class ThreadMember(TypedDict):
|
|||||||
class _ThreadMetadataOptional(TypedDict, total=False):
|
class _ThreadMetadataOptional(TypedDict, total=False):
|
||||||
archiver_id: Snowflake
|
archiver_id: Snowflake
|
||||||
locked: bool
|
locked: bool
|
||||||
|
invitable: bool
|
||||||
|
|
||||||
|
|
||||||
class ThreadMetadata(_ThreadMetadataOptional):
|
class ThreadMetadata(_ThreadMetadataOptional):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user