Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any example of editMessageMedia? #212

Open
hirenreshamwala opened this issue Aug 16, 2021 · 2 comments
Open

Any example of editMessageMedia? #212

hirenreshamwala opened this issue Aug 16, 2021 · 2 comments

Comments

@hirenreshamwala
Copy link

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
Copy link

I have this same problem. Nothing seem to work

@PonomareVlad
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants