aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/state.py5
-rw-r--r--docs/api.rst8
2 files changed, 13 insertions, 0 deletions
diff --git a/discord/state.py b/discord/state.py
index 543e8a63..37ccd922 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -390,6 +390,11 @@ class ConnectionState:
self.dispatch('channel_create', channel)
+ def parse_channel_pins_update(self, data):
+ channel = self.get_channel(int(data['channel_id']))
+ last_pin = utils.parse_time(data['last_pin_timestamp']) if data['last_pin_timestamp'] else None
+ self.dispatch('channel_pins_update', channel, last_pin)
+
def parse_channel_recipient_add(self, data):
channel = self._get_private_channel(int(data['channel_id']))
user = self.store_user(data['user'])
diff --git a/docs/api.rst b/docs/api.rst
index e001d8bb..c3f6aabc 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -263,6 +263,14 @@ to handle it, which defaults to print a traceback and ignore the exception.
:param before: The :class:`Channel` that got updated with the old info.
:param after: The :class:`Channel` that got updated with the updated info.
+.. function:: on_channel_pins_update(channel, last_pin)
+
+ Called whenever a message is pinned or unpinned from a channel.
+
+ :param channel: The :class:`Channel` that had it's pins updated.
+ :param last_pin: A ``datetime.datetime`` object representing when the latest message
+ was pinned or ``None`` if there are no pins.
+
.. function:: on_member_join(member)
on_member_remove(member)