Skip to content

Deleting a photo sent via the bot's send_photo method. #2373

Answered by orenlab
orenlab asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks!

Is this option incorrect?

              msg = self.bot.send_photo(
                    message.chat.id,
                    photo=bot_answer,
                    reply_markup=keyboard,
                    caption=".....",
                    protect_content=True,
                    has_spoiler=True,
                    show_caption_above_media=True
                )
                # Delete message after 3 minutes
                def delete_message():
                    self.bot.delete_message(chat_id=message.chat.id, message_id=msg.message_id)

                threading.Timer(180.0, delete_message).start()

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@orenlab
Comment options

Answer selected by orenlab
@orenlab
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants