Skip to content

Commit 1159112

Browse files
committed
fix: Allow to archive forum posts
1 parent e45a645 commit 1159112

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

discord/channel.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ def get_member(self, id) -> Optional[ThreadMember]:
957957
""":class:`ThreadMember`: Returns the thread member with the given ID, or :obj:`None` if he is not a member of the thread."""
958958
return self._members.get(id, None)
959959

960-
def permissions_for(self, member) -> Permissions:
960+
def permissions_for(self, member: Member) -> Permissions:
961961
"""Handles permission resolution for the current :class:`~discord.Member`.
962962
963963
.. note::
@@ -1236,12 +1236,12 @@ async def edit(
12361236
----------
12371237
name: Optional[:class:`str`]
12381238
The channel name. Must be 1-100 characters long
1239-
archived: Optional[:class:`bool`]
1240-
Whether the thread is archived
12411239
auto_archive_duration: Optional[:class:`AutoArchiveDuration`]
12421240
Duration in minutes to automatically archive the thread after recent activity
1241+
archived: Optional[:class:`bool`]
1242+
Whether the thread is archived
12431243
locked: Optional[:class:`bool`]
1244-
Whether the thread is locked; when a thread is locked, only users with :attr:`Permissions.manage_threads` can unarchive it
1244+
Whether the thread is locked; when a thread is locked, only users with :attr:`Permissions.manage_threads` can unlock it
12451245
invitable: Optional[:class:`bool`]
12461246
Whether non-moderators can add other non-moderators to a thread; only available on private threads
12471247
slowmode_delay: :Optional[:class:`int`]
@@ -2319,6 +2319,7 @@ async def edit(
23192319
tags: Sequence[ForumTag] = MISSING,
23202320
pinned: bool = MISSING,
23212321
auto_archive_duration: AutoArchiveDuration = MISSING,
2322+
archived: bool = MISSING,
23222323
locked: bool = MISSING,
23232324
slowmode_delay: int = MISSING,
23242325
reason: Optional[str] = None
@@ -2345,7 +2346,9 @@ async def edit(
23452346
after ``auto_archive_duration`` minutes of inactivity.
23462347
locked: :class:`bool`
23472348
Whether the post is locked;
2348-
when a post is locked, only users with :func:~Permissions.manage_threads` permissions can unarchive it
2349+
when a post is locked, only users with :func:~Permissions.manage_threads` permissions can unlock it
2350+
archived: :class:`bool`
2351+
Whether the post is archived.
23492352
slowmode_delay: Optional[:class:`str`]
23502353
Amount of seconds a user has to wait before sending another message (0-21600);
23512354
bots, as well as users with the permission manage_messages, manage_thread, or manage_channel, are unaffected
@@ -2371,7 +2374,10 @@ async def edit(
23712374
raise InvalidArgument('%s is not a valid auto_archive_duration' % auto_archive_duration)
23722375
else:
23732376
payload['auto_archive_duration'] = auto_archive_duration.value
2374-
2377+
2378+
if archived is not MISSING:
2379+
payload['archived'] = archived
2380+
23752381
if locked is not MISSING:
23762382
payload['locked'] = locked
23772383

0 commit comments

Comments
 (0)