Skip to content

Commit e18099f

Browse files
SengoldaVincentRPSizxxrLulalabyDorukyum
authored
Add new Thread.archive (#518)
Co-authored-by: RPS <[email protected]> Co-authored-by: Izhar Ahmad <[email protected]> Co-authored-by: Lala Sabathil <[email protected]> Co-authored-by: Dorukyum <[email protected]>
1 parent 52fdbb1 commit e18099f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

discord/threads.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,36 @@ async def edit(
589589
data = await self._state.http.edit_channel(self.id, **payload)
590590
# The data payload will always be a Thread payload
591591
return Thread(data=data, state=self._state, guild=self.guild) # type: ignore
592+
593+
async def archive(self, locked: bool = MISSING) -> Thread:
594+
"""|coro|
595+
596+
Archives the thread. This is a shorthand of :meth:`.edit`.
597+
598+
Parameters
599+
------------
600+
locked: :class:`bool`
601+
Whether to lock the thread on archive, Defaults to ``False``.
602+
603+
604+
Returns
605+
--------
606+
:class:`.Thread`
607+
The updated thread.
608+
"""
609+
return await self.edit(archived=True, locked=locked)
610+
611+
async def unarchive(self) -> Thread:
612+
"""|coro|
613+
614+
Unarchives the thread. This is a shorthand of :meth:`.edit`.
615+
616+
Returns
617+
--------
618+
:class:`.Thread`
619+
The updated thread.
620+
"""
621+
return await self.edit(archived=False)
592622

593623
async def join(self):
594624
"""|coro|

0 commit comments

Comments
 (0)