From 3ca6a33be72e6c3556408726b313b9a0aa2a0237 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 9 Jul 2018 01:58:23 +0000 Subject: [PATCH] Update raw event handling to use the new payload param in d.py --- discordbot/titanembeds/bot.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/discordbot/titanembeds/bot.py b/discordbot/titanembeds/bot.py index 25818ee..e5a22d0 100644 --- a/discordbot/titanembeds/bot.py +++ b/discordbot/titanembeds/bot.py @@ -198,18 +198,24 @@ class Titan(discord.AutoShardedClient): async def on_webhooks_update(self, guild, channel): await self.database.update_guild(guild) - async def on_raw_message_edit(self, message_id, data): + async def on_raw_message_edit(self, payload): + message_id = payload.message_id + data = payload.data if not self.in_messages_cache(int(message_id)): channel = self.get_channel(int(data["channel_id"])) message = await channel.get_message(int(message_id)) await self.on_message_edit(None, message) - async def on_raw_message_delete(self, message_id, channel_id): + async def on_raw_message_delete(self, payload): + message_id = payload.message_id + channel_id = payload.channel_id if not self.in_messages_cache(int(message_id)): await asyncio.sleep(1) await self.process_raw_message_delete(int(message_id), int(channel_id)) - async def raw_bulk_message_delete(self, message_ids, channel_id): + async def raw_bulk_message_delete(self, payload): + message_ids = payload.message_ids + channel_ids = payload.channel_id await asyncio.sleep(1) for msgid in message_ids: msgid = int(msgid)