繁体   English   中英

使用机器人在skype中无法预测收到的数据

[英]Data not predictably received in skype using bots

我正在使用Microsoft BotFramework处理Bots项目,因为我正在使用它来显示一些视频文件。 在这里,我面临的问题是,当我在本地Bot Frame工作模拟器中运行我的项目时,它每次都正确地获取数据,我正在配置我的Bot到Skype Channel它正常工作,当我第二次使用它时没有得到数据有时,有时它只获得数据,只有一个视频文件只是第一个视频文件。 有没有适合每次获取完整数据的解决方案? 为此我在我的方法中写下面的代码行

Activity replyToConversation = message.CreateReply("Welcome to **My Bot**." + "(Hi)");
        replyToConversation.Recipient = message.From;
        replyToConversation.Type = "message";
        replyToConversation.Attachments = new List<Attachment>();
        Dictionary<string, string> cardContentList = new Dictionary<string, string>();
        cardContentList.Add("Jason Bourne", "");
        cardContentList.Add("The Land", "");
        cardContentList.Add("Yoga Hosers", "");
        foreach (KeyValuePair<string, string> cardContent in cardContentList)
        {
            if (cardContent.Key == "Jason Bourne")
            {
                replyToConversation.Attachments.Add(new Attachment()
                {
                    ContentUrl = "https://ht39ea-bn1306.files.1drv.com/y3mz35iB6o_EJVzJvmSQz9_jNz5Cmpk33LgbGJQjpoZvQaBXrABBDvHrOS5gdHvqh_MIlJoFBIujrSkhkCGRnApldRbmT6W61NTEyOulUGUZtge9hRyKKvh9BHT-VYV_opRLSMnHt7g3b3IaiTNKcjZqQ/Jason%20Bourne%20Official%20Trailer%20%231%20(2016",
                    Name = "Jason Bourne"
                                      });
            }
            else if (cardContent.Key == "The Land")
            {
                replyToConversation.Attachments.Add(new Attachment()
                {
                    ContentUrl = "https://ht39ea-bn1306.files.1drv.com/y3mGspCfSmGDdvQjKK_3UcUIdnZRsAC2jRgHesmL61sIV_zc9F9UQQIWkyHE5E4t6r4T56aWKDQSfN-qduP2VJbiH0rYZ4Ce5DLI2U1DKx-4Tv4UB4OL2Egtk_-BWAow0fC4wf7HCC2ypyQ2dIXrs1hsw/The%20Land%20Official%20Trailer%201%20(2016",

                    ContentType = "video/mp4",
                    Name = "The Land"
                });
            }
            else if (cardContent.Key == "Yoga Hosers")
            {
                replyToConversation.Attachments.Add(new Attachment()
                {
                    ContentUrl = "https://ht39ea-bn1306.files.1drv.com/y3mThBzywEPjMFSh2rdNldHPW1oxtzVTXyrhLrJOp_ACh2YPLQcuw5W-MaSB_5DBJluNXJpvwWBcoWKcQO6Ijx7dWcj2MqHA2uFvvbH6h7mPKsiBhDuC8j5I4_qi-ZsdMuM2G6ztoUtAsdRV0pla-aOGQ/Yoga%20Hosers%20TRAILER%20(2016",

                    ContentType = "video/mp4",
                    Name = "Yoga Hosers"
                });
            }
        }
        replyToConversation.AttachmentLayout = AttachmentLayoutTypes.List;
        await context.PostAsync(replyToConversation);

两个问题。 首先,“Jason Bourne”项目缺少ContentType字段,因此帖子被拒绝。 其次,所提供的链接似乎无效或公开。 如果我添加ContentType字段并交换它可以找到的链接。

 Activity replyToConversation = message.CreateReply("Welcome to **My Bot**." + "(Hi)");
        replyToConversation.Recipient = message.From;
        replyToConversation.Type = "message";
        replyToConversation.Attachments = new List<Attachment>();
        Dictionary<string, string> cardContentList = new Dictionary<string, string>();
        cardContentList.Add("Jason Bourne", "");
        cardContentList.Add("The Land", "");
        cardContentList.Add("Yoga Hosers", "");
        foreach (KeyValuePair<string, string> cardContent in cardContentList)
        {
            if (cardContent.Key == "Jason Bourne")
            {
                replyToConversation.Attachments.Add(new Attachment()
                {
                    ContentUrl = "http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_1mb.mp4",
                    ContentType = "video/mp4",  // NEW LINE
                    Name = "Jason Bourne"
                });
            }
            else if (cardContent.Key == "The Land")
            {
                replyToConversation.Attachments.Add(new Attachment()
                {
                    ContentUrl = "http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_1mb.mp4",

                    ContentType = "video/mp4",
                    Name = "The Land"
                });
            }
            else if (cardContent.Key == "Yoga Hosers")
            {
                replyToConversation.Attachments.Add(new Attachment()
                {
                    ContentUrl = "http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_1mb.mp4",

                    ContentType = "video/mp4",
                    Name = "Yoga Hosers"
                });
            }
        }
        replyToConversation.AttachmentLayout = AttachmentLayoutTypes.List;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM