Reputation: 77
people!
So, i'm using PyTelegramBotAPI and i need to edit media (photo in my case) in my bot's message, so i tried this thing:
bot.edit_message_media(message_id=M_ID, chat_id=C_ID, media=MY_MEDIA)
If i try to pass message.photo[0].file_id
from another message (i mean, photo is already on the telegram server), or if i even try to create InputMedia
object from scratch like that:
new = types.InputMedia
new.media = message.photo[0].file_id
In both scenarios, if i print file_id
, it will show this long id string, so it's not missing.
But i still get this error:
2020-12-23 08:22:16,889 (__init__.py:489 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: parameter "media" is required"
But i did set the media parametr.... what's the problem?
Upvotes: 2
Views: 5096
Reputation: 77
Alright, i've found the solution. When you are passing new media, do it like that:
from telebot import types
bot.edit_message_media(message_id=M_ID, chat_id=C_ID, media=types.InputMediaPhoto(file_id))
This works... wow!
Upvotes: 1