【问题标题】:How can i do slash command list instead keyboard buttons in telegram bot using c#?如何使用 c# 在电报机器人中使用斜线命令列表而不是键盘按钮?
【发布时间】:2018-05-15 13:03:42
【问题描述】:

我在电报机器人中的命令视图有一些问题。我正在使用带有 c# asp.net 的 telegram.bot SDK:

var keyboard = new ReplyKeyboardMarkup(new[]
            {
                new [] // first row
                {
                    new KeyboardButton("/help"),
                    new KeyboardButton("/start")
                },
                new []
                {
                    new KeyboardButton("/news"),
                    new KeyboardButton("/lots")
                }
            }, resizeKeyboard: true);

结果是一个类似的键盘按钮,但我需要一个命令列表。像这样: Want this 但我找不到如何做到这一点并拥有这个:Have this

【问题讨论】:

  • 您必须使用 BotFather 手动添加命令列表。阅读this answer了解更多信息。

标签: c# button keyboard telegram-bot


【解决方案1】:

您可以设置来自BotFather的命令,

或者您可以使用SetMyCommandsAsync()GetMyCommandsAsync() 方法以编程方式编辑您的命令。

【讨论】:

  • 嗨 Muaath,知道如何使用 SetMyCommandsAsync 和 GetMyCommandsAsync 吗?好像不行。。
  • 我没有使用它们。但是它们应该可以工作,现在一些 Tg 客户端在个性化命令方面存在一些错误。
猜你喜欢
  • 2018-02-09
  • 1970-01-01
  • 2018-11-18
  • 1970-01-01
  • 2018-04-28
  • 2022-12-18
  • 1970-01-01
  • 2017-08-01
  • 2018-03-23
相关资源
最近更新 更多