Node-telegram-bot-api: editMessageReplyMarkup not working

Created on 25 Sep 2018  路  2Comments  路  Source: yagop/node-telegram-bot-api

Bug Report

I have read:

I am using the latest version of the library.

Expected Behavior

Edit the message with the new Inline Keyboard

Actual Behavior

{ reply_markup: '{"inline_keyboard":[[{"text":"Instagram Story","callback_data":"v1"}],[{"text":"WhatsApp Videos","callback_data":"v2"}],[{"text":"Anleitung","callback_data":"v3"}]],"resize_keyboard":true,"parse_mode":"Markdown"}' }

 Unhandled rejection Error: ETELEGRAM: 400 Bad Request: object expected as reply markup

I send the you the new_inline_video variable output at runtim of the script above and the associated error i got.

Steps to reproduce the Behavior

 let new_inline_video;
                if(l_key == 'german'){
                    new_inline_video = {
                        reply_markup: JSON.stringify({
                            inline_keyboard: [
                                [{text: 'Instagram Story', callback_data: 'v1'}],
                                [{text: 'WhatsApp Videos', callback_data: 'v2'}],
                                [{text: 'Anleitung', callback_data: 'v3'}],
                            ],
                            resize_keyboard: true,
                            parse_mode: 'Markdown'
                        }),
                    }
                } else {
                    new_inline_video = {
                        reply_markup: JSON.stringify({
                            inline_keyboard: [
                                [{text: 'Instagram Story', callback_data: 'v1'}],
                                [{text: 'WhatsApp Videos', callback_data: 'v2'}],
                                [{text: 'Manuals', callback_data: 'v3'}],
                            ],
                            resize_keyboard: true,
                            parse_mode: 'Markdown'
                        }),
                    }
                }


                console.log(new_inline_video);
                self.bot.editMessageReplyMarkup(video_chat_id, new_inline_video)
            });
question sorry! my bad!

All 2 comments

Try with this:

var iKeys = [
    [{
        text: "Btn1",
        callback_data: "data1"
    }],
    [{
        text: "Btn2",
        callback_data: "data2"
    }]
];

bot.editMessageReplyMarkup(video_chat_id, {
    parse_mode: 'HTML',
    disable_web_page_preview: true,
    reply_markup: {
        inline_keyboard: iKeys
    }
});

PS You should differentiate callback data based on l_key, maybe with v1:german for example, instead you can't distinguish it.

No need of stringifying the object. Closing this issue for now. See the above example which should work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antonrifco picture antonrifco  路  3Comments

Panthro picture Panthro  路  3Comments

Dohoon-Kim picture Dohoon-Kim  路  3Comments

Rezania815 picture Rezania815  路  3Comments

Lemmmy picture Lemmmy  路  3Comments