discord py clear command code example

Example 1: discord.py clear command

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

Example 2: 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)

Example 3: discord.py clear status

def _status(self, ctx, *, message):
        '''Set a custom playing status for the bot.'''
        if message == 'clear':
            return await self.change_presence(activity=None)
        await self.change_presence(activity=discord.Game(message))
        await ctx.send(f"Changed status to **{message}**")