人民!
所以,我正在使用PyTelegramBotAPI,并且我需要编辑我的机器人消息中的媒体(在我的例子中是照片),所以我尝试了这个东西:
bot.edit_message_media(message_id=M_ID, chat_id=C_ID, media=MY_MEDIA)如果我试图从另一条消息传递message.photo[0].file_id (我的意思是,照片已经在电报服务器上了),或者如果我甚至试图像这样从头开始创建InputMedia对象:
new = types.InputMedia
new.media = message.photo[0].file_id在这两种情况下,如果我打印file_id,它将显示这个长的id字符串,所以它不会丢失。但是我仍然得到这个错误:
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"但我确实设置了媒体参数...有什么问题吗?
发布于 2020-12-23 13:53:46
好了,我已经找到解决方案了。当你通过新媒体时,这样做:
from telebot import types
bot.edit_message_media(message_id=M_ID, chat_id=C_ID, media=types.InputMediaPhoto(file_id))这行得通..。哇!
https://stackoverflow.com/questions/65419530
复制相似问题