I am looking to delete a photo sent by my bot (reply_photo()
), I can’t find any specific reference to doing so in the documentation, and have tried delete_message()
, but don’t know how to delete a photo. Is it currently possible?
Question posted in Telegram API
A comprehensive official documentation can be found here.
A comprehensive official documentation can be found here.
3
Answers
I found a workaround (that I am currently still playing with). I named the photo I sent, then when I want to delete it, I delete it using .delete(). For example:
It’s currently possible in Telegram API, not the Bot API unfortunately. It’s a shame 🙁
You need to have the
chat_id
and themessage_id
of that message sent by bot, then you can delete usingcontext.bot.delete_message(chat_id, message_id)
.Note: Bot cannot delete a message if it was sent more than 48 hours ago.