aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraftSpider <[email protected]>2019-02-15 10:41:13 -0500
committerRapptz <[email protected]>2019-02-18 03:47:56 -0500
commite920fe9a56bf6dccb79d9c6cbd9bc6b2054a21a5 (patch)
tree7affc8ab1ab9a05f39a0d915895d83089d47c371
parentManually calculate millisceond epoch rather than bitshifting (diff)
downloaddiscord.py-e920fe9a56bf6dccb79d9c6cbd9bc6b2054a21a5.tar.xz
discord.py-e920fe9a56bf6dccb79d9c6cbd9bc6b2054a21a5.zip
Add guild_integrations_update event
-rw-r--r--discord/state.py7
-rw-r--r--docs/api.rst6
2 files changed, 13 insertions, 0 deletions
diff --git a/discord/state.py b/discord/state.py
index 158d4039..36e33f57 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -790,6 +790,13 @@ class ConnectionState:
log.info('Processed a chunk for %s members in guild ID %s.', len(members), guild_id)
self.process_listeners(ListenerType.chunk, guild, len(members))
+ def parse_guild_integrations_update(self, data):
+ guild = self._get_guild(int(data['guild_id']))
+ if guild is not None:
+ self.dispatch('guild_integrations_update', guild)
+ else:
+ log.warning('GUILD_INTEGRATIONS_UPDATE referencing an unknown guild ID: %s. Discarding.', data['guild_id'])
+
def parse_webhooks_update(self, data):
channel = self.get_channel(int(data['channel_id']))
if channel:
diff --git a/docs/api.rst b/docs/api.rst
index 5816f60f..45baab54 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -380,6 +380,12 @@ to handle it, which defaults to print a traceback and ignoring the exception.
:param last_pin: A ``datetime.datetime`` object representing when the latest message
was pinned or ``None`` if there are no pins.
+.. function:: on_guild_integrations_update(guild)
+
+ Called whenever an integration is created, modified, or removed from a guild.
+
+ :param guild: The :class:`Guild` that had its integrations updated.
+
.. function:: on_webhooks_update(channel)
Called whenever a webhook is created, modified, or removed from a guild channel.