I'm using Telegram.Bot library in C# for developing telegram bots.
I post a text message using SendTextMessageAsync() method and sent a Keyboard with it :
bot.SendTextMessageAsync(chatId, "sample msg", ParseMode.Default, false, false, 0, new InlineKeyboardMarkup(keyboardData));
I want to remove (not to hide) the keyboard, after click of any user on one of the keyboard buttons, so I use this instruction :
int msgId = bot.SendTextMessageAsync(chatId, "sample msg", ParseMode.Default, false, false, 0, new InlineKeyboardMarkup(keyboardData)).Result;
...
bot.EditMessageReplyMarkupAsync(chatId, msgId, new ReplyKeyboardRemove());
But it doesn't work. Please help me about it.
Meanwhile if I set oneTimeKeyboard to true in ReplyKeyboardMarkup, the keyboard will be hide after user click, but it doesn't removed, only it will be hide and user can make it visible using keyboard button of telegram.
We can remove the displayed keyboard by sending another message and by passing ReplyKeyboardRemove object with it.
All bots, regardless of settings, will receive: All service messages. All messages from private chats with users. All messages from channels where they are a member.
Bot admins and bots with privacy mode disabled will receive all messages except messages sent by other bots. Bots with privacy mode enabled will receive: Commands explicitly meant for them (e.g., /command@this_bot). General commands from users (e.g. /start) if the bot was the last bot to send a message to the group.
I'm afraid, it's too late, but you can use ReplyKeyboardRemove
var send = new SendMessage(update.Message.Chat.Id, "your_text")
{
ReplyMarkup = new ReplyKeyboardRemove() { RemoveKeyboard = true }
};
await bot.MakeRequestAsync(send);
You can use ReplyKeyboardRemove method to do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With