Exemplo n.º 1
0
 async def send_embed(self, embed, content=None, clean=False):
     """Send an embed message to the user on ctx.channel"""
     if is_private_channel(self.ctx.channel):
         msg = await self.send_private_embed(embed, content)
     else:
         msg = await self.ctx.channel.send(embed=embed, content=content)
         if clean:
             self.messages_to_clean.append(msg)
     return msg
Exemplo n.º 2
0
    async def clean_messages(self):
        """Delete messages marked for cleaning"""
        def message_needs_cleaning(message):
            if message.id in [m.id for m in self.messages_to_clean]:
                return True

        if not is_private_channel(self.ctx.channel):
            await asyncio.sleep(constants.CLEANUP_DELAY)
            await self.ctx.channel.purge(limit=999, check=message_needs_cleaning)
Exemplo n.º 3
0
 async def send_message(self, message_text, mention=True, clean=True):
     """Send a message to the user on ctx.channel"""
     if is_private_channel(self.ctx.channel):
         msg = await self.send_private_message(message_text)
     else:
         if mention:
             msg = await self.ctx.channel.send(f"{self.ctx.author.mention}: {message_text}")
         else:
             msg = await self.ctx.channel.send(message_text)
         if clean:
             self.messages_to_clean.append(msg)
     return msg