From dff6bcc7457febf7bb1d797bd777e728f623e938 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 7 May 2017 03:08:06 -0400 Subject: Add support for audit log reasons. Most routes now have a 'reason' keyword argument. --- discord/message.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'discord/message.py') diff --git a/discord/message.py b/discord/message.py index 08122fef..39d573ed 100644 --- a/discord/message.py +++ b/discord/message.py @@ -407,7 +407,7 @@ class Message: return '{0.author.name} started a call \N{EM DASH} Join the call.'.format(self) @asyncio.coroutine - def delete(self): + def delete(self, *, reason=None): """|coro| Deletes the message. @@ -416,6 +416,11 @@ class Message: delete other people's messages, you need the :attr:`Permissions.manage_messages` permission. + Parameters + ------------ + reason: Optional[str] + The reason for deleting this message. Shows up on the audit log. + Raises ------ Forbidden @@ -423,7 +428,7 @@ class Message: HTTPException Deleting the message failed. """ - yield from self._state.http.delete_message(self.channel.id, self.id) + yield from self._state.http.delete_message(self.channel.id, self.id, reason=reason) @asyncio.coroutine def edit(self, **fields): -- cgit v1.2.3