【问题标题】:Error trying to send message in Telegram with Bot Framework尝试使用 Bot Framework 在 Telegram 中发送消息时出错
【发布时间】:2016-09-29 23:29:31
【问题描述】:
var connector = new ConnectorClient();
List<ChannelAccount> participants = new List<ChannelAccount>();
var tBot = new ChannelAccount
{
    ChannelId = "telegram", Address = "9digit", IsBot = true, Id = "salodkid_bot", Name = "salodkid_bot"
};
participants.Add(tBot);
var tUser = new ChannelAccount
{
    ChannelId = "telegram", Address = "9digit", IsBot = false, Id = "dsalodki", Name = "dsalodki"
};
participants.Add(tUser);
Message message = new Message
{
    From = tBot,
    To = tUser,
    Participants = participants.ToArray(),
    Text = "Hey, what's up everyone?",
    Language = "en"
};
var obj = connector.Messages.SendMessage(message);

未处理的异常:Microsoft.Rest.HttpOperationException:机器人...不匹配 From:... To:...

怎么了?

【问题讨论】:

    标签: c# botframework telegram-bot


    【解决方案1】:

    Message.From.Address 字段需要包含 bot id,如下所示:

    var tBot = new ChannelAccount
    {
        ChannelId = "telegram", Address = "salodkid_bot", IsBot = true, Id = "salodkid_bot", Name = "salodkid_bot"
    };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-27
      • 1970-01-01
      • 1970-01-01
      • 2016-02-23
      • 2021-07-26
      • 1970-01-01
      相关资源
      最近更新 更多