예제 #1
0
        static void Main(string[] args)
        {
            var oscovaBot = new OscovaBot();

            //Channel Tester provides OscovaTestDialog.
            var tester = new ChannelTester(Directory.GetCurrentDirectory());

            //oscovaBot.Dialogs.Add(tester.OscovaTestDialog);
            //Load the SIML Modern doc instead of using a channel tester.
            oscovaBot.Import(XDocument.Load("knowlege.siml"));
            oscovaBot.Trainer.StartTraining();

            var discordChannel = new DiscordChannel <OscovaBot>(oscovaBot, "Token Here");

            discordChannel.Start().Wait();

            Console.WriteLine("Your Oscova Bot is now hosted as a Discord Bot. Press any key to exit.");
            Console.ReadKey();

            discordChannel.Stop().Wait();
        }
        /// <summary>
        /// ChatPageViewModel Constructor
        /// </summary>
        public ChatbotPageViewModel()
        {
            SendCommand      = new RelayCommand(Send);
            BackArrowCommand = new RelayCommand(Back);

            chatbot = new OscovaBot();
            var    assembly = IntrospectionExtensions.GetTypeInfo(typeof(MainPage)).Assembly;
            Stream stream   = assembly.GetManifestResourceStream("BluePillApp.Helpers.new3.siml");

            chatbot.Import(XDocument.Load(stream));
            chatbot.Trainer.StartTraining();

            //This gets the chatbots response for each message
            chatbot.MainUser.ResponseReceived += (sender, args) =>
            {
                //await Task.Delay(1000);
                Messages.Add(new ChatMessageModel()
                {
                    Text = args.Response.Text, User = App.ChatBot
                });
            };
        }