node-telegram-bot-api
node-telegram-bot-api copied to clipboard
Error editMessageMedia is not a function
Hello. Please help me. Why this code don't work? Return error "bot.editMessageMedia is not a function".
bot.onText(/\/start/, function (msg, match) {
var chatId = msg.chat.id;
var userId = msg.from.id;
var first = msg.from.first_name;
var last = msg.from.last_name;
var username = msg.from.username;
const startPhoto = 'pic/startPhoto.jpg';
const startOption = {
caption: 'Hello!',
parse_mode: 'HTML',
reply_markup: JSON.stringify({
inline_keyboard: [
[{ text: '1', callback_data: '1' }],
[{ text: '2', callback_data: '2' }]
]
})
};
bot.sendPhoto(chatId, startPhoto, startOption);
});
bot.on('callback_query', (callback) => {
var answer = callback.data;
var chatId = callback.message.chat.id;
var msgId = callback.message.message_id;
const helloOption = {
chat_id: chatId,
message_id: msgId
};
if (answer === '1'){
bot.editMessageMedia({type: 'photo', media: 'pic/helloPhoto.jpg', caption: 'edited'}, {chat_id: chatId, message_id: msgId });
}
else if (answer === '2') {
bot.editMessageCaption('2', helloOption);
}
bot.answerCallbackQuery(callback.id);
});
Because this library does not support this method yet. I don't know if this has been already discussed. @kamikazechaser
Because this library does not support this method yet. I don't know if this has been already discussed. @kamikazechaser
Oh, thank you!
https://github.com/yagop/node-telegram-bot-api/issues/738#issuecomment-527147452