Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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!")
Comment

PREVIOUS NEXT
Code Example
Python :: how to download file from python 
Python :: django makemigrations comand 
Python :: how to hit enter in selenium python 
Python :: python time calculation 
Python :: plot specific columns pandas 
Python :: python cv2 screen capture 
Python :: anaconda-navigator command not found 
Python :: flask run app reset on change 
Python :: pandas drop row by condition 
Python :: select closest number in array python 
Python :: open chrome in pyhton 
Python :: loop on dataframe lines python 
Python :: pretty print list python 
Python :: matplotlib grid 
Python :: python create a list of alphabets 
Python :: bgr2gray opencv 
Python :: sklearn roc curve 
Python :: how to sort a list by the second element in tuple python 
Python :: python runtime 
Python :: web3py convert from wei to ether 
Python :: create virtualenv in pythonanywhere 
Python :: how to get the current date hour minute month year in python 
Python :: tkinter canvas remove border 
Python :: string with comma to int python 
Python :: array for each in python 
Python :: order by listview django 
Python :: covariance matrix python 
Python :: django gmail smtp 
Python :: timestamp change python 
Python :: superscript print python 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =