C
C
Cos22020-09-28 21:09:48
Python
Cos2, 2020-09-28 21:09:48

How to make a discord.py bot delete its message?

I want the bot to delete my message

await ctx.channel.send(f':white_check_mark: Удалено {amount} сообщений')
    
    await sleep(3)
    await ctx.channel.purge(limit=1 )

but another user can get ahead of those 3 sec. What's the other way to delete your post?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KeySh1e, 2020-09-28
@Cos2

Everything is very simple:

await ctx.channel.send(f':white_check_mark: Удалено {amount} сообщений', delete_after = 3)

Well, or one more variant:
msg = await ctx.channel.send(f':white_check_mark: Удалено {amount} сообщений')
await sleep(3)
await msg.delete()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question