mullwar / telebot

The easy way to write Telegram bots in Node.js
https://www.npmjs.com/package/telebot
MIT License
1.48k stars 270 forks source link

Any example of editMessageMedia? #212

Open hirenreshamwala opened 3 years ago

hirenreshamwala commented 3 years ago

Hello,

I am sending photo using bot.sendPhoto method. After some time I want to edit the photo. I found a method editMessageMedia but there is no example how to use it.

Is there any example of editMessageMedia?

As per the source code media required object.

editMessageMedia: {
        arguments(media, opt = {}) {
            const form = {};

            if (opt.chatId) form.chat_id = opt.chatId;
            if (opt.messageId) form.message_id = opt.messageId;
            if (opt.inlineMessageId) form.inline_message_id = opt.inlineMessageId;

            form.media = JSON.stringify(media);

            return form;
        }
}

What should be the media parameter?

ransomsumit commented 2 years ago

I have this same problem. Nothing seem to work

PonomareVlad commented 2 years ago

You can use official Telegram Bot API reference

const chatId = 123, 
    messageId = 321,
    media = {type: 'photo', media: 'https://telegram.org/img/apple-touch-icon.png'}

bot.editMessageMedia(media, {chatId, messageId})