mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Add support for default_thread_slowmode_delay in TextChannel
This commit is contained in:
parent
a1295868a6
commit
79c508311f
@ -160,6 +160,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
The default auto archive duration in minutes for threads created in this channel.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
default_thread_slowmode_delay: :class:`int`
|
||||
The default slowmode delay in seconds for threads created in this channel.
|
||||
|
||||
.. versionadded:: 2.3
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@ -176,6 +180,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
'_type',
|
||||
'last_message_id',
|
||||
'default_auto_archive_duration',
|
||||
'default_thread_slowmode_delay',
|
||||
)
|
||||
|
||||
def __init__(self, *, state: ConnectionState, guild: Guild, data: Union[TextChannelPayload, NewsChannelPayload]):
|
||||
@ -206,6 +211,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
# 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.default_thread_slowmode_delay: int = data.get('default_thread_rate_limit_per_user', 0)
|
||||
self._type: Literal[0, 5] = data.get('type', self._type)
|
||||
self.last_message_id: Optional[int] = utils._get_as_snowflake(data, 'last_message_id')
|
||||
self._fill_overwrites(data)
|
||||
@ -301,6 +307,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
category: Optional[CategoryChannel] = ...,
|
||||
slowmode_delay: int = ...,
|
||||
default_auto_archive_duration: ThreadArchiveDuration = ...,
|
||||
default_thread_slowmode_delay: int = ...,
|
||||
type: ChannelType = ...,
|
||||
overwrites: Mapping[OverwriteKeyT, PermissionOverwrite] = ...,
|
||||
) -> TextChannel:
|
||||
@ -359,7 +366,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
default_thread_slowmode_delay: :class:`int`
|
||||
The new default slowmode delay in seconds for threads created in this channel.
|
||||
|
||||
.. versionadded:: 2.3
|
||||
Raises
|
||||
------
|
||||
ValueError
|
||||
|
@ -1200,6 +1200,7 @@ class Guild(Hashable):
|
||||
nsfw: bool = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
default_auto_archive_duration: int = MISSING,
|
||||
default_thread_slowmode_delay: int = MISSING,
|
||||
) -> TextChannel:
|
||||
"""|coro|
|
||||
|
||||
@ -1273,6 +1274,10 @@ class Guild(Hashable):
|
||||
Must be one of ``60``, ``1440``, ``4320``, or ``10080``.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
default_thread_slowmode_delay: :class:`int`
|
||||
The default slowmode delay in seconds for threads created in the text channel.
|
||||
|
||||
.. versionadded:: 2.3
|
||||
reason: Optional[:class:`str`]
|
||||
The reason for creating this channel. Shows up on the audit log.
|
||||
|
||||
@ -1305,7 +1310,10 @@ class Guild(Hashable):
|
||||
options['nsfw'] = nsfw
|
||||
|
||||
if default_auto_archive_duration is not MISSING:
|
||||
options["default_auto_archive_duration"] = default_auto_archive_duration
|
||||
options['default_auto_archive_duration'] = default_auto_archive_duration
|
||||
|
||||
if default_thread_slowmode_delay is not MISSING:
|
||||
options['default_thread_rate_limit_per_user'] = default_thread_slowmode_delay
|
||||
|
||||
data = await self._create_channel(
|
||||
name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user