From b3edb31df5500e8e850450577e9541af07a9508b Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 18 Jun 2016 02:09:50 -0400 Subject: 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. --- discord/http.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'discord/http.py') 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): -- cgit v1.2.3