Павел Squad
Павел Squad

Reputation: 13

How hide or delete inline button after click?

How hide or delete button after click it ?

function newQuestion(msg){
    if (count!==3) {
        var arr = questions[count];
        var text = arr.title;
        var options = {
            reply_markup: JSON.stringify({
                inline_keyboard: arr.buttons,
                parse_mode: 'Markdown',
            })
        };
        chat = msg.hasOwnProperty('chat') ? msg.chat.id : msg.from.id;
        bot.sendMessage(chat, text, options);
        countMap.set(msg.from.id,countMap.get(msg.from.id)+1);
    }
}

I've tried "hide_keyboard: true"

But it didn't work.

Upvotes: 0

Views: 2191

Answers (2)

Pastello
Pastello

Reputation: 199

When you handle the callback message generated from the user's click on the button you must call the method editMessageReplyMarkup passing it the object

{ reply_markup: JSON.stringify({ keyboard: [] }}

Anyway it may depend on the api you are using. I am referring to node-telegram-bot-api which is documented here

Upvotes: 0

Sean Wei
Sean Wei

Reputation: 7975

You need to use editMessageReplyMarkup method, and remains reply_markup as empty array like this request.

Upvotes: 1

Related Questions