Browse Source

Add reason kwarg to Thread.delete

pull/9556/merge
owocado 11 months ago
committed by GitHub
parent
commit
ef64f76eae
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      discord/threads.py

12
discord/threads.py

@ -846,13 +846,21 @@ class Thread(Messageable, Hashable):
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
@ -860,7 +868,7 @@ class Thread(Messageable, Hashable):
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.

Loading…
Cancel
Save