Example #1
0
        public async Task CleverbotLoop()
        {
            CleverbotSession cleverbot = new CleverbotSession("your-api-key");

            Console.WriteLine("Hello in the Cleverbot.Net test app, please type your message.\n");

            string msg = Console.ReadLine();

            Console.Write("...");
            CleverbotResponse r = await cleverbot.GetResponseAsync(msg);

            Console.CursorLeft = 0;
            Console.WriteLine(r.Response);

            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Gray;
                msg = Console.ReadLine();
                Console.Write("...");
                r = await r.RespondAsync(msg);

                Console.CursorLeft = 0;
                Console.WriteLine(r.Response);
            }
        }
Example #2
0
 public async Task <string> GetResponse(string message)
 {
     LastInteraction = DateTime.Now;
     _response       = await(_response?.RespondAsync(message) ?? Session.GetResponseAsync(message));
     return(_response.Response);
 }