c# - 如何将 "stick"按钮移至 Telegram Bot 屏幕底部

标签 c# .net telegram telegram-bot

我正在尝试将“帮助”按钮粘贴到 Telegram Bot 聊天屏幕的底部。像这样的东西:

enter image description here

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

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

但是我得到了以下结果 enter image description here

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

最佳答案

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

这就是你的做法:

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

关于c# - 如何将 "stick"按钮移至 Telegram Bot 屏幕底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42433665/

相关文章:

c# - 在回发时保持页面位置

c# - 我可以在联接中使用委托(delegate)变量并获取 IQueryable 吗

c# - SendKeys.发送 ("^V");不粘贴图像但会粘贴文本

c# - 为什么此对象相等性测试失败?

.net - 我认为我正在处理的未处理的 FileLoadException

.net - 为什么 EntityCollection 有时会公开扩展方法,有时则不会?

linux - 无法在 Debian : ModuleNotFoundError: No module named 'apt_pkg' 上安装 Telegram

c# - 向用户发送消息时的 PEER_ID_INVALID

.net - 用于 .NET 项目的与 github 集成的在线 CI 构建服务器

python - 使用 Telegram Bot 按计划发送消息