From 3679443b6673ee72f3e4087cbdf3ed2e46f485c0 Mon Sep 17 00:00:00 2001 From: BOXER Date: Tue, 8 Jul 2025 15:30:14 +0200 Subject: [PATCH 01/13] feat: add ThreadAutoArchiveDuration enum Add an enumeration ThreadAutoArchiveDuration to get time before the thread was archived. The selected enumeration value is automatically retrieved. You can always set the archiving time as a number without using this enumeration. --- CHANGELOG.md | 2 ++ discord/channel.py | 13 ++++++++++++- discord/enums.py | 10 ++++++++++ discord/threads.py | 9 ++++++--- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdfdc6d896..a0a082064b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2747](https://github.com/Pycord-Development/pycord/pull/2747)) - Added `discord.Interaction.created_at`. ([#2801](https://github.com/Pycord-Development/pycord/pull/2801)) +- Added `ThreadAutoArchiveDuration` enum to get thread archive duration more efficiently. + ([#2826](https://github.com/Pycord-Development/pycord/pull/2826)) ### Fixed diff --git a/discord/channel.py b/discord/channel.py index be6c68b38a..ee52b1e2e8 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -41,6 +41,7 @@ StagePrivacyLevel, VideoQualityMode, VoiceRegion, + ThreadAutoArchiveDuration, try_enum, ) from .errors import ClientException, InvalidArgument @@ -1084,7 +1085,7 @@ async def edit( sync_permissions: bool = ..., category: CategoryChannel | None = ..., slowmode_delay: int = ..., - default_auto_archive_duration: ThreadArchiveDuration = ..., + default_auto_archive_duration: ThreadArchiveDuration | ThreadAutoArchiveDuration = ..., default_thread_slowmode_delay: int = ..., default_sort_order: SortOrder = ..., default_reaction_emoji: GuildEmoji | int | str | None = ..., @@ -1130,6 +1131,7 @@ async def edit(self, *, reason=None, **options): 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``. + **ThreadAutoArchiveDuration** enum can be used for better understanding. default_thread_slowmode_delay: :class:`int` The new default slowmode delay in seconds for threads created in this channel. @@ -1173,6 +1175,12 @@ async def edit(self, *, reason=None, **options): options["flags"] = ChannelFlags._from_value(self.flags.value) options["flags"].require_tag = options.pop("require_tag") + if "default_auto_archive_duration" in options: + default_auto_archive_duration = options["default_auto_archive_duration"] + options["default_auto_archive_duration"] = default_auto_archive_duration \ + if isinstance(default_auto_archive_duration, (int, float)) \ + else default_auto_archive_duration.value + payload = await self._edit(options, reason=reason) if payload is not None: # the payload will always be the proper channel payload @@ -1321,6 +1329,9 @@ async def create_thread( raise InvalidArgument("file parameter must be File") files = [file] + if auto_archive_duration is not None and isinstance(auto_archive_duration, ThreadAutoArchiveDuration): + auto_archive_duration = auto_archive_duration.value + try: data = await state.http.start_forum_thread( self.id, diff --git a/discord/enums.py b/discord/enums.py index 01d10275c8..f6204b7bfa 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -78,6 +78,7 @@ "InteractionContextType", "PollLayoutType", "MessageReferenceType", + "ThreadAutoArchiveDuration" ) @@ -1078,6 +1079,15 @@ class SubscriptionStatus(Enum): inactive = 2 +class ThreadAutoArchiveDuration(Enum): + """Time set before the thread is auto archived""" + + one_hour = 60 + one_day = 1440 + three_days = 4320 + one_week = 10080 + + T = TypeVar("T") diff --git a/discord/threads.py b/discord/threads.py index 0e1675a1bd..b406311a59 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -28,7 +28,7 @@ from typing import TYPE_CHECKING, Callable, Iterable from .abc import Messageable, _purge_messages_helper -from .enums import ChannelType, try_enum +from .enums import ChannelType, try_enum, ThreadAutoArchiveDuration from .errors import ClientException from .flags import ChannelFlags from .mixins import Hashable @@ -602,7 +602,7 @@ async def edit( locked: bool = MISSING, invitable: bool = MISSING, slowmode_delay: int = MISSING, - auto_archive_duration: ThreadArchiveDuration = MISSING, + auto_archive_duration: ThreadAutoArchiveDuration | ThreadArchiveDuration = MISSING, pinned: bool = MISSING, applied_tags: list[ForumTag] = MISSING, reason: str | None = None, @@ -632,6 +632,7 @@ async def edit( 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``. + **ThreadAutoArchiveDuration** enum can be used for better understanding. slowmode_delay: :class:`int` Specifies the slowmode rate limit for user in this thread, in seconds. A value of ``0`` disables slowmode. The maximum value possible is ``21600``. @@ -662,7 +663,9 @@ async def edit( if archived is not MISSING: payload["archived"] = archived if auto_archive_duration is not MISSING: - payload["auto_archive_duration"] = auto_archive_duration + payload["auto_archive_duration"] = auto_archive_duration.value \ + if isinstance(auto_archive_duration, ThreadAutoArchiveDuration) \ + else auto_archive_duration if locked is not MISSING: payload["locked"] = locked if invitable is not MISSING: From 1424acffded379426318af7c206d22926823cfa5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 13:33:25 +0000 Subject: [PATCH 02/13] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 4 ++-- discord/channel.py | 16 +++++++++++----- discord/enums.py | 2 +- discord/threads.py | 12 ++++++++---- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0a082064b..d777d960e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,8 +57,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2747](https://github.com/Pycord-Development/pycord/pull/2747)) - Added `discord.Interaction.created_at`. ([#2801](https://github.com/Pycord-Development/pycord/pull/2801)) -- Added `ThreadAutoArchiveDuration` enum to get thread archive duration more efficiently. - ([#2826](https://github.com/Pycord-Development/pycord/pull/2826)) +- Added `ThreadAutoArchiveDuration` enum to get thread archive duration more + efficiently. ([#2826](https://github.com/Pycord-Development/pycord/pull/2826)) ### Fixed diff --git a/discord/channel.py b/discord/channel.py index ee52b1e2e8..9f4b81c245 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -39,9 +39,9 @@ InviteTarget, SortOrder, StagePrivacyLevel, + ThreadAutoArchiveDuration, VideoQualityMode, VoiceRegion, - ThreadAutoArchiveDuration, try_enum, ) from .errors import ClientException, InvalidArgument @@ -1085,7 +1085,9 @@ async def edit( sync_permissions: bool = ..., category: CategoryChannel | None = ..., slowmode_delay: int = ..., - default_auto_archive_duration: ThreadArchiveDuration | ThreadAutoArchiveDuration = ..., + default_auto_archive_duration: ( + ThreadArchiveDuration | ThreadAutoArchiveDuration + ) = ..., default_thread_slowmode_delay: int = ..., default_sort_order: SortOrder = ..., default_reaction_emoji: GuildEmoji | int | str | None = ..., @@ -1177,9 +1179,11 @@ async def edit(self, *, reason=None, **options): if "default_auto_archive_duration" in options: default_auto_archive_duration = options["default_auto_archive_duration"] - options["default_auto_archive_duration"] = default_auto_archive_duration \ - if isinstance(default_auto_archive_duration, (int, float)) \ + options["default_auto_archive_duration"] = ( + default_auto_archive_duration + if isinstance(default_auto_archive_duration, (int, float)) else default_auto_archive_duration.value + ) payload = await self._edit(options, reason=reason) if payload is not None: @@ -1329,7 +1333,9 @@ async def create_thread( raise InvalidArgument("file parameter must be File") files = [file] - if auto_archive_duration is not None and isinstance(auto_archive_duration, ThreadAutoArchiveDuration): + if auto_archive_duration is not None and isinstance( + auto_archive_duration, ThreadAutoArchiveDuration + ): auto_archive_duration = auto_archive_duration.value try: diff --git a/discord/enums.py b/discord/enums.py index f6204b7bfa..d62023ee7e 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -78,7 +78,7 @@ "InteractionContextType", "PollLayoutType", "MessageReferenceType", - "ThreadAutoArchiveDuration" + "ThreadAutoArchiveDuration", ) diff --git a/discord/threads.py b/discord/threads.py index b406311a59..812f0b09e0 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -28,7 +28,7 @@ from typing import TYPE_CHECKING, Callable, Iterable from .abc import Messageable, _purge_messages_helper -from .enums import ChannelType, try_enum, ThreadAutoArchiveDuration +from .enums import ChannelType, ThreadAutoArchiveDuration, try_enum from .errors import ClientException from .flags import ChannelFlags from .mixins import Hashable @@ -602,7 +602,9 @@ async def edit( locked: bool = MISSING, invitable: bool = MISSING, slowmode_delay: int = MISSING, - auto_archive_duration: ThreadAutoArchiveDuration | ThreadArchiveDuration = MISSING, + auto_archive_duration: ( + ThreadAutoArchiveDuration | ThreadArchiveDuration + ) = MISSING, pinned: bool = MISSING, applied_tags: list[ForumTag] = MISSING, reason: str | None = None, @@ -663,9 +665,11 @@ async def edit( if archived is not MISSING: payload["archived"] = archived if auto_archive_duration is not MISSING: - payload["auto_archive_duration"] = auto_archive_duration.value \ - if isinstance(auto_archive_duration, ThreadAutoArchiveDuration) \ + payload["auto_archive_duration"] = ( + auto_archive_duration.value + if isinstance(auto_archive_duration, ThreadAutoArchiveDuration) else auto_archive_duration + ) if locked is not MISSING: payload["locked"] = locked if invitable is not MISSING: From a7d46aff7e92a298cffee6095c55807c4760a627 Mon Sep 17 00:00:00 2001 From: BOXER Date: Tue, 8 Jul 2025 17:24:42 +0200 Subject: [PATCH 03/13] feat: make change after write enum.IntEnum --- discord/channel.py | 5 ----- discord/enums.py | 3 ++- discord/threads.py | 6 +----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/discord/channel.py b/discord/channel.py index 9f4b81c245..c3b8ddd278 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -1333,11 +1333,6 @@ async def create_thread( raise InvalidArgument("file parameter must be File") files = [file] - if auto_archive_duration is not None and isinstance( - auto_archive_duration, ThreadAutoArchiveDuration - ): - auto_archive_duration = auto_archive_duration.value - try: data = await state.http.start_forum_thread( self.id, diff --git a/discord/enums.py b/discord/enums.py index d62023ee7e..ab32c086c2 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -25,6 +25,7 @@ from __future__ import annotations +import enum import types from collections import namedtuple from typing import TYPE_CHECKING, Any, ClassVar, TypeVar, Union @@ -1079,7 +1080,7 @@ class SubscriptionStatus(Enum): inactive = 2 -class ThreadAutoArchiveDuration(Enum): +class ThreadAutoArchiveDuration(enum.IntEnum): """Time set before the thread is auto archived""" one_hour = 60 diff --git a/discord/threads.py b/discord/threads.py index 812f0b09e0..757cd1c567 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -665,11 +665,7 @@ async def edit( if archived is not MISSING: payload["archived"] = archived if auto_archive_duration is not MISSING: - payload["auto_archive_duration"] = ( - auto_archive_duration.value - if isinstance(auto_archive_duration, ThreadAutoArchiveDuration) - else auto_archive_duration - ) + payload["auto_archive_duration"] = auto_archive_duration if locked is not MISSING: payload["locked"] = locked if invitable is not MISSING: From 374763364b0694edc1dfafd9d7cdc192bc403dd6 Mon Sep 17 00:00:00 2001 From: BOXER Date: Tue, 8 Jul 2025 17:46:18 +0200 Subject: [PATCH 04/13] feat: make change after speak on github --- discord/channel.py | 12 ++---------- discord/enums.py | 4 ++-- discord/threads.py | 5 +++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/discord/channel.py b/discord/channel.py index c3b8ddd278..549f2775a4 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -39,11 +39,11 @@ InviteTarget, SortOrder, StagePrivacyLevel, - ThreadAutoArchiveDuration, VideoQualityMode, VoiceRegion, try_enum, ) +from .enums import ThreadArchiveDuration as ThreadAutoArchiveDuration from .errors import ClientException, InvalidArgument from .file import File from .flags import ChannelFlags @@ -1133,7 +1133,7 @@ async def edit(self, *, reason=None, **options): 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``. - **ThreadAutoArchiveDuration** enum can be used for better understanding. + :class:`ThreadAutoArchiveDuration` can be used alternatively. default_thread_slowmode_delay: :class:`int` The new default slowmode delay in seconds for threads created in this channel. @@ -1177,14 +1177,6 @@ async def edit(self, *, reason=None, **options): options["flags"] = ChannelFlags._from_value(self.flags.value) options["flags"].require_tag = options.pop("require_tag") - if "default_auto_archive_duration" in options: - default_auto_archive_duration = options["default_auto_archive_duration"] - options["default_auto_archive_duration"] = ( - default_auto_archive_duration - if isinstance(default_auto_archive_duration, (int, float)) - else default_auto_archive_duration.value - ) - payload = await self._edit(options, reason=reason) if payload is not None: # the payload will always be the proper channel payload diff --git a/discord/enums.py b/discord/enums.py index ab32c086c2..b9661c13a2 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -79,7 +79,7 @@ "InteractionContextType", "PollLayoutType", "MessageReferenceType", - "ThreadAutoArchiveDuration", + "ThreadArchiveDuration", ) @@ -1080,7 +1080,7 @@ class SubscriptionStatus(Enum): inactive = 2 -class ThreadAutoArchiveDuration(enum.IntEnum): +class ThreadArchiveDuration(enum.IntEnum): """Time set before the thread is auto archived""" one_hour = 60 diff --git a/discord/threads.py b/discord/threads.py index 757cd1c567..7980e0ab61 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -28,7 +28,8 @@ from typing import TYPE_CHECKING, Callable, Iterable from .abc import Messageable, _purge_messages_helper -from .enums import ChannelType, ThreadAutoArchiveDuration, try_enum +from .enums import ChannelType, try_enum +from .enums import ThreadArchiveDuration as ThreadAutoArchiveDuration from .errors import ClientException from .flags import ChannelFlags from .mixins import Hashable @@ -634,7 +635,7 @@ async def edit( 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``. - **ThreadAutoArchiveDuration** enum can be used for better understanding. + :class:`ThreadAutoArchiveDuration` can be used alternatively. slowmode_delay: :class:`int` Specifies the slowmode rate limit for user in this thread, in seconds. A value of ``0`` disables slowmode. The maximum value possible is ``21600``. From bd5c40480b526fe0f346d88da16983eeb10dd3cb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 15:46:49 +0000 Subject: [PATCH 05/13] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/channel.py | 4 +++- discord/threads.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/discord/channel.py b/discord/channel.py index 549f2775a4..1b1fae8bc7 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -39,11 +39,13 @@ InviteTarget, SortOrder, StagePrivacyLevel, +) +from .enums import ThreadArchiveDuration as ThreadAutoArchiveDuration +from .enums import ( VideoQualityMode, VoiceRegion, try_enum, ) -from .enums import ThreadArchiveDuration as ThreadAutoArchiveDuration from .errors import ClientException, InvalidArgument from .file import File from .flags import ChannelFlags diff --git a/discord/threads.py b/discord/threads.py index 7980e0ab61..16aa73e868 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -28,8 +28,9 @@ from typing import TYPE_CHECKING, Callable, Iterable from .abc import Messageable, _purge_messages_helper -from .enums import ChannelType, try_enum +from .enums import ChannelType from .enums import ThreadArchiveDuration as ThreadAutoArchiveDuration +from .enums import try_enum from .errors import ClientException from .flags import ChannelFlags from .mixins import Hashable From be7b9bf9c41a4a41aa0151b7d29070c772a8d62f Mon Sep 17 00:00:00 2001 From: BOXER Date: Tue, 8 Jul 2025 18:10:47 +0200 Subject: [PATCH 06/13] feat: Apply changes and add doc --- discord/channel.py | 4 ++-- discord/enums.py | 4 ++-- discord/threads.py | 4 ++-- docs/api/enums.rst | 23 +++++++++++++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/discord/channel.py b/discord/channel.py index 1b1fae8bc7..449e0b30b6 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -40,7 +40,7 @@ SortOrder, StagePrivacyLevel, ) -from .enums import ThreadArchiveDuration as ThreadAutoArchiveDuration +from .enums import ThreadArchiveDuration as ThreadArchiveDurationEnum from .enums import ( VideoQualityMode, VoiceRegion, @@ -1088,7 +1088,7 @@ async def edit( category: CategoryChannel | None = ..., slowmode_delay: int = ..., default_auto_archive_duration: ( - ThreadArchiveDuration | ThreadAutoArchiveDuration + ThreadArchiveDuration | ThreadArchiveDurationEnum ) = ..., default_thread_slowmode_delay: int = ..., default_sort_order: SortOrder = ..., diff --git a/discord/enums.py b/discord/enums.py index b9661c13a2..8650d233f9 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -25,7 +25,7 @@ from __future__ import annotations -import enum +from enum import IntEnum import types from collections import namedtuple from typing import TYPE_CHECKING, Any, ClassVar, TypeVar, Union @@ -1080,7 +1080,7 @@ class SubscriptionStatus(Enum): inactive = 2 -class ThreadArchiveDuration(enum.IntEnum): +class ThreadArchiveDuration(IntEnum): """Time set before the thread is auto archived""" one_hour = 60 diff --git a/discord/threads.py b/discord/threads.py index 16aa73e868..420591ba4f 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -29,7 +29,7 @@ from .abc import Messageable, _purge_messages_helper from .enums import ChannelType -from .enums import ThreadArchiveDuration as ThreadAutoArchiveDuration +from .enums import ThreadArchiveDuration as ThreadArchiveDurationEnum from .enums import try_enum from .errors import ClientException from .flags import ChannelFlags @@ -605,7 +605,7 @@ async def edit( invitable: bool = MISSING, slowmode_delay: int = MISSING, auto_archive_duration: ( - ThreadAutoArchiveDuration | ThreadArchiveDuration + ThreadArchiveDurationEnum | ThreadArchiveDuration ) = MISSING, pinned: bool = MISSING, applied_tags: list[ForumTag] = MISSING, diff --git a/docs/api/enums.rst b/docs/api/enums.rst index 4d278e3758..32005e5430 100644 --- a/docs/api/enums.rst +++ b/docs/api/enums.rst @@ -2519,3 +2519,26 @@ of :class:`enum.Enum`. .. attribute:: inactive The subscription is inactive and the subscription owner is not being charged. + + +.. class:: ThreadArchiveDuration + + Represents times before a thread is archived. + + .. versionadded:: 2.7 + + .. attribute:: one_hour + + Indicates that the thread will be archived after 1 hour of inactivity. + + .. attribute:: one_day + + Indicates that the thread will be archived after 1 day of inactivity. + + .. attribute:: three_days + + Indicates that the thread will be archived after 3 days of inactivity. + + .. attribute:: one_week + + Indicates that the thread will be archived after 1 week of inactivity. From a24912a1078037b39a37d7971103226c66a78844 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 16:11:19 +0000 Subject: [PATCH 07/13] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/enums.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/enums.py b/discord/enums.py index 8650d233f9..9ea441b602 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -25,9 +25,9 @@ from __future__ import annotations -from enum import IntEnum import types from collections import namedtuple +from enum import IntEnum from typing import TYPE_CHECKING, Any, ClassVar, TypeVar, Union __all__ = ( From 4593a84140ba44fb8b79aaf60c835e3f845f94ea Mon Sep 17 00:00:00 2001 From: BOXER <130167557+BOXERRMD@users.noreply.github.com> Date: Tue, 8 Jul 2025 18:12:50 +0200 Subject: [PATCH 08/13] Update CHANGELOG.md Co-authored-by: Paillat Signed-off-by: BOXER <130167557+BOXERRMD@users.noreply.github.com> --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d777d960e6..7d415d6ff9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,8 +57,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2747](https://github.com/Pycord-Development/pycord/pull/2747)) - Added `discord.Interaction.created_at`. ([#2801](https://github.com/Pycord-Development/pycord/pull/2801)) -- Added `ThreadAutoArchiveDuration` enum to get thread archive duration more - efficiently. ([#2826](https://github.com/Pycord-Development/pycord/pull/2826)) +- Added `ThreadAutoArchiveDuration` enum to improve clarity of thread archive durations. + ([#2826](https://github.com/Pycord-Development/pycord/pull/2826)) ### Fixed From 595aaebf0455828331f2b346c9a8145e87c722e8 Mon Sep 17 00:00:00 2001 From: BOXER <130167557+BOXERRMD@users.noreply.github.com> Date: Tue, 8 Jul 2025 18:13:33 +0200 Subject: [PATCH 09/13] Update docs/api/enums.rst Co-authored-by: Paillat Signed-off-by: BOXER <130167557+BOXERRMD@users.noreply.github.com> --- docs/api/enums.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/enums.rst b/docs/api/enums.rst index 32005e5430..8e3bab2272 100644 --- a/docs/api/enums.rst +++ b/docs/api/enums.rst @@ -2523,7 +2523,7 @@ of :class:`enum.Enum`. .. class:: ThreadArchiveDuration - Represents times before a thread is archived. + Represents the time before a thread is archived. .. versionadded:: 2.7 From fecbf5428b7e344889f62db1b899bb21d783bf9e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 2 Aug 2025 11:25:58 +0000 Subject: [PATCH 10/13] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/enums.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/enums.py b/discord/enums.py index 8ba0e77cef..a601802d16 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -1098,7 +1098,7 @@ class ThreadArchiveDuration(IntEnum): three_days = 4320 one_week = 10080 - + class SeparatorSpacingSize(Enum): """A separator component's spacing size.""" From 614560561952c578d50d0d3cddc7a67002cd17b9 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Sun, 3 Aug 2025 10:50:40 +0200 Subject: [PATCH 11/13] Update discord/threads.py Co-authored-by: plun1331 Signed-off-by: Lala Sabathil --- discord/threads.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/discord/threads.py b/discord/threads.py index 420591ba4f..2b9555736c 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -28,9 +28,11 @@ from typing import TYPE_CHECKING, Callable, Iterable from .abc import Messageable, _purge_messages_helper -from .enums import ChannelType -from .enums import ThreadArchiveDuration as ThreadArchiveDurationEnum -from .enums import try_enum +from .enums import ( + ChannelType, + ThreadArchiveDuration as ThreadArchiveDurationEnum, + try_enum, +) from .errors import ClientException from .flags import ChannelFlags from .mixins import Hashable From ed8dce16289ca66247104ca4de6821ff07039638 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Sun, 3 Aug 2025 10:51:11 +0200 Subject: [PATCH 12/13] Update discord/channel.py Co-authored-by: plun1331 Signed-off-by: Lala Sabathil --- discord/channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/channel.py b/discord/channel.py index 52269d757a..1e12833b9b 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -49,8 +49,8 @@ SortOrder, StagePrivacyLevel, ) -from .enums import ThreadArchiveDuration as ThreadArchiveDurationEnum from .enums import ( + ThreadArchiveDuration as ThreadArchiveDurationEnum, VideoQualityMode, VoiceRegion, try_enum, From ad8844558afa90c098bacdd77e0fa997c1558b6b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 3 Aug 2025 08:52:30 +0000 Subject: [PATCH 13/13] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/channel.py | 2 +- discord/threads.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/discord/channel.py b/discord/channel.py index 1e12833b9b..52269d757a 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -49,8 +49,8 @@ SortOrder, StagePrivacyLevel, ) +from .enums import ThreadArchiveDuration as ThreadArchiveDurationEnum from .enums import ( - ThreadArchiveDuration as ThreadArchiveDurationEnum, VideoQualityMode, VoiceRegion, try_enum, diff --git a/discord/threads.py b/discord/threads.py index 2b9555736c..33414806b7 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -30,7 +30,9 @@ from .abc import Messageable, _purge_messages_helper from .enums import ( ChannelType, - ThreadArchiveDuration as ThreadArchiveDurationEnum, +) +from .enums import ThreadArchiveDuration as ThreadArchiveDurationEnum +from .enums import ( try_enum, ) from .errors import ClientException