aboutsummaryrefslogtreecommitdiff
path: root/discord/message.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/message.py')
-rw-r--r--discord/message.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/discord/message.py b/discord/message.py
index f6565ba1..5b4d79cb 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -856,7 +856,7 @@ class Message:
await self._state.http.publish_message(self.channel.id, self.id)
- async def pin(self):
+ async def pin(self, *, reason=None):
"""|coro|
Pins the message.
@@ -864,6 +864,13 @@ class Message:
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
+ Parameters
+ -----------
+ reason: Optional[:class:`str`]
+ The reason for pinning the message. Shows up on the audit log.
+
+ .. versionadded:: 1.4
+
Raises
-------
Forbidden
@@ -875,10 +882,10 @@ class Message:
having more than 50 pinned messages.
"""
- await self._state.http.pin_message(self.channel.id, self.id)
+ await self._state.http.pin_message(self.channel.id, self.id, reason=reason)
self.pinned = True
- async def unpin(self):
+ async def unpin(self, *, reason=None):
"""|coro|
Unpins the message.
@@ -886,6 +893,13 @@ class Message:
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
+ Parameters
+ -----------
+ reason: Optional[:class:`str`]
+ The reason for pinning the message. Shows up on the audit log.
+
+ .. versionadded:: 1.4
+
Raises
-------
Forbidden
@@ -896,7 +910,7 @@ class Message:
Unpinning the message failed.
"""
- await self._state.http.unpin_message(self.channel.id, self.id)
+ await self._state.http.unpin_message(self.channel.id, self.id, reason=reason)
self.pinned = False
async def add_reaction(self, emoji):