cogs/messages.py
async def on_raw_reaction_add(self, payload):
        """ Checks reactions and deletes tracked messages when necessary. """
        if payload.user_id == self.bot.user.id:
            return
        if payload.emoji.name == CONSTANTS.REACTION_DELETE:
            is_tracked = False
            sender_uid = None
            with SQLCursor(self.db) as cur:
                cur.execute("SELECT messid, sender_uid FROM tracked_messages WHERE messid=?", (payload.message_id,))
                row = cur.fetchone()
                if row:
                    is_tracked = True
                    sender_uid = row[1]
            
            if is_tracked:
                reacting_member = self.bot.get_guild(payload.guild_id).get_member(payload.user_id)
                can_delete = self.bot.get_channel(payload.channel_id).permissions_for(reacting_member).manage_messages
                if payload.user_id == sender_uid or can_delete:
                    relevant_message = await self.bot.get_channel(payload.channel_id).get_message(payload.message_id)
                    await relevant_message.delete()
 Checks reactions and deletes tracked messages when necessary. 
Checks reactions and deletes tracked messages when necessary.
Checks reactions and deletes tracked messages when necessary .
async def on_raw_reaction_add(self, payload):
        if payload.user_id == self.bot.user.id:
            return
        if payload.emoji.name == CONSTANTS.REACTION_DELETE:
            is_tracked = False
            sender_uid = None
            with SQLCursor(self.db) as cur:
                cur.execute("SELECT messid, sender_uid FROM tracked_messages WHERE messid=?", (payload.message_id,))
                row = cur.fetchone()
                if row:
                    is_tracked = True
                    sender_uid = row[1]
            if is_tracked:
                reacting_member = self.bot.get_guild(payload.guild_id).get_member(payload.user_id)
                can_delete = self.bot.get_channel(payload.channel_id).permissions_for(reacting_member).manage_messages
                if payload.user_id == sender_uid or can_delete:
                    relevant_message = await self.bot.get_channel(payload.channel_id).get_message(payload.message_id)
                    await relevant_message.delete()
async def on_raw_reaction_add ( self , payload ) : if payload . user_id == self . bot . user . id : return if payload . emoji . name == CONSTANTS . REACTION_DELETE : is_tracked = False sender_uid = None with SQLCursor ( self . db ) as cur : cur . execute ( "SELECT messid, sender_uid FROM tracked_messages WHERE messid=?" , ( payload . message_id , ) ) row = cur . fetchone ( ) if row : is_tracked = True sender_uid = row [ 1 ] if is_tracked : reacting_member = self . bot . get_guild ( payload . guild_id ) . get_member ( payload . user_id ) can_delete = self . bot . get_channel ( payload . channel_id ) . permissions_for ( reacting_member ) . manage_messages if payload . user_id == sender_uid or can_delete : relevant_message = await self . bot . get_channel ( payload . channel_id ) . get_message ( payload . message_id ) await relevant_message . delete ( )
Checks reactions and deletes tracked messages when necessary.
Checks reactions and deletes tracked messages when necessary .
""" Checks reactions and deletes tracked messages when necessary. """
self
payload