Dmitrij Kultasev
Dmitrij Kultasev

Reputation: 5787

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?

Upvotes: 4

Views: 7243

Answers (1)

Mohamed Sohail
Mohamed Sohail

Reputation: 1867

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);

Upvotes: 8

Related Questions