@@ -284,11 +284,17 @@ async def modify(
284284 permission_overwrites : Optional [List [Overwrite ]] = MISSING ,
285285 parent_id : Optional [int ] = MISSING ,
286286 nsfw : Optional [bool ] = MISSING ,
287+ archived : Optional [bool ] = MISSING ,
288+ auto_archive_duration : Optional [int ] = MISSING ,
289+ locked : Optional [bool ] = MISSING ,
287290 reason : Optional [str ] = None ,
288291 ) -> "Channel" :
289292 """
290293 Edits the channel.
291294
295+ .. note::
296+ The fields `archived`, `auto_archive_duration` and `locked` require the provided channel to be a thread.
297+
292298 :param name?: The name of the channel, defaults to the current value of the channel
293299 :type name: str
294300 :param topic?: The topic of that channel, defaults to the current value of the channel
@@ -307,6 +313,12 @@ async def modify(
307313 :type nsfw: Optional[bool]
308314 :param permission_overwrites?: The permission overwrites, if any
309315 :type permission_overwrites: Optional[List[Overwrite]]
316+ :param archived?: Whether the thread is archived
317+ :type archived: Optional[bool]
318+ :param auto_archive_duration?: The time after the thread is automatically archived. One of 60, 1440, 4320, 10080
319+ :type auto_archive_duration: Optional[int]
320+ :param locked?: Whether the thread is locked
321+ :type locked: Optional[bool]
310322 :param reason?: The reason for the edit
311323 :type reason: Optional[str]
312324 :return: The modified channel as new object
@@ -343,10 +355,25 @@ async def modify(
343355 nsfw = _nsfw ,
344356 permission_overwrites = _permission_overwrites ,
345357 )
358+
359+ payload = payload ._json
360+
361+ if (
362+ archived is not MISSING or auto_archive_duration is not MISSING or locked is not MISSING
363+ ) and not self .thread_metadata :
364+ raise ValueError ("The specified channel is not a Thread!" )
365+
366+ if archived is not MISSING :
367+ payload ["archived" ] = archived
368+ if auto_archive_duration is not MISSING :
369+ payload ["auto_archive_duration" ] = auto_archive_duration
370+ if locked is not MISSING :
371+ payload ["locked" ] = locked
372+
346373 res = await self ._client .modify_channel (
347374 channel_id = int (self .id ),
348375 reason = reason ,
349- payload = payload . _json ,
376+ payload = payload ,
350377 )
351378 return Channel (** res , _client = self ._client )
352379
@@ -508,6 +535,63 @@ async def set_nsfw(
508535
509536 return await self .modify (nsfw = nsfw , reason = reason )
510537
538+ async def archive (
539+ self ,
540+ archived : bool = True ,
541+ * ,
542+ reason : Optional [str ] = None ,
543+ ) -> "Channel" :
544+ """
545+ Sets the archived state of the thread.
546+
547+ :param archived: Whether the Thread is archived, defaults to True
548+ :type archived: bool
549+ :param reason?: The reason of the archiving
550+ :type reason: Optional[str]
551+ :return: The edited channel
552+ :rtype: Channel
553+ """
554+
555+ return await self .modify (archived = archived , reason = reason )
556+
557+ async def set_auto_archive_duration (
558+ self ,
559+ auto_archive_duration : int ,
560+ * ,
561+ reason : Optional [str ] = None ,
562+ ) -> "Channel" :
563+ """
564+ Sets the time after the thread is automatically archived.
565+
566+ :param auto_archive_duration: The time after the thread is automatically archived. One of 60, 1440, 4320, 10080
567+ :type auto_archive_duration: int
568+ :param reason?: The reason of the edit
569+ :type reason: Optional[str]
570+ :return: The edited channel
571+ :rtype: Channel
572+ """
573+
574+ return await self .modify (auto_archive_duration = auto_archive_duration , reason = reason )
575+
576+ async def lock (
577+ self ,
578+ locked : bool = True ,
579+ * ,
580+ reason : Optional [str ] = None ,
581+ ) -> "Channel" :
582+ """
583+ Sets the locked state of the thread.
584+
585+ :param locked: Whether the Thread is locked, defaults to True
586+ :type locked: bool
587+ :param reason?: The reason of the edit
588+ :type reason: Optional[str]
589+ :return: The edited channel
590+ :rtype: Channel
591+ """
592+
593+ return await self .modify (locked = locked , reason = reason )
594+
511595 async def add_member (
512596 self ,
513597 member_id : int ,
0 commit comments