32 lines
963 B
Python
32 lines
963 B
Python
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))
|