J
J
Jamoliddin Bakhriddinov2021-05-11 15:05:52
Python
Jamoliddin Bakhriddinov, 2021-05-11 15:05:52

I sent a photo, how can I delete it and send a new one instead, edit the photo (i.e. change it)?

# К примеру вот такой код
    bot.send_photo(chat_id, photo=open('C:/Users/User/Downloads/photo.jpg', 'rb'), caption = "Hello")
    bot.send_message(chat_id, "Текст")
    time.sleep(1)
    bot.edit photo #Здесь мои полномочия заканчиваются

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Setaz213, 2021-05-12
@anqov

There is a method that allows you to edit media messages (editMessageMedia). In the telebot library (pyTelegramBotAPI), it is used like this:

bot.edit_message_media(media, chat_id=None, message_id=None, inline_message_id=None, reply_markup=None)

All Telegram API methods can be found here: https://core.telegram.org/bots/api

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question