How to remove (not to hide) ReplyKeyboardMarkup in Telegram.Bot using C#?

15,440

Solution 1

You can use ReplyKeyboardRemove method to do that.

Solution 2

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);
Share:
15,440
Atefeh  Ashourzadeh
Author by

Atefeh Ashourzadeh

Updated on June 11, 2022

Comments

  • Atefeh  Ashourzadeh
    Atefeh Ashourzadeh almost 2 years

    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.