Skip to content

Commit

Permalink
Add reason kwarg to Thread.delete
Browse files Browse the repository at this point in the history
  • Loading branch information
owocado committed May 5, 2024
1 parent 2e2f51f commit ef64f76
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions discord/threads.py
Expand Up @@ -846,21 +846,29 @@ async def fetch_members(self) -> List[ThreadMember]:
members = await self._state.http.get_thread_members(self.id)
return [ThreadMember(parent=self, data=data) for data in members]

async def delete(self) -> None:
async def delete(self, *, reason: Optional[str] = None) -> None:
"""|coro|
Deletes this thread.
You must have :attr:`~Permissions.manage_threads` to delete threads.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this thread.
Shows up on the audit log.
.. versionadded:: 2.4
Raises
-------
Forbidden
You do not have permissions to delete this thread.
HTTPException
Deleting the thread failed.
"""
await self._state.http.delete_channel(self.id)
await self._state.http.delete_channel(self.id, reason=reason)

def get_partial_message(self, message_id: int, /) -> PartialMessage:
"""Creates a :class:`PartialMessage` from the message ID.
Expand Down

0 comments on commit ef64f76

Please sign in to comment.