public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ITelegramClient client, ILogger <Startup> logger) { app.UseSpaStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); try { client.Initialize(); logger.LogInformation("Telegram client started."); } catch { logger.LogInformation("Telegram client could not start."); } }
public async Task <AboutTelegramBot> UpdateTelegramOptions(TelegramOptions options) { //TODO: Don't check unchanged settings //TODO: Answer more descriptive messages //TODO: Use Uri instead of string concatenation _updater.Save(options); _bot.Initialize(); await _bot.SendMessage(options.AdminChat, "Hello Francis administrator, if you received this message, this means your configuration is valid."); if (!Directory.Exists(options.MediaLocation)) { throw new ArgumentException("Invalid media location"); } return(await _bot.Client.GetMeAsync()); }