'How do you remove reply keyboard without sending a message in Telegram?
In Telegram bot you can send a message with the reply keyboard using the sendMessage method.
The keyboard is getting displayed instead of normal qwerty one.
We can remove the displayed keyboard by sending another message and by passing ReplyKeyboardRemove object with it. However, this requires some extraneous message to be sent.
Is it possible to remove the keyboard without actually sending any real message?
I'm aware of one_time_keyboard
option, but it will only hide the keyboard without removing it.
Solution 1:[1]
You could edit the message using editMessageText or editMessageReplyMarkup and simply not pass a reply_markup
to make it disappear.
Solution 2:[2]
I was using node-telegram-bot-api and I was able to do it using remove_keyboard
.
There is a way to do this in all the languages.
return bot.sendMessage(chatId, data, {
parse_mode: 'HTML',
reply_markup: { remove_keyboard: true },
});
Solution 3:[3]
When you create a keyboard, you use a sendMessage
. Save the message_id
from response. And, then, to remove the keyboard, delete the message by calling deleteMessage(message_id)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Maak |
Solution 2 | R. Gurung |
Solution 3 | tim4dev |