I created a telegram robot that forwards video files by selecting Start. And I want them to be deleted automatically after 1 hour. Can anyone help me?
context.bot.sendDocument(chat_id=update.message.chat_id, document='https://t.me/mychanel/2',caption="1")
context.bot.sendDocument(chat_id=update.message.chat_id, document='https://t.me/mychanel/3',caption="2")
context.bot.sendDocument(chat_id=update.message.chat_id, document='https://t.me/mychanel/4',caption="3")
how can I delete auto those?☝☝☝☝
You can do
message =context.bot.sendDocument(chat_id=update.message.chat_id, document='https://t.me/mychanel/2',caption="1")
And save the message.message_id with a timestamp in a data structure, list or dict, after that you can schedule a periodic thread that do
bot.delte_message(message_id,chat_id) on the expired videos
deleted automatically telegram bot