async def on_reaction_clear(self, message): if message.guild: msg = get_formatted_message(message) await self.io.emit('MESSAGE_REACTION_REMOVE_ALL', data=msg, room=str("CHANNEL_" + str(message.channel.id)), namespace='/gateway')
async def push_message(self, message): if message.guild: key = "Queue/channels/{}/messages".format(message.channel.id) exists = await self.connection.exists(key) if exists: message = get_formatted_message(message) await self.connection.sadd(key, [json.dumps(message, separators=(',', ':'))])
async def on_message_update(self, message): if message.guild: msg = get_formatted_message(message) await self.io.emit('MESSAGE_UPDATE', data=msg, room=str("CHANNEL_" + str(message.channel.id)), namespace='/gateway')
async def on_get_channel_messages(self, key, params): channel = self.bot.get_channel(int(params["channel_id"])) if not channel or not isinstance(channel, discord.channel.TextChannel): return await self.connection.delete([key]) messages = [] async for message in channel.history(limit=50): formatted = get_formatted_message(message) messages.append(json.dumps(formatted, separators=(',', ':'))) await self.connection.sadd(key, [""] + messages)