Merge branch 'master' into V3_GQRX_Improvements
This commit is contained in:
31
modules/ClearChannelMessages/cog.py
Normal file
31
modules/ClearChannelMessages/cog.py
Normal 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))
|
||||
Reference in New Issue
Block a user