public static void Main(string[] args) { // Try - Catch erlaubt uns ein besseres Fehlermanagement, also nutzen wir das. try { // Lade die Konfiguration settings = SettingsParser<BotSettings>.Load(); connection = SettingsParser<ConnectionSettings>.Load(); // Logging starten Logging.InitLogging(); // Exit-Methode registrieren AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnConsoleExit); // Log Console.Title = "TSĀ³ Management Bot - " + Utility.Version.GetVersion(); Logging.LogSpecial("Hallo, ich bin ein TeamSpeakĀ³-Bot."); // Verbindung zum Server herstellen worker = TS3Worker.CreateWorker(connection); worker.OpenConnection(); // Status isRunning = true; // Kommandos cmdThread = new Thread(CommandHandler.CheckCommands); cmdThread.Start(); // BotLogic botThread = new Thread(TS3Worker.CheckLogic); botThread.Start(); // Den Prozess nicht hier beenden while (true) { continue; } } catch (Exception e) { // Logge die Exception Logging.LogException(e); } }
public AutoplayEngine(Startup startup, BotSettings botSettings) : base(botSettings) { _startup = startup; }
public ActivityBuilder(BotSettings botSettings, ILocalizationFactory localizationFactory) { _botSettings = botSettings; _localizationFactory = localizationFactory; }
public JoinEventDialog( BotSettings settings, BotServices services, ConversationState conversationState, LocaleTemplateEngineManager localeTemplateEngineManager, IServiceManager serviceManager, IBotTelemetryClient telemetryClient, MicrosoftAppCredentials appCredentials) : base(nameof(JoinEventDialog), settings, services, conversationState, localeTemplateEngineManager, serviceManager, telemetryClient, appCredentials) { TelemetryClient = telemetryClient; var joinMeeting = new WaterfallStep[] { GetAuthToken, AfterGetAuthToken, CheckFocusedEvent, ConfirmNumber, AfterConfirmNumber }; var findEvent = new WaterfallStep[] { SearchEventsWithEntities, GetEvents, AddConflictFlag, ChooseEvent }; var getEvents = new WaterfallStep[] { GetEventsPrompt, AfterGetEventsPrompt, CheckValid, }; var chooseEvent = new WaterfallStep[] { ChooseEventPrompt, AfterChooseEvent }; AddDialog(new WaterfallDialog(Actions.ConnectToMeeting, joinMeeting) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.GetEvents, getEvents) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.FindEvent, findEvent) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.ChooseEvent, chooseEvent) { TelemetryClient = telemetryClient }); // Set starting dialog for component InitialDialogId = Actions.ConnectToMeeting; }
public AutoplayEngine(Startup startup, BotSettings botSettings, IGlobeInitializer globeInitializer) : base( botSettings, globeInitializer) { _startup = startup; }
public CreateEventDialog( BotSettings settings, BotServices services, ResponseManager responseManager, ConversationState conversationState, FindContactDialog findContactDialog, IServiceManager serviceManager, IBotTelemetryClient telemetryClient, MicrosoftAppCredentials appCredentials) : base(nameof(CreateEventDialog), settings, services, responseManager, conversationState, serviceManager, telemetryClient, appCredentials) { TelemetryClient = telemetryClient; var createEvent = new WaterfallStep[] { GetAuthToken, AfterGetAuthToken, CollectAttendees, CollectTitle, CollectContent, CollectStartDate, CollectStartTime, CollectDuration, CollectLocation, ConfirmBeforeCreate, ConfirmBeforeCreatePrompt, CreateEvent, }; var updateStartDate = new WaterfallStep[] { UpdateStartDateForCreate, AfterUpdateStartDateForCreate, }; var updateStartTime = new WaterfallStep[] { UpdateStartTimeForCreate, AfterUpdateStartTimeForCreate, }; var updateDuration = new WaterfallStep[] { UpdateDurationForCreate, AfterUpdateDurationForCreate, }; var getRecreateInfo = new WaterfallStep[] { GetRecreateInfo, AfterGetRecreateInfo, }; var showRestParticipants = new WaterfallStep[] { ShowRestParticipantsPrompt, ShowRestParticipants, }; // Define the conversation flow using a waterfall model. AddDialog(new WaterfallDialog(Actions.CreateEvent, createEvent) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.UpdateStartDateForCreate, updateStartDate) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.UpdateStartTimeForCreate, updateStartTime) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.UpdateDurationForCreate, updateDuration) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.GetRecreateInfo, getRecreateInfo) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.ShowRestParticipants, showRestParticipants) { TelemetryClient = telemetryClient }); AddDialog(new DatePrompt(Actions.DatePromptForCreate)); AddDialog(new TimePrompt(Actions.TimePromptForCreate)); AddDialog(new DurationPrompt(Actions.DurationPromptForCreate)); AddDialog(new GetRecreateInfoPrompt(Actions.GetRecreateInfoPrompt)); AddDialog(findContactDialog ?? throw new ArgumentNullException(nameof(findContactDialog))); // Set starting dialog for component InitialDialogId = Actions.CreateEvent; }
public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_2_1); var provider = services.BuildServiceProvider(); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); services.AddSingleton <BotSettings>(settings); services.AddSingleton <BotSettingsBase>(settings); // Configure credentials services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); services.AddSingleton(new MicrosoftAppCredentials(settings.MicrosoftAppId, settings.MicrosoftAppPassword)); // Configure bot state services.AddSingleton <IStorage>(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton <UserState>(); services.AddSingleton <ConversationState>(); services.AddSingleton <ProactiveState>(); services.AddSingleton(sp => { var userState = sp.GetService <UserState>(); var conversationState = sp.GetService <ConversationState>(); var proactiveState = sp.GetService <ProactiveState>(); return(new BotStateSet(userState, conversationState, proactiveState)); }); // Configure telemetry services.AddApplicationInsightsTelemetry(); var telemetryClient = new BotTelemetryClient(new TelemetryClient()); services.AddSingleton <IBotTelemetryClient>(telemetryClient); services.AddBotApplicationInsights(telemetryClient); // Configure bot services services.AddSingleton <BotServices>(); // Configure proactive services.AddSingleton <IBackgroundTaskQueue, BackgroundTaskQueue>(); services.AddHostedService <QueuedHostedService>(); // Configure service manager services.AddTransient <IServiceManager, ServiceManager>(); // Configure responses services.AddSingleton(sp => new ResponseManager( settings.CognitiveModels.Select(l => l.Key).ToArray(), new FindContactResponses(), new ChangeEventStatusResponses(), new CreateEventResponses(), new JoinEventResponses(), new CalendarMainResponses(), new CalendarSharedResponses(), new SummaryResponses(), new TimeRemainingResponses(), new UpdateEventResponses())); // register dialogs services.AddTransient <MainDialog>(); services.AddTransient <ChangeEventStatusDialog>(); services.AddTransient <JoinEventDialog>(); services.AddTransient <CreateEventDialog>(); services.AddTransient <FindContactDialog>(); services.AddTransient <ShowEventsDialog>(); services.AddTransient <TimeRemainingDialog>(); services.AddTransient <UpcomingEventDialog>(); services.AddTransient <UpdateEventDialog>(); services.AddTransient <FindContactDialog>(); // Configure adapters services.AddTransient <IBotFrameworkHttpAdapter, DefaultAdapter>(); services.AddTransient <SkillWebSocketBotAdapter, CalendarSkillWebSocketBotAdapter>(); services.AddTransient <SkillWebSocketAdapter>(); services.AddSingleton <IWhitelistAuthenticationProvider, WhitelistAuthenticationProvider>(); // Configure bot services.AddTransient <IBot, DialogBot <MainDialog> >(); }
public void ConfigureServices(IServiceCollection services) { // Configure MVC services.AddControllers().AddNewtonsoftJson(); // Configure channel provider services.AddSingleton <IChannelProvider, ConfigurationChannelProvider>(); // Register AuthConfiguration to enable custom claim validation. services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(sp.GetService <IConfiguration>()) }); // Configure server options services.Configure <KestrelServerOptions>(options => { options.AllowSynchronousIO = true; }); services.Configure <IISServerOptions>(options => { options.AllowSynchronousIO = true; }); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); services.AddSingleton <BotSettings>(settings); services.AddSingleton <BotSettingsBase>(settings); // Configure credentials services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); services.AddSingleton(new MicrosoftAppCredentials(settings.MicrosoftAppId, settings.MicrosoftAppPassword)); // Configure bot state services.AddSingleton <IStorage>(new CosmosDbPartitionedStorage(settings.CosmosDb)); services.AddSingleton <UserState>(); services.AddSingleton <ConversationState>(); services.AddSingleton(sp => { var userState = sp.GetService <UserState>(); var conversationState = sp.GetService <ConversationState>(); return(new BotStateSet(userState, conversationState)); }); // Configure telemetry services.AddApplicationInsightsTelemetry(); services.AddSingleton <IBotTelemetryClient, BotTelemetryClient>(); services.AddSingleton <ITelemetryInitializer, OperationCorrelationTelemetryInitializer>(); services.AddSingleton <ITelemetryInitializer, TelemetryBotIdInitializer>(); services.AddSingleton <TelemetryInitializerMiddleware>(); services.AddSingleton <TelemetryLoggerMiddleware>(); // Configure bot services services.AddSingleton <BotServices>(); // Configure proactive services.AddSingleton <IBackgroundTaskQueue, BackgroundTaskQueue>(); services.AddHostedService <QueuedHostedService>(); // Configure HttpContext required for path resolution services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton(LocaleTemplateManagerWrapper.CreateLocaleTemplateManager("en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn")); // register dialogs services.AddTransient <MainDialog>(); services.AddTransient <BookingDialog>(); services.AddTransient <CancelDialog>(); // Configure adapters services.AddTransient <IBotFrameworkHttpAdapter, DefaultAdapter>(); // Configure bot services.AddTransient <MainDialog>(); services.AddTransient <IBot, DefaultActivityHandler <MainDialog> >(); }
/// <summary> /// Initializes a new instance of the <see cref="TokenHelper"/> class. /// Helps generating custom token, validating custom token and generate AADv1 user access token for given resource. /// </summary> /// <param name="oAuthClient">Instance of the Microsoft Bot Connector OAuthClient class.</param> /// <param name="botSettings">A set of key/value application configuration properties.</param> /// <param name="logger">Instance to send logs to the Application Insights service.</param> public TokenHelper(OAuthClient oAuthClient, IOptionsMonitor <BotSettings> botSettings, ILogger <TokenHelper> logger) { this.botSettings = botSettings.CurrentValue; this.oAuthClient = oAuthClient; this.logger = logger; }
public void ConfigureTranscriptLoggerMiddleware(BotFrameworkHttpAdapter adapter, BotSettings settings) { if (ConfigSectionValid(settings.BlobStorage.ConnectionString) && ConfigSectionValid(settings.BlobStorage.Container)) { adapter.Use(new TranscriptLoggerMiddleware(new AzureBlobTranscriptStore(settings.BlobStorage.ConnectionString, settings.BlobStorage.Container))); } }
public override void Configure(IFunctionsHostBuilder builder) { var binDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var rootDirectory = Directory.GetParent(binDirectory).FullName; var rootConfiguration = BuildConfiguration(rootDirectory); var settings = new BotSettings(); rootConfiguration.Bind(settings); var services = builder.Services; services.AddSingleton <IConfiguration>(rootConfiguration); services.AddLogging(); // Create the credential provider to be used with the Bot Framework Adapter. services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); services.AddSingleton <BotAdapter>(sp => (BotFrameworkHttpAdapter)sp.GetService <IBotFrameworkHttpAdapter>()); // Register AuthConfiguration to enable custom claim validation. services.AddSingleton <AuthenticationConfiguration>(); // Adaptive component registration ComponentRegistration.Add(new DialogsComponentRegistration()); ComponentRegistration.Add(new DeclarativeComponentRegistration()); ComponentRegistration.Add(new AdaptiveComponentRegistration()); ComponentRegistration.Add(new LanguageGenerationComponentRegistration()); ComponentRegistration.Add(new QnAMakerComponentRegistration()); ComponentRegistration.Add(new LuisComponentRegistration()); // This is for custom action component registration. //ComponentRegistration.Add(new CustomActionComponentRegistration()); // Register the skills client and skills request handler. services.AddSingleton <SkillConversationIdFactoryBase, SkillConversationIdFactory>(); services.AddHttpClient <BotFrameworkClient, SkillHttpClient>(); services.AddSingleton <ChannelServiceHandler, SkillHandler>(); // Register telemetry client, initializers and middleware services.AddApplicationInsightsTelemetry(settings.ApplicationInsights.InstrumentationKey); services.AddSingleton <ITelemetryInitializer, OperationCorrelationTelemetryInitializer>(); services.AddSingleton <ITelemetryInitializer, TelemetryBotIdInitializer>(); services.AddSingleton <IBotTelemetryClient, BotTelemetryClient>(); services.AddSingleton <TelemetryLoggerMiddleware>(sp => { var telemetryClient = sp.GetService <IBotTelemetryClient>(); return(new TelemetryLoggerMiddleware(telemetryClient, logPersonalInformation: settings.Telemetry.LogPersonalInformation)); }); services.AddSingleton <TelemetryInitializerMiddleware>(sp => { var httpContextAccessor = sp.GetService <IHttpContextAccessor>(); var telemetryLoggerMiddleware = sp.GetService <TelemetryLoggerMiddleware>(); return(new TelemetryInitializerMiddleware(httpContextAccessor, telemetryLoggerMiddleware, settings.Telemetry.LogActivities)); }); // Storage IStorage storage; if (ConfigSectionValid(settings.CosmosDb.AuthKey)) { storage = new CosmosDbPartitionedStorage(settings.CosmosDb); } else { storage = new MemoryStorage(); } services.AddSingleton(storage); var userState = new UserState(storage); var conversationState = new ConversationState(storage); services.AddSingleton(userState); services.AddSingleton(conversationState); // Resource explorer to track declarative assets var resourceExplorer = new ResourceExplorer().AddFolder(Path.Combine(rootDirectory, settings.Bot ?? ".")); services.AddSingleton(resourceExplorer); // Adapter services.AddSingleton <IBotFrameworkHttpAdapter, BotFrameworkHttpAdapter>(s => { // Retrieve required dependencies //IConfiguration configuration = s.GetService<IConfiguration>(); IStorage storage = s.GetService <IStorage>(); UserState userState = s.GetService <UserState>(); ConversationState conversationState = s.GetService <ConversationState>(); TelemetryInitializerMiddleware telemetryInitializerMiddleware = s.GetService <TelemetryInitializerMiddleware>(); var adapter = new BotFrameworkHttpAdapter(new ConfigurationCredentialProvider(rootConfiguration)); adapter .UseStorage(storage) .UseBotState(userState, conversationState) .Use(new RegisterClassMiddleware <IConfiguration>(rootConfiguration)) .Use(telemetryInitializerMiddleware); // Configure Middlewares ConfigureTranscriptLoggerMiddleware(adapter, settings); ConfigureInspectionMiddleWare(adapter, settings, s); ConfigureShowTypingMiddleWare(adapter, settings); adapter.OnTurnError = async(turnContext, exception) => { await turnContext.SendActivityAsync(exception.Message).ConfigureAwait(false); await conversationState.ClearStateAsync(turnContext).ConfigureAwait(false); await conversationState.SaveChangesAsync(turnContext).ConfigureAwait(false); }; return(adapter); }); var defaultLocale = rootConfiguration.GetValue <string>("defaultLanguage") ?? "en-us"; var removeRecipientMention = settings?.Feature?.RemoveRecipientMention ?? false; // Bot services.AddSingleton <IBot>(s => new ComposerBot( s.GetService <ConversationState>(), s.GetService <UserState>(), s.GetService <ResourceExplorer>(), s.GetService <BotFrameworkClient>(), s.GetService <SkillConversationIdFactoryBase>(), s.GetService <IBotTelemetryClient>(), GetRootDialog(Path.Combine(rootDirectory, settings.Bot)), defaultLocale, removeRecipientMention)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddNewtonsoftJson(); services.AddSingleton <IConfiguration>(this.Configuration); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); // Create the credential provider to be used with the Bot Framework Adapter. services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); services.AddSingleton <BotAdapter>(sp => (BotFrameworkHttpAdapter)sp.GetService <IBotFrameworkHttpAdapter>()); // Register AuthConfiguration to enable custom claim validation for skills. services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(settings.SkillConfiguration) }); // register components. ComponentRegistration.Add(new DialogsComponentRegistration()); ComponentRegistration.Add(new DeclarativeComponentRegistration()); ComponentRegistration.Add(new AdaptiveComponentRegistration()); ComponentRegistration.Add(new LanguageGenerationComponentRegistration()); ComponentRegistration.Add(new QnAMakerComponentRegistration()); ComponentRegistration.Add(new LuisComponentRegistration()); // This is for custom action component registration. //ComponentRegistration.Add(new CustomActionComponentRegistration()); // Register the skills client and skills request handler. services.AddSingleton <SkillConversationIdFactoryBase, SkillConversationIdFactory>(); services.AddHttpClient <BotFrameworkClient, SkillHttpClient>(); services.AddSingleton <ChannelServiceHandler, SkillHandler>(); // Register telemetry client, initializers and middleware services.AddApplicationInsightsTelemetry(settings?.ApplicationInsights?.InstrumentationKey ?? string.Empty); services.AddSingleton <ITelemetryInitializer, OperationCorrelationTelemetryInitializer>(); services.AddSingleton <ITelemetryInitializer, TelemetryBotIdInitializer>(); services.AddSingleton <IBotTelemetryClient, BotTelemetryClient>(); services.AddSingleton <TelemetryLoggerMiddleware>(sp => { var telemetryClient = sp.GetService <IBotTelemetryClient>(); return(new TelemetryLoggerMiddleware(telemetryClient, logPersonalInformation: settings?.Telemetry?.LogPersonalInformation ?? false)); }); services.AddSingleton <TelemetryInitializerMiddleware>(sp => { var httpContextAccessor = sp.GetService <IHttpContextAccessor>(); var telemetryLoggerMiddleware = sp.GetService <TelemetryLoggerMiddleware>(); return(new TelemetryInitializerMiddleware(httpContextAccessor, telemetryLoggerMiddleware, settings?.Telemetry?.LogActivities ?? false)); }); var storage = ConfigureStorage(settings); services.AddSingleton(storage); var userState = new UserState(storage); var conversationState = new ConversationState(storage); services.AddSingleton(userState); services.AddSingleton(conversationState); // Configure bot loading path var botDir = settings.Bot; var resourceExplorer = new ResourceExplorer().AddFolder(botDir); var rootDialog = GetRootDialog(botDir); var defaultLocale = Configuration.GetValue <string>("defaultLanguage") ?? "en-us"; services.AddSingleton(resourceExplorer); resourceExplorer.RegisterType <OnQnAMatch>("Microsoft.OnQnAMatch"); services.AddSingleton <IBotFrameworkHttpAdapter, BotFrameworkHttpAdapter>(s => GetBotAdapter(storage, settings, userState, conversationState, s)); var removeRecipientMention = settings?.Feature?.RemoveRecipientMention ?? false; services.AddSingleton <IBot>(s => new ComposerBot( s.GetService <ConversationState>(), s.GetService <UserState>(), s.GetService <ResourceExplorer>(), s.GetService <BotFrameworkClient>(), s.GetService <SkillConversationIdFactoryBase>(), s.GetService <IBotTelemetryClient>(), rootDialog, defaultLocale, removeRecipientMention)); }
public bool IsSkill(BotSettings settings) { return(settings?.SkillConfiguration?.IsSkill == true); }
/// <summary> /// Constructor for the code fetching bot /// </summary> /// <param name="displayProgress">Define wether or not progress is displayed (fills console)</param>/param> public Bot(BotSettings settings, bool displayProgress = true) { // loading settings _settings = settings; _displayProgress = displayProgress; }
public DslBot(BotSettings settings) : base(settings) { _dslFactory = new DslFactory(); _dslFactory.Register<ResponseStrategy>(new ResponseStrategyDslEngine()); }
public MarkToDoItemDialog( BotSettings settings, BotServices services, ResponseManager responseManager, ConversationState conversationState, UserState userState, IServiceManager serviceManager, IBotTelemetryClient telemetryClient, MicrosoftAppCredentials appCredentials) : base(nameof(MarkToDoItemDialog), settings, services, responseManager, conversationState, userState, serviceManager, telemetryClient, appCredentials) { TelemetryClient = telemetryClient; var markTask = new WaterfallStep[] { GetAuthToken, AfterGetAuthToken, ClearContext, CollectListTypeForComplete, InitAllTasks, DoMarkTask, }; var doMarkTask = new WaterfallStep[] { CollectTaskIndexForComplete, MarkTaskCompleted, ContinueMarkTask, }; var collectListTypeForComplete = new WaterfallStep[] { AskListType, AfterAskListType, }; var collectTaskIndexForComplete = new WaterfallStep[] { AskTaskIndex, AfterAskTaskIndex, }; var continueMarkTask = new WaterfallStep[] { AskContinueMarkTask, AfterAskContinueMarkTask, }; // Define the conversation flow using a waterfall model. AddDialog(new WaterfallDialog(Actions.DoMarkTask, doMarkTask) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.MarkTaskCompleted, markTask) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.CollectListTypeForComplete, collectListTypeForComplete) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.CollectTaskIndexForComplete, collectTaskIndexForComplete) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.ContinueMarkTask, continueMarkTask) { TelemetryClient = telemetryClient }); // Set starting dialog for component InitialDialogId = Actions.MarkTaskCompleted; }
public FindContactDialog( BotSettings settings, BotServices services, ResponseManager responseManager, ConversationState conversationState, IServiceManager serviceManager, IBotTelemetryClient telemetryClient, MicrosoftAppCredentials appCredentials) : base(nameof(FindContactDialog), settings, services, responseManager, conversationState, serviceManager, telemetryClient, appCredentials) { TelemetryClient = telemetryClient; // entry, get the name list var confirmNameList = new WaterfallStep[] { ConfirmNameList, AfterConfirmNameList, }; // go through the name list, replace the confirmNameList // set state.MeetingInfor.ContactInfor.CurrentContactName var loopNameList = new WaterfallStep[] { LoopNameList, AfterLoopNameList }; // check on the attendee of state.MeetingInfor.ContactInfor.CurrentContactName. // called by loopNameList var confirmAttendee = new WaterfallStep[] { // call updateName to get the person state.MeetingInfor.ContactInfor.ConfirmedContact. // state.MeetingInfor.ContactInfor.ConfirmedContact should be set after this step ConfirmName, // check if the state.MeetingInfor.ContactInfor.ConfirmedContact // - null : failed to parse this name for multiple try. // - one email : check if this one is wanted // - multiple emails : call selectEmail ConfirmEmail, // if got no on last step, replace/restart this flow. AfterConfirmEmail }; // use the user name of state.MeetingInfor.ContactInfor.CurrentContactName or user input to find the persons. // and will call select person. // after all this done, state.MeetingInfor.ContactInfor.ConfirmedContact should be set. var updateName = new WaterfallStep[] { // check whether should the bot ask for attendee name. // if called by confirmAttendee then skip this step. // if called by itself when can not find the last input, it will ask back or end this one when multiple try. UpdateUserName, // check if email. add email direct into attendee and set state.MeetingInfor.ContactInfor.ConfirmedContact null. // if not, search for the attendee. // if got multiple persons, call selectPerson. use replace // if got no person, replace/restart this flow. AfterUpdateUserName, GetAuthToken, AfterGetAuthToken, GetUserFromUserName }; // select email. // called by ConfirmEmail var selectEmail = new WaterfallStep[] { SelectEmail, AfterSelectEmail }; var addMoreUserPrompt = new WaterfallStep[] { AddMoreUserPrompt, AfterAddMoreUserPrompt }; AddDialog(new WaterfallDialog(Actions.ConfirmNameList, confirmNameList) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.LoopNameList, loopNameList) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.ConfirmAttendee, confirmAttendee) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.UpdateName, updateName) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.SelectEmail, selectEmail) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.AddMoreUserPrompt, addMoreUserPrompt) { TelemetryClient = telemetryClient }); InitialDialogId = Actions.ConfirmNameList; }
private BotInitializer(BotSettings botSettings) { Debug.Assert(botSettings.AllSettingsAreSet(), "Set all properties at BotSettings class."); BotSettings = botSettings; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Configure MVC services.AddControllers().AddNewtonsoftJson(); services.AddSingleton(Configuration); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); services.AddSingleton(settings); // Configure channel provider services.AddSingleton <IChannelProvider, ConfigurationChannelProvider>(); // Configure configuration provider services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); // Configure telemetry services.AddApplicationInsightsTelemetry(); services.AddSingleton <IBotTelemetryClient, BotTelemetryClient>(); services.AddSingleton <ITelemetryInitializer, OperationCorrelationTelemetryInitializer>(); services.AddSingleton <ITelemetryInitializer, TelemetryBotIdInitializer>(); services.AddSingleton <TelemetryInitializerMiddleware>(); services.AddSingleton <TelemetryLoggerMiddleware>(); // Configure bot services services.AddSingleton <BotServices>(); // Configure storage // Uncomment the following line for local development without Cosmos Db //services.AddSingleton<IStorage, MemoryStorage>(); services.AddSingleton <IStorage>(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton <UserState>(); services.AddSingleton <ConversationState>(); // Configure localized responses var localizedTemplates = new Dictionary <string, List <string> >(); var templateFiles = new List <string>() { "MainResponses", "OnboardingResponses" }; var supportedLocales = new List <string>() { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" }; foreach (var locale in supportedLocales) { var localeTemplateFiles = new List <string>(); foreach (var template in templateFiles) { // LG template for en-us does not include locale in file extension. if (locale.Equals("en-us")) { localeTemplateFiles.Add(Path.Combine(".", "Responses", $"{template}.lg")); } else { localeTemplateFiles.Add(Path.Combine(".", "Responses", $"{template}.{locale}.lg")); } } localizedTemplates.Add(locale, localeTemplateFiles); } services.AddSingleton(new LocaleTemplateEngineManager(localizedTemplates, settings.DefaultLocale ?? "en-us")); // Register the skills configuration class services.AddSingleton <SkillsConfiguration>(); // Register AuthConfiguration to enable custom claim validation. services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(sp.GetService <SkillsConfiguration>()) }); // Register dialogs services.AddTransient <MainDialog>(); services.AddTransient <SwitchSkillDialog>(); services.AddTransient <OnboardingDialog>(); // Register the Bot Framework Adapter with error handling enabled. // Note: some classes use the base BotAdapter so we add an extra registration that pulls the same instance. services.AddSingleton <BotFrameworkHttpAdapter, DefaultAdapter>(); services.AddSingleton <BotAdapter>(sp => sp.GetService <BotFrameworkHttpAdapter>()); // Configure bot services.AddTransient <IBot, DefaultActivityHandler <MainDialog> >(); // Register the skills conversation ID factory, the client and the request handler. services.AddSingleton <SkillConversationIdFactoryBase, SkillConversationIdFactory>(); services.AddHttpClient <SkillHttpClient>(); services.AddSingleton <ChannelServiceHandler, SkillHandler>(); // Register the SkillDialogs (remote skills). var section = Configuration?.GetSection("BotFrameworkSkills"); var skills = section?.Get <EnhancedBotFrameworkSkill[]>(); if (skills != null) { var hostEndpointSection = Configuration?.GetSection("SkillHostEndpoint"); if (hostEndpointSection == null) { throw new ArgumentException($"{hostEndpointSection} is not in the configuration"); } else { var hostEndpoint = new Uri(hostEndpointSection.Value); foreach (var skill in skills) { services.AddSingleton(sp => { return(new SkillDialog(sp.GetService <ConversationState>(), sp.GetService <SkillHttpClient>(), skill, Configuration, hostEndpoint)); }); } } } }
public CheckAvailableDialog( BotSettings settings, BotServices services, ResponseManager responseManager, ConversationState conversationState, FindContactDialog findContactDialog, IServiceManager serviceManager, IBotTelemetryClient telemetryClient, MicrosoftAppCredentials appCredentials) : base(nameof(CheckAvailableDialog), settings, services, responseManager, conversationState, serviceManager, telemetryClient, appCredentials) { TelemetryClient = telemetryClient; var checkAvailable = new WaterfallStep[] { GetAuthToken, AfterGetAuthToken, CollectContacts, CollectTime, GetAuthToken, AfterGetAuthToken, CheckAvailable, }; var collectTime = new WaterfallStep[] { AskForTimePrompt, AfterAskForTimePrompt }; var findNextAvailableTime = new WaterfallStep[] { FindNextAvailableTimePrompt, AfterFindNextAvailableTimePrompt, }; var createMeetingWithAvailableTime = new WaterfallStep[] { CreateMeetingPrompt, AfterCreateMeetingPrompt }; // Define the conversation flow using a waterfall model. AddDialog(new WaterfallDialog(Actions.CheckAvailable, checkAvailable) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.FindNextAvailableTime, findNextAvailableTime) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.CollectTime, collectTime) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.CreateMeetingWithAvailableTime, createMeetingWithAvailableTime) { TelemetryClient = telemetryClient }); AddDialog(findContactDialog ?? throw new ArgumentNullException(nameof(findContactDialog))); // Set starting dialog for component InitialDialogId = Actions.CheckAvailable; }
public Message(MessagingService messagingService, IOptions <BotSettings> botSettings, FileService fileService) { _messagingService = messagingService; _botSettings = botSettings.Value; _fileService = fileService; }
public void ConfigureServices(IServiceCollection services) { // Configure MVC services.AddControllers().AddNewtonsoftJson(); // Configure server options services.Configure <KestrelServerOptions>(options => { options.AllowSynchronousIO = true; }); services.Configure <IISServerOptions>(options => { options.AllowSynchronousIO = true; }); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); services.AddSingleton <BotSettings>(settings); services.AddSingleton <BotSettingsBase>(settings); // Register AuthConfiguration to enable custom claim validation. services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(sp.GetService <IConfiguration>()) }); // Configure bot services services.AddSingleton <BotServices>(); // Configure credentials services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); // Configure channel provider services.AddSingleton <IChannelProvider, ConfigurationChannelProvider>(); // Configure bot state // Uncomment the following line for local development without Cosmos Db // services.AddSingleton<IStorage>(new MemoryStorage()); services.AddSingleton <IStorage>(new CosmosDbPartitionedStorage(settings.CosmosDb)); services.AddSingleton <UserState>(); services.AddSingleton <ConversationState>(); services.AddSingleton(sp => { var userState = sp.GetService <UserState>(); var conversationState = sp.GetService <ConversationState>(); return(new BotStateSet(userState, conversationState)); }); // Configure telemetry services.AddApplicationInsightsTelemetry(); services.AddSingleton <IBotTelemetryClient, BotTelemetryClient>(); services.AddSingleton <ITelemetryInitializer, OperationCorrelationTelemetryInitializer>(); services.AddSingleton <ITelemetryInitializer, TelemetryBotIdInitializer>(); services.AddSingleton <TelemetryInitializerMiddleware>(); services.AddSingleton <TelemetryLoggerMiddleware>(); // Configure proactive services.AddSingleton <IBackgroundTaskQueue, BackgroundTaskQueue>(); services.AddHostedService <QueuedHostedService>(); // Configure service manager services.AddTransient <IServiceManager, ServiceManager>(); // Configure responses services.AddSingleton(LocaleTemplateManagerWrapper.CreateLocaleTemplateManager("en-us")); // register dialogs services.AddTransient <MainDialog>(); services.AddTransient <OutgoingCallDialog>(); // Configure adapters services.AddTransient <IBotFrameworkHttpAdapter, DefaultAdapter>(); // Configure bot services.AddTransient <MainDialog>(); services.AddTransient <IBot, DefaultActivityHandler <MainDialog> >(); }
public void ConfigureServices(IServiceCollection services) { // Configure MVC services.AddControllers().AddNewtonsoftJson(); // Configure server options services.Configure <KestrelServerOptions>(options => { options.AllowSynchronousIO = true; }); services.Configure <IISServerOptions>(options => { options.AllowSynchronousIO = true; }); // Configure channel provider services.AddSingleton <IChannelProvider, ConfigurationChannelProvider>(); // Register AuthConfiguration to enable custom claim validation. services.AddSingleton(sp => new AuthenticationConfiguration { ClaimsValidator = new AllowedCallersClaimsValidator(sp.GetService <IConfiguration>()) }); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); services.AddSingleton <BotSettings>(settings); services.AddSingleton <BotSettingsBase>(settings); // Configure credentials services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); services.AddSingleton(new MicrosoftAppCredentials(settings.MicrosoftAppId, settings.MicrosoftAppPassword)); // Configure bot state // Uncomment the following line for local development without Cosmos Db // services.AddSingleton<IStorage>(new MemoryStorage()); services.AddSingleton <IStorage>(new CosmosDbPartitionedStorage(settings.CosmosDb)); services.AddSingleton <UserState>(); services.AddSingleton <ConversationState>(); services.AddSingleton <ProactiveState>(); services.AddSingleton(sp => { var userState = sp.GetService <UserState>(); var conversationState = sp.GetService <ConversationState>(); var proactiveState = sp.GetService <ProactiveState>(); return(new BotStateSet(userState, conversationState, proactiveState)); }); // Configure localized responses var localizedTemplates = new Dictionary <string, string>(); var templateFile = "ResponsesAndTexts"; var supportedLocales = new List <string>() { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" }; foreach (var locale in supportedLocales) { // LG template for en-us does not include locale in file extension. var localeTemplateFile = locale.Equals("en-us") ? Path.Combine(".", "Responses", "Shared", $"{templateFile}.lg") : Path.Combine(".", "Responses", "Shared", $"{templateFile}.{locale}.lg"); localizedTemplates.Add(locale, localeTemplateFile); } services.AddSingleton(new LocaleTemplateManager(localizedTemplates, settings.DefaultLocale ?? "en-us")); if (!string.IsNullOrEmpty(settings.AzureSearch?.SearchServiceName)) { services.AddSingleton <ISearchService>(new AzureSearchClient(settings.AzureSearch?.SearchServiceName, settings.AzureSearch?.SearchServiceAdminApiKey, settings.AzureSearch?.SearchIndexName)); } else { services.AddSingleton <ISearchService, DefaultSearchClient>(); } // Configure telemetry services.AddApplicationInsightsTelemetry(); services.AddSingleton <IBotTelemetryClient, BotTelemetryClient>(); services.AddSingleton <ITelemetryInitializer, OperationCorrelationTelemetryInitializer>(); services.AddSingleton <ITelemetryInitializer, TelemetryBotIdInitializer>(); services.AddSingleton <TelemetryInitializerMiddleware>(); services.AddSingleton <TelemetryLoggerMiddleware>(); // Configure bot services services.AddSingleton <BotServices>(); // Configure proactive services.AddSingleton <IBackgroundTaskQueue, BackgroundTaskQueue>(); services.AddHostedService <QueuedHostedService>(); // Configure service manager services.AddTransient <IServiceManager, ServiceManager>(); // register dialogs services.AddTransient <MainDialog>(); services.AddTransient <ChangeEventStatusDialog>(); services.AddTransient <JoinEventDialog>(); services.AddTransient <CreateEventDialog>(); services.AddTransient <FindContactDialog>(); services.AddTransient <ShowEventsDialog>(); services.AddTransient <TimeRemainingDialog>(); services.AddTransient <UpcomingEventDialog>(); services.AddTransient <UpdateEventDialog>(); services.AddTransient <CheckPersonAvailableDialog>(); services.AddTransient <FindMeetingRoomDialog>(); services.AddTransient <UpdateMeetingRoomDialog>(); services.AddTransient <BookMeetingRoomDialog>(); // Configure adapters services.AddSingleton <IBotFrameworkHttpAdapter, DefaultAdapter>(); // Configure bot services.AddTransient <IBot, DefaultActivityHandler <MainDialog> >(); }
public AzureMapsClient(BotSettings settings) { GetApiKey(settings); _httpClient = new HttpClient(); }
protected AutoplayEngineBase(BotSettings botSettings) { BotSettings = botSettings; }
private void GetApiKey(BotSettings settings) { _apiKey = settings.AzureMapsKey ?? throw new Exception("Could not get the required AzureMapsKey API key. Please make sure your settings are correctly configured."); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); var provider = services.BuildServiceProvider(); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); services.AddSingleton(settings); // Configure credentials services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); var appCredentials = new MicrosoftAppCredentials(settings.MicrosoftAppId, settings.MicrosoftAppPassword); services.AddSingleton(appCredentials); // Configure telemetry services.AddApplicationInsightsTelemetry(); var telemetryClient = new BotTelemetryClient(new TelemetryClient()); services.AddSingleton <IBotTelemetryClient>(telemetryClient); services.AddBotApplicationInsights(telemetryClient); // Configure bot services services.AddSingleton <BotServices>(); // Configure storage services.AddSingleton <IStorage>(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton <UserState>(); services.AddSingleton <ConversationState>(); services.AddSingleton(sp => { var userState = sp.GetService <UserState>(); var conversationState = sp.GetService <ConversationState>(); return(new BotStateSet(userState, conversationState)); }); // Register dialogs services.AddTransient <CancelDialog>(); services.AddTransient <EscalateDialog>(); services.AddTransient <MainDialog>(); services.AddTransient <OnboardingDialog>(); // Register skill dialogs services.AddTransient(sp => { var userState = sp.GetService <UserState>(); var skillDialogs = new List <SkillDialog>(); foreach (var skill in settings.Skills) { var authDialog = BuildAuthDialog(skill, settings, appCredentials); var credentials = new MicrosoftAppCredentialsEx(settings.MicrosoftAppId, settings.MicrosoftAppPassword, skill.MSAappId); skillDialogs.Add(new SkillDialog(skill, credentials, telemetryClient, userState, authDialog)); } return(skillDialogs); }); // Configure adapters // DefaultAdapter is for all regular channels that use Http transport services.AddSingleton <IBotFrameworkHttpAdapter, DefaultAdapter>(); // DefaultWebSocketAdapter is for directline speech channel // This adapter implementation is currently a workaround as // later on we'll have a WebSocketEnabledHttpAdapter implementation that handles // both Http for regular channels and websocket for directline speech channel services.AddSingleton <WebSocketEnabledHttpAdapter, DefaultWebSocketAdapter>(); // Configure bot services.AddTransient <IBot, DialogBot <MainDialog> >(); }
public RouteDialog( BotSettings settings, BotServices services, ResponseManager responseManager, ConversationState conversationState, IServiceManager serviceManager, IBotTelemetryClient telemetryClient, IHttpContextAccessor httpContext) : base(nameof(RouteDialog), settings, services, responseManager, conversationState, serviceManager, telemetryClient, httpContext) { TelemetryClient = telemetryClient; var checkCurrentLocation = new WaterfallStep[] { CheckForCurrentCoordinatesBeforeFindPointOfInterestBeforeRoute, ConfirmCurrentLocation, ProcessCurrentLocationSelection, RouteToFindPointOfInterestBeforeRouteDialog }; var checkForActiveRouteAndLocation = new WaterfallStep[] { CheckIfActiveRouteExists, CheckIfFoundLocationExists, CheckIfDestinationExists, }; var findRouteToActiveLocation = new WaterfallStep[] { GetRoutesToDestination, ResponseToStartRoutePrompt, }; var findAlongRoute = new WaterfallStep[] { GetPointOfInterestLocations, ProcessPointOfInterestSelection, GetRoutesToDestination, ResponseToStartRoutePrompt, }; var findPointOfInterest = new WaterfallStep[] { GetPointOfInterestLocations, ProcessPointOfInterestSelection, GetRoutesToDestination, ResponseToStartRoutePrompt, }; // Define the conversation flow using a waterfall model. AddDialog(new WaterfallDialog(Actions.CheckForCurrentLocation, checkCurrentLocation) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.GetActiveRoute, checkForActiveRouteAndLocation) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.FindAlongRoute, findAlongRoute) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.FindRouteToActiveLocation, findRouteToActiveLocation) { TelemetryClient = telemetryClient }); AddDialog(new WaterfallDialog(Actions.FindPointOfInterestBeforeRoute, findPointOfInterest) { TelemetryClient = telemetryClient }); // Set starting dialog for component InitialDialogId = Actions.GetActiveRoute; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Configure MVC services.AddControllers(); // Load settings var settings = new BotSettings(); Configuration.Bind(settings); services.AddSingleton(settings); // Configure credentials services.AddSingleton <ICredentialProvider, ConfigurationCredentialProvider>(); // Configure telemetry services.AddApplicationInsightsTelemetry(); services.AddSingleton <IBotTelemetryClient, BotTelemetryClient>(); services.AddSingleton <ITelemetryInitializer, OperationCorrelationTelemetryInitializer>(); services.AddSingleton <ITelemetryInitializer, TelemetryBotIdInitializer>(); services.AddSingleton <TelemetryInitializerMiddleware>(); services.AddSingleton <TelemetryLoggerMiddleware>(); // Configure bot services services.AddSingleton <BotServices>(); // Configure storage // Uncomment the following line for local development without Cosmos Db // services.AddSingleton<IStorage, MemoryStorage>(); services.AddSingleton <IStorage>(new CosmosDbStorage(settings.CosmosDb)); services.AddSingleton <UserState>(); services.AddSingleton <ConversationState>(); // Configure localized responses var localizedTemplates = new Dictionary <string, List <string> >(); var templateFiles = new List <string>() { "MainResponses", "OnboardingResponses" }; var supportedLocales = new List <string>() { "en-us", "de-de", "es-es", "fr-fr", "it-it", "zh-cn" }; foreach (var locale in supportedLocales) { var localeTemplateFiles = new List <string>(); foreach (var template in templateFiles) { // LG template for default locale should not include locale in file extension. if (locale.Equals(settings.DefaultLocale ?? "en-us")) { localeTemplateFiles.Add(Path.Combine(".", "Responses", $"{template}.lg")); } else { localeTemplateFiles.Add(Path.Combine(".", "Responses", $"{template}.{locale}.lg")); } } localizedTemplates.Add(locale, localeTemplateFiles); } services.AddSingleton(new LocaleTemplateEngineManager(localizedTemplates, settings.DefaultLocale ?? "en-us")); // Register dialogs services.AddTransient <MainDialog>(); services.AddTransient <SwitchSkillDialog>(); services.AddTransient <OnboardingDialog>(); var appCredentials = new MicrosoftAppCredentials(settings.MicrosoftAppId, settings.MicrosoftAppPassword); // Register skill dialogs foreach (var skill in settings.Skills) { var authDialog = BuildAuthDialog(skill, settings, appCredentials); var credentials = new MicrosoftAppCredentialsEx(settings.MicrosoftAppId, settings.MicrosoftAppPassword, skill.MSAappId); services.AddTransient(sp => { var userState = sp.GetService <UserState>(); var telemetryClient = sp.GetService <IBotTelemetryClient>(); return(new SkillDialog(skill, credentials, telemetryClient, userState, authDialog)); }); } // IBotFrameworkHttpAdapter now supports both http and websocket transport services.AddSingleton <IBotFrameworkHttpAdapter, DefaultAdapter>(); // Configure bot services.AddTransient <IBot, DefaultActivityHandler <MainDialog> >(); }
public VehicleSettingsDialog( BotSettings settings, BotServices services, ResponseManager responseManager, ConversationState conversationState, IBotTelemetryClient telemetryClient, IHttpContextAccessor httpContext) : base(nameof(VehicleSettingsDialog), settings, services, responseManager, conversationState, telemetryClient) { TelemetryClient = telemetryClient; // Initialise supporting LUIS models for followup questions vehicleSettingNameSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_name"]; vehicleSettingValueSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_value"]; // Initialise supporting LUIS models for followup questions vehicleSettingNameSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_name"]; vehicleSettingValueSelectionLuisRecognizer = services.CognitiveModelSets["en"].LuisServices["settings_value"]; // Supporting setting files are stored as embeddded resources var resourceAssembly = typeof(VehicleSettingsDialog).Assembly; var settingFile = resourceAssembly .GetManifestResourceNames() .Where(x => x.Contains(AvailableSettingsFileName)) .First(); var alternativeSettingFileName = resourceAssembly .GetManifestResourceNames() .Where(x => x.Contains(AlternativeSettingsFileName)) .First(); if (string.IsNullOrEmpty(settingFile) || string.IsNullOrEmpty(alternativeSettingFileName)) { throw new FileNotFoundException($"Unable to find Available Setting and/or Alternative Names files in \"{resourceAssembly.FullName}\" assembly."); } settingList = new SettingList(resourceAssembly, settingFile, alternativeSettingFileName); settingFilter = new SettingFilter(settingList); // Setting Change waterfall var processVehicleSettingChangeWaterfall = new WaterfallStep[] { ProcessSetting, ProcessVehicleSettingsChange, ProcessChange, SendChange }; AddDialog(new WaterfallDialog(Actions.ProcessVehicleSettingChange, processVehicleSettingChangeWaterfall) { TelemetryClient = telemetryClient }); // Prompts AddDialog(new ChoicePrompt(Actions.SettingNameSelectionPrompt, SettingNameSelectionValidator, Culture.English) { Style = ListStyle.Auto, ChoiceOptions = new ChoiceFactoryOptions { InlineSeparator = string.Empty, InlineOr = string.Empty, InlineOrMore = string.Empty, IncludeNumbers = true } }); AddDialog(new ChoicePrompt(Actions.SettingValueSelectionPrompt, SettingValueSelectionValidator, Culture.English) { Style = ListStyle.Auto, ChoiceOptions = new ChoiceFactoryOptions { InlineSeparator = string.Empty, InlineOr = string.Empty, InlineOrMore = string.Empty, IncludeNumbers = true } }); AddDialog(new ConfirmPrompt(Actions.SettingConfirmationPrompt)); // Set starting dialog for component InitialDialogId = Actions.ProcessVehicleSettingChange; // Used to resolve image paths (local or hosted) _httpContext = httpContext; }
public void LoadSettings(string path) { if (Settings != null) throw new Exception("Settings already loaded"); Settings = new BotSettings(path); Settings.Load(); }
public BotService(IOptions <BotSettings> botSettings) { this.botSettings = botSettings.Value; this.Client = new TelegramBotClient(this.botSettings.BotToken); }
public BotBase(BotSettings settings) { _settings = settings; }
public FileService(IOptions <BotSettings> botSettings) { _botSettings = botSettings.Value; }