New Module to Clear Channel Messages

This commit is contained in:
Logan Cusano
2022-04-09 21:28:21 -04:00
parent e4201a2746
commit 31d5f8139c

View File

@@ -0,0 +1,31 @@
from discord.ext import commands
import asyncio
class ClearMessages(commands.Cog):
def __init__(self, bot):
self.Bot = bot
@commands.command()
async def clear(self, ctx, amount=0):
if amount == 0:
fail = await ctx.send("Please enter an amount to delete!")
await asyncio.sleep(6)
await fail.delete()
if amount < 3:
await ctx.channel.purge(limit=amount)
sucess = await ctx.send(
f"{amount} messages has been deleted <a:Verified:878231325469974599>") # sending success msg
await asyncio.sleep(6) # wait 6 seconds
await sucess.delete() # deleting the success msg
else:
if amount == 0:
fail = await ctx.send("Please enter an amount to delete!")
await asyncio.sleep(6)
await fail.delete()
def setup(bot: commands.Bot):
bot.add_cog(ClearMessages(bot))