Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "stick" button to the bottom of the telegram bot screen

I am trying to stick "help" button to the bottom of the telegram bot chat screen. Something like:

enter image description here

As far as I understand that I need to do that with inline keyboard. However

InlineKeyboardButton[] inlineKeyboardButtons = new InlineKeyboardButton[1];
inlineKeyboardButtons[0] = new InlineKeyboardButton("Help");
InlineKeyboardMarkup mrk = new InlineKeyboardMarkup(inlineKeyboardButtons);
await Bot.SendTextMessageAsync(chatId, "<b>Help</b>", replyMarkup: mrk);

However I am getting following result enter image description here

The button is not stuck to the bottom of the page and if you type the text this button goes up. How to have it always at the bottom of the bot chat?

like image 948
Dmitrij Kultasev Avatar asked Nov 15 '25 10:11

Dmitrij Kultasev


1 Answers

In order to persist the keyboard at the bottom of the page, you need to use a normal Keyboard and not an inline keyboard. An inline keyboard is embedded inside the chat screen while a normal keyboard is always persisted at the bottom.

This is how you would do it:

var keyboard = new ReplyKeyboardMarkup {
    Keyboard = new [] {
        new KeyboardButton[] 
            {
                "Help",
                "About",
            }
    }
};
await Bot.SendTextMessage(message.Chat.Id, "My Keyboard", replyMarkup: keyboard);
like image 104
Mohamed Sohail Avatar answered Nov 17 '25 23:11

Mohamed Sohail



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!