Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # THIS IS TO BE ADDED TO THE FILE IN THE CLASS PURGE
- @commands.command(name="purgeall")
- async def _purgeall(self, message):
- while True:
- if perm_check_superuser(message.author.ud) == False
- logging.info(f"User {message.author.id} ran command purgeall and was denied!")
- msg_no_perms = await message.channel.send("You can't do that command")
- time.sleep(3)
- await msg_no_perms.delete()
- await message.message.delete()
- break
- loggin.info(f"User {message.author.id} ran command purgeall")
- msg_to_delete = []
- async for msg in message.channel.history(limit = float('inf')): msg_to_delete.append(msg)
- if len(msg_to_delete) > 100:
- async with message.channel.typing():
- for msg_num in range(len(msg_to_delete)): await msg_to_delete[msg_num].delete()
- else:
- async with message.channel.typing():
- try: await message.channel.delete_messages(msg_to_delete)
- for msg_num in range(len(msg_to_delete)): await msg_to_delete[msg_num].delete()
- succ_msg = await message.channel.send("", embed=discord.Embed(title=u'\u2705 Purged '+str(len(msg_to_delete))+' messages!', color=errorcolor))
- time.sleep(5)
- await succ_msg.delete()
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement