telebot icon indicating copy to clipboard operation
telebot copied to clipboard

Any example of editMessageMedia?

Open hirenreshamwala opened this issue 3 years ago • 2 comments

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?

hirenreshamwala avatar Aug 16 '21 11:08 hirenreshamwala

I have this same problem. Nothing seem to work

ransomsumit avatar Jan 22 '22 09:01 ransomsumit

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})

PonomareVlad avatar Aug 02 '22 09:08 PonomareVlad