aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/channel.py10
-rw-r--r--discord/http.py1
-rw-r--r--discord/types/channel.py3
3 files changed, 13 insertions, 1 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 05e9c55c..21b87c1b 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -127,6 +127,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
.. note::
To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead.
+ default_auto_archive_duration: :class:`int`
+ The default auto archive duration in minutes for threads created in this channel.
+
+ .. versionadded:: 2.0
"""
__slots__ = (
@@ -142,6 +146,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
'_overwrites',
'_type',
'last_message_id',
+ 'default_auto_archive_duration',
)
def __init__(self, *, state: ConnectionState, guild: Guild, data: TextChannelPayload):
@@ -171,6 +176,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
self.nsfw: bool = data.get('nsfw', False)
# Does this need coercion into `int`? No idea yet.
self.slowmode_delay: int = data.get('rate_limit_per_user', 0)
+ self.default_auto_archive_duration: ThreadArchiveDuration = data.get('default_auto_archive_duration', 1440)
self._type: int = data.get('type', self._type)
self.last_message_id: Optional[int] = utils._get_as_snowflake(data, 'last_message_id')
self._fill_overwrites(data)
@@ -250,6 +256,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
sync_permissions: bool = ...,
category: Optional[CategoryChannel] = ...,
slowmode_delay: int = ...,
+ default_auto_archive_duration: ThreadArchiveDuration = ...,
type: ChannelType = ...,
overwrites: Mapping[Union[Role, Member, Snowflake], PermissionOverwrite] = ...,
) -> None:
@@ -301,6 +308,9 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
overwrites: :class:`Mapping`
A :class:`Mapping` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply to the channel.
+ default_auto_archive_duration: :class:`int`
+ The new default auto archive duration in minutes for threads created in this channel.
+ Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
Raises
------
diff --git a/discord/http.py b/discord/http.py
index f998815f..7e7e3cdb 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -823,6 +823,7 @@ class HTTPClient:
'archived',
'auto_archive_duration',
'locked',
+ 'default_auto_archive_duration',
)
payload = {k: v for k, v in options.items() if k in valid_keys}
return self.request(r, reason=reason, json=payload)
diff --git a/discord/types/channel.py b/discord/types/channel.py
index a57cf93c..a35351e4 100644
--- a/discord/types/channel.py
+++ b/discord/types/channel.py
@@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
from typing import List, Literal, Optional, TypedDict, Union
from .user import PartialUser
from .snowflake import Snowflake
-from .threads import ThreadMetadata, ThreadMember
+from .threads import ThreadMetadata, ThreadMember, ThreadArchiveDuration
OverwriteType = Literal[0, 1]
@@ -63,6 +63,7 @@ class _TextChannelOptional(TypedDict, total=False):
last_message_id: Optional[Snowflake]
last_pin_timestamp: str
rate_limit_per_user: int
+ default_auto_archive_duration: ThreadArchiveDuration
class TextChannel(_BaseGuildChannel, _TextChannelOptional):