mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-11 04:17:58 +00:00
Add reason kwarg to Thread.delete
This commit is contained in:
parent
2e2f51fd5c
commit
ef64f76eae
@ -846,13 +846,21 @@ class Thread(Messageable, Hashable):
|
|||||||
members = await self._state.http.get_thread_members(self.id)
|
members = await self._state.http.get_thread_members(self.id)
|
||||||
return [ThreadMember(parent=self, data=data) for data in members]
|
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|
|
"""|coro|
|
||||||
|
|
||||||
Deletes this thread.
|
Deletes this thread.
|
||||||
|
|
||||||
You must have :attr:`~Permissions.manage_threads` to delete threads.
|
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
|
Raises
|
||||||
-------
|
-------
|
||||||
Forbidden
|
Forbidden
|
||||||
@ -860,7 +868,7 @@ class Thread(Messageable, Hashable):
|
|||||||
HTTPException
|
HTTPException
|
||||||
Deleting the thread failed.
|
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:
|
def get_partial_message(self, message_id: int, /) -> PartialMessage:
|
||||||
"""Creates a :class:`PartialMessage` from the message ID.
|
"""Creates a :class:`PartialMessage` from the message ID.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user