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?
It's currently possible in Telegram API, not the Bot API unfortunately. It's a shame:(
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:
photo = x.message.reply_photo(...)
...
...
photo.delete()
You need to have the chat_id
and the message_id
of that message sent by bot, then you can delete using context.bot.delete_message(chat_id, message_id)
.
Note: Bot cannot delete a message if it was sent more than 48 hours ago.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.