skip to Main Content

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?

3

Answers


  1. Chosen as BEST ANSWER

    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()
    

  2. It’s currently possible in Telegram API, not the Bot API unfortunately. It’s a shame 🙁

    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search