Skip to content

Commit a7d46af

Browse files
committed
feat: make change after write enum.IntEnum
1 parent 1424acf commit a7d46af

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

discord/channel.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,6 @@ async def create_thread(
13331333
raise InvalidArgument("file parameter must be File")
13341334
files = [file]
13351335

1336-
if auto_archive_duration is not None and isinstance(
1337-
auto_archive_duration, ThreadAutoArchiveDuration
1338-
):
1339-
auto_archive_duration = auto_archive_duration.value
1340-
13411336
try:
13421337
data = await state.http.start_forum_thread(
13431338
self.id,

discord/enums.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
from __future__ import annotations
2727

28+
import enum
2829
import types
2930
from collections import namedtuple
3031
from typing import TYPE_CHECKING, Any, ClassVar, TypeVar, Union
@@ -1079,7 +1080,7 @@ class SubscriptionStatus(Enum):
10791080
inactive = 2
10801081

10811082

1082-
class ThreadAutoArchiveDuration(Enum):
1083+
class ThreadAutoArchiveDuration(enum.IntEnum):
10831084
"""Time set before the thread is auto archived"""
10841085

10851086
one_hour = 60

discord/threads.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,7 @@ async def edit(
665665
if archived is not MISSING:
666666
payload["archived"] = archived
667667
if auto_archive_duration is not MISSING:
668-
payload["auto_archive_duration"] = (
669-
auto_archive_duration.value
670-
if isinstance(auto_archive_duration, ThreadAutoArchiveDuration)
671-
else auto_archive_duration
672-
)
668+
payload["auto_archive_duration"] = auto_archive_duration
673669
if locked is not MISSING:
674670
payload["locked"] = locked
675671
if invitable is not MISSING:

0 commit comments

Comments
 (0)