ExsaNik
ExsaNik

Reputation: 153

Method editMessageReplyMarkup removes inline keybord

I am making a telegram bot using node.js and node-telegram-bot-api library.
I answer on callback_query and want to change my inline keybord. The code below shows how I am trying to use this method, but when I tap on keyboard in telegram, it just dissapears:

bot.on('callback_query', msg => {
    bot.editMessageReplyMarkup({
        reply_markup:  {
            inline_keyboard: [
                [
                    {
                        text: "text1",
                        callback_data: "data1"
                    }
                ],
                [
                    {
                        text: "text2",
                        callback_data: "data2"
                    }
                ]
            ]
        }
    }, {
        chat_id: msg.from.id, 
        message_id: msg.message.message_id
    });
})

It happens without any errors, I don't undestand why. Any ideas?
The method's discription on GitHub.

Upvotes: 4

Views: 8847

Answers (2)

William Worner
William Worner

Reputation: 7

const markupTest = {
  inline_keyboard: [
    [{
      text: "Ваш ответ принят",
      callback_data: 'done'
    }],
  ]
};

bot.telegram.editMessageReplyMarkup(chatId, messageId, inlineId,  markupTest);

Upvotes: 0

ExsaNik
ExsaNik

Reputation: 153

reply_markup isn't needed here so this will be OK:

bot.editMessageReplyMarkup({
        inline_keyboard: [
            [
                {
                    text: "text1",
                    callback_data: "data1"
                }
            ],
            [
                {
                    text: "text2",
                    callback_data: "data2"
                }
            ]
        ]
}, {
    chat_id: msg.from.id, 
    message_id: msg.message.message_id
});

Wanted to delete this but maybe someone as inattentive as me

Upvotes: 8

Related Questions