如何 "stick" 按钮到电报机器人屏幕底部

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

我正在尝试将 "help" 按钮粘贴到电报机器人聊天屏幕的底部。类似于:

据我所知,我需要使用内联键盘来完成此操作。然而

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

但是我得到了以下结果

该按钮未固定在页面底部,如果您键入文本,该按钮会出现。如何让它一直在机器人聊天的底部?

为了将键盘保留在页面底部,您需要使用普通 键盘 而不是内联键盘。内联键盘嵌入在聊天屏幕中,而普通键盘始终保留在底部。

你会这样做:

var keyboard = new ReplyKeyboardMarkup {
    Keyboard = new [] {
        new KeyboardButton[] 
            {
                "Help",
                "About",
            }
    }
};
await Bot.SendTextMessage(message.Chat.Id, "My Keyboard", replyMarkup: keyboard);