【问题标题】:Error in make telegram bot制作电报机器人时出错
【发布时间】:2017-11-14 04:24:35
【问题描述】:

我在制作电报机器人时遇到问题!!!这是错误! CS0029 Cannot implicitly convert type 'string[][]' to 'NetTelegramBotApi.Types.KeyboardButton[][]

注意:我使用 C# 来制作机器人!

请帮忙 谢谢

【问题讨论】:

  • 你能添加更多代码和解释吗?到目前为止,这是非常模糊的
  • 您似乎正试图将字符串类型的数组分配给 KeyboardButton 类型的数组。它们不是同一类型;这是无效的转换。如果没有问题的代码示例,我们无法为您提供其他帮助。

标签: c# telegram telegram-bot


【解决方案1】:

错误日志只说你把string写成KeyboardButton,请生成KeyboardButton

【讨论】:

    【解决方案2】:

    您可以使用以下代码:

    mainMenu = new ReplyKeyboardMarkup {
      Keyboard = new KeyboardButton[][] {
        new KeyboardButton[] {
          new KeyboardButton("Your Text")
        }
      }
    };
    

    【讨论】:

      猜你喜欢
      • 2017-08-18
      • 2021-10-07
      • 2017-01-24
      • 2017-10-24
      • 1970-01-01
      • 2015-12-12
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多