protected override async Task ExecuteAsync(CancellationToken stoppingToken) { Log.Information("Runnin started"); try { var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var preferencesFilePath = Path.Combine(currentDirectory, "Preferences.txt"); var serializedTags = File.ReadAllText(preferencesFilePath); var tags = JsonConvert.DeserializeObject <List <Tag> >(serializedTags); await BotRunner.RunBotForTagsAsync(tags, new LoggerWrapper()); } catch (Exception ex) { Log.Error(ex, "Exception occured when starting the bot. Attempting to stop."); throw; } }