from discord.ext import commands
import asyncio
import discord
bot = commands.Bot(command_prefix='!')
@bot.command()
async def clear(ctx, numb,):
channel = ctx.channel
numb = int(numb)
counter = 0
async for i in channel.history(ctx.message.channel, limit=numb):
if counter < numb:
await channel.delete_messages(i)
counter += 1
import discord
from discord.ext import commands
import asyncio
bot = commands.Bot(command_prefix='!')
@bot.command()
async def clear (ctx, numb):
channel = ctx.channel
numb = int(numb)
await channel.purge(limit=numb+1)