aboutsummaryrefslogtreecommitdiff
path: root/discord/http.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-18 02:09:50 -0400
committerRapptz <[email protected]>2016-06-18 02:14:44 -0400
commitb3edb31df5500e8e850450577e9541af07a9508b (patch)
treeb171f6c152a889d26395dc46ea66176780d4556c /discord/http.py
parentFix HTTPClient.recreate to actually work. (diff)
downloaddiscord.py-b3edb31df5500e8e850450577e9541af07a9508b.tar.xz
discord.py-b3edb31df5500e8e850450577e9541af07a9508b.zip
Add support for message pinning.
This includes `Client.pin_message`, `Client.unpin_message` and `Client.pins_from`. This also adds the `Message.pinned` attribute to the `Message` object.
Diffstat (limited to 'discord/http.py')
-rw-r--r--discord/http.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/discord/http.py b/discord/http.py
index ba531a91..d7e90b88 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -278,6 +278,18 @@ class HTTPClient:
return self.get(url, params=params, bucket=_func_())
+ def pin_message(self, channel_id, message_id):
+ url = '{0.CHANNELS}/{1}/pins/{2}'.format(self, channel_id, message_id)
+ return self.put(url, bucket=_func_())
+
+ def unpin_message(self, channel_id, message_id):
+ url = '{0.CHANNELS}/{1}/pins/{2}'.format(self, channel_id, message_id)
+ return self.delete(url, bucket=_func_())
+
+ def pins_from(self, channel_id):
+ url = '{0.CHANNELS}/{1}/pins'.format(self, channel_id)
+ return self.get(url, bucket=_func_())
+
# Member management
def kick(self, user_id, guild_id):