Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

discord.py clear command

@client.command()
async def clear(ctx, amount=5):
	await ctx.channel.purge(limit=ammount)
Comment

Discord.py clear command

@bot.command(name='clear')
@commands.has_permissions(manage_messages=True)
async def clear(ctx, amount: int):
    authors = {}
    async for message in ctx.channel.history(limit=amount + 1):
        if message.author not in authors:
            authors[message.author] = 1
        else:
            authors[message.author] += 1
        await message.delete()

    msg = "
".join([f"{author}:{amount}" for author,
                     amount in authors.items()])
    await ctx.channel.send(msg)```
Comment

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

PREVIOUS NEXT
Code Example
Python :: convert mp3 to wav python 
Python :: month from datetime pandas 
Python :: python add zero to string 
Python :: plot specific columns pandas 
Python :: how to lowercase list in python 
Python :: print all keys having same value 
Python :: python convert number to base 
Python :: clibboard to png 
Python :: python requests get title 
Python :: make a zero list python 
Python :: create new django app 
Python :: pandas percent change between two rows 
Python :: pyyaml install 
Python :: open url python 
Python :: --disable warning pytest 
Python :: how to loop in python 
Python :: getting dummies and input them to pandas dataframe 
Python :: how to append to text file with new line by line in python 
Python :: read database pandas 
Python :: timedelta year python 
Python :: utf8 python encodage line 
Python :: get video width and height cv2 
Python :: suffixes in pandas 
Python :: rename colmnname in dataframe scala 
Python :: get current time in python with strftime 
Python :: pandas add character to string 
Python :: save pandas dataframe to parquet 
Python :: add column as index pandas 
Python :: dataframe to list 
Python :: pip neat 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =