Answer the question
In order to leave comments, you need to log in
How to correctly implement deleting a message after a while?
I end up with a message: "deleted (some) messages" - it needs to be deleted after a few seconds.
#clear command
@client.command(aliases = ['очистить','клеар','clr','клр'])
@commands.has_permissions(administrator = True)
async def clear( ctx, amount : int):
await ctx.channel.purge(limit = 1)
await ctx.channel.purge(limit = amount)
await ctx.send(embed = discord.Embed(description = f':white_check_mark: удалено {amount} сообщений(я)'))
Answer the question
In order to leave comments, you need to log in
delete_after
Use the functionsend
argument .
@client.command(aliases = ['очистить', 'клеар', 'clr' ,'клр'])
@commands.has_permissions(administrator = True)
async def clear( ctx, amount : int):
await ctx.message.delete()
await ctx.channel.purge(limit = amount)
await ctx.send(embed = discord.Embed(description = f':white_check_mark: удалено {amount} сообщений(я)'), delete_after=5)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question