Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var settings = new RuntimeSettings();

            Configuration.GetSection("RuntimeSettings").Bind(settings);
            RuntimeSettings.SetInstance(settings);

            services.AddBot <SearchBot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);

                options.Middleware.Add(new CatchExceptionMiddleware <Exception>(async(context, exception) =>
                {
                    await context.TraceActivity("StackBot Exception", exception);
                    await context.SendActivity("Sorry, it looks like something went wrong!");
                }));

                // State is Memory Storage
                IStorage dataStore = new MemoryStorage();

                options.Middleware.Add(new ConversationState <SearchState>(dataStore));
            });
        }