Beispiel #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the EchoBot.");

            var adapter = new ConsoleAdapter();

            adapter.ProcessActivity(async(context) =>
            {
                var echoBot = new EchoBot();
                await echoBot.OnTurn(context);
            }).Wait();
        }
 static async Task MainAsync(string[] args)
 {
     Console.WriteLine("Welcome to the EchoBot.");
     var adapter = new ConsoleAdapter();
     await adapter.ProcessActivity(async (context) =>
     {
         if (context.Request.Type == ActivityTypes.Message)
         {
             context.Reply($"echo: {context.Request.AsMessageActivity().Text}");
         }
     });
 }
Beispiel #3
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the CounterBot.");

            var adapter = new ConsoleAdapter();

            adapter.Use(new ConversationState <CounterState>(new MemoryStorage()));
            adapter.ProcessActivity(async(context) =>
            {
                var counterBot = new CounterBot();
                await counterBot.OnTurn(context);
            }).Wait();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the EchoBot. Type something to get started.");

            // Create the Console Adapter, and add Conversation State
            // to the Bot. The Conversation State will be stored in memory.
            var adapter = new ConsoleAdapter()
                          .Use(new ConversationState <EchoState>(new MemoryStorage()));

            // Create the instance of our Bot.
            var echoBot = new EchoBot();

            // Connect the Console Adapter to the Bot.
            adapter.ProcessActivity(
                async(context) => await echoBot.OnTurn(context)).Wait();
        }