A
A
Andriy4262021-09-10 18:23:07
Python
Andriy426, 2021-09-10 18:23:07

How to make the bot write messages and then delete them?

@bot.message_handler(commands=['go'])
def mess (message):
     time.sleep(1)
     bot.send_message (message.chat.id, "Привет")
     bot.register_next_step_handler (message, deleted)

def deleted (message):
for far in range ((message.message_id-1), message.message_id):
     bot.delete_message(message.chat.id, far)
     mess(message)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Zolin, 2021-09-10
@Tim20_Dan04

await ctx.channel.purge(limit = 1) #Command to delete the last message

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question