Answer the question
In order to leave comments, you need to log in
How to make clear command on discord.js?
I want to follow the clear command for my bot.
Answer the question
In order to leave comments, you need to log in
If you want to delete all messages, then:
@bot.command()
async def clear(ctx):
await ctx.channel.purge(limit=None)
@bot.command()
async def clear(ctx, number:int=None): # кол-во сообщений по умолчанию не указано
if number != None: # если кол-во сообщений указано, то удаляем указанное количество
await ctx.channel.purge(limit=number + 1) # указанное количество + наше сообщение с командой
else: # если кол-во сообщений не указано, то удаляем всё
await ctx.channel.purge(limit=None)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question