如何使用Microsoft框架将记录的数据导出到文本或数据库中?

时间:2018-01-24 15:19:14

标签: c# skype-bots

我有一个Skype bot活跃。

如何使用我的机器人将Skype记录的聊天内容导出为文本或Db?

我不知道从哪里开始。请给我一个指南或者其他东西,可以添加我的代码来从Skype导出记录的数据。

这是我的dialog.cs代码:

using System;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using System.Linq;
using System.Data.SqlClient;

namespace Angela.Dialogs
{
    [Serializable]
    public class RootDialog : IDialog<object>
    {
        DateTime localDate = DateTime.Now;
        String DateToday = "";


        public Task StartAsync(IDialogContext context)
        {



            context.Wait(MessageReceivedAsync);

            return Task.CompletedTask;
        }



        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result)
        {
            var activity = await result as Activity;

            // calculate something for us to return
            int length = (activity.Text ?? string.Empty).Length;

            // return our reply to the user
            String Usermessage = activity.Text.ToString().ToLower();
            //if (DateTime.UtcNow.AddHours(8)=)
            //{

            //            }

            if (Usermessage.Contains("hello") || Usermessage.Contains("hi") || Usermessage.Contains("good day") || Usermessage.Contains("good morning"))
            {

                await context.PostAsync($"Good day " + activity.From.Name.ToString() + ":)");



            }
            else if (Usermessage.Contains("good night") || Usermessage.Contains("night") || Usermessage.Contains("see you") || Usermessage.Contains("bye"))
            {

                await context.PostAsync($"Good Night " + activity.From.Name.ToString() + ", Sleep well!");



            }

            else if (Usermessage.Contains("who is angela") || Usermessage.Contains("who you") || Usermessage.Contains("kinsa ka") || Usermessage.Contains("who are you"))
            {

                await context.PostAsync("I am Angela is a bot for Design4web! Nice meeting you " + activity.From.Name.ToString());



            }
            else if (Usermessage.Contains("thank you"))
            {

                await context.PostAsync("You're welcome " + activity.From.Name.ToString());



                await context.PostAsync("Hi " + activity.From.Name.ToString() + ", My name is ANGELA!, nice meeting you!");


            }


}
}

0 个答案:

没有答案