/// <summary>
        /// In this Echo Bot, a new instance of the Bot is created by the controller
        /// on every incoming HTTP reques. The bot is constructed using the credentials
        /// found in the config file. Note that no credentials are needed if testing
        /// the bot locally using the emulator.
        ///
        /// The bot itself simply echoes any messages sent, using the OnReceive
        /// handler. This handler checks the activity type, and returns
        /// back the sent text.
        /// </summary>
        public MessagesController(IConfiguration configuration)
        {
            var bot = new Builder.Bot(new BotFrameworkAdapter(configuration));

            _adapter = (BotFrameworkAdapter)bot.Adapter;
            bot.OnReceive(BotReceiveHandler);
        }
        /// <summary>
        /// In this sample Bot, a new instance of the Bot is created by the controller
        /// on every incoming HTTP reques. The bot is constructed using the credentials
        /// found in the config file. Note that no credentials are needed if testing
        /// the bot locally using the emulator.
        /// </summary>
        public MessagesController(IConfiguration configuration)
        {
            var bot = new Builder.Bot(new BotFrameworkAdapter(configuration))
                      .Use(new ExampleMiddleware("X"))
                      .Use(new ExampleMiddleware("\tY"))
                      .Use(new ExampleMiddleware("\t\tZ"));

            bot.OnReceive(BotReceiveHandler);

            _adapter = (BotFrameworkAdapter)bot.Adapter;
        }
Esempio n. 3
0
        /// <summary>
        /// In this sample Bot, a new instance of the Bot is created by the controller
        /// on every incoming HTTP reques. The bot is constructed using the credentials
        /// found in the config file. Note that no credentials are needed if testing
        /// the bot locally using the emulator.
        /// </summary>
        public MessagesController(IConfiguration configuration)
        {
            var bot = new Builder.Bot(new BotFrameworkAdapter(configuration))
                      .Use(new LuisRecognizerMiddleware("xxxxxx", "xxxxxx"));

            // LUIS with correct baseUri format example
            //.Use(new LuisRecognizerMiddleware("xxxxxx", "xxxxxx", "https://xxxxxx.api.cognitive.microsoft.com/luis/v2.0/apps"))

            bot.OnReceive(BotReceiveHandler);

            _adapter = (BotFrameworkAdapter)bot.Adapter;
        }
Esempio n. 4
0
        public MessagesController(IConfiguration configuration)
        {
            var qnaOptions = new QnAMakerOptions
            {
                // add subscription key and knowledge base id
                SubscriptionKey = "xxxxxx",
                KnowledgeBaseId = "xxxxxx"
            };
            var bot = new Builder.Bot(new BotFrameworkAdapter(configuration))
                      // add QnA middleware
                      .Use(new QnAMakerMiddleware(qnaOptions, _httpClient));

            bot.OnReceive(BotReceiveHandler);

            _adapter = (BotFrameworkAdapter)bot.Adapter;
        }
Esempio n. 5
0
        static async Task MainAsync(string[] args)
        {
            var cc = new ConsoleAdapter();

            Builder.Bot bot = new Builder.Bot(cc);
            bot.OnReceive(async(context) =>
            {
                if (context.Request.Type == ActivityTypes.Message)
                {
                    context.Reply($"echo: {context.Request.AsMessageActivity().Text}");
                }
            });

            Console.WriteLine("Welcome to the EchoBot.");
            await cc.Listen();
        }
Esempio n. 6
0
        public MessagesController(Builder.Bot bot)
        {
            _adapter = bot.Adapter as BotFrameworkAdapter;

            bot.OnReceive(BotReceiveHandler);
        }
 public BotController(Builder.Bot bot)
 {
     _adapter = (BotFrameworkAdapter)bot.Adapter;
     bot.OnReceive(BotReceiveHandler);
 }