discord.py clear command
@client.command()
async def clear(ctx, amount=5):
await ctx.channel.purge(limit=ammount)
discord.py clear command
@client.command()
async def clear(ctx, amount=5):
await ctx.channel.purge(limit=ammount)
purge command discord.py
You can treat single argument callables (like int) like converters for the purpose of declaring arguments. I also changed your permissions check to be handled automatically by a commands.check
@bot.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def clean(ctx, limit: int):
await ctx.channel.purge(limit=limit)
await ctx.send('Cleared by {}'.format(ctx.author.mention))
await ctx.message.delete()
@clean.error
async def clear_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.send("You cant do that!")
discord.py clear
@bot.command()
async def clear(ctx, amount=5):
await ctx.channel.purge(limit=amount)
or
@client.command()
async def clear(ctx, amount=5):
await ctx.channel.purge(limit=amount)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us