public WarcraftLogs(IServiceProvider services) { _logger = services.GetRequiredService <ILogger <WarcraftLogs> >(); _client = services.GetRequiredService <DiscordShardedClient>(); _config = services.GetRequiredService <IConfigurationRoot>(); _wowApi = services.GetRequiredService <WowApi>(); try { _api = new ApiRequestorThrottle(_config["WarcraftLogsApiCmd"], baseUrl: "https://www.warcraftlogs.com:443/v1/", services.GetRequiredService <IHttpClientFactory>().CreateClient()); _apiCmd = new ApiRequestorThrottle(_config["WarcraftLogsApiCmd"], baseUrl: "https://www.warcraftlogs.com:443/v1/", services.GetRequiredService <IHttpClientFactory>().CreateClient()); _apiClassic = new ApiRequestorThrottle(_config["WarcraftLogsApi"], baseUrl: "https://classic.warcraftlogs.com:443/v1/", services.GetRequiredService <IHttpClientFactory>().CreateClient()); _apiClassicCmd = new ApiRequestorThrottle(_config["WarcraftLogsApiCmd"], baseUrl: "https://classic.warcraftlogs.com:443/v1/", services.GetRequiredService <IHttpClientFactory>().CreateClient()); CharClasses = this.GetCharClasses().Result; Zones = this.GetZones().Result; ClassicZones = this.GetClassicZones().Result; _currentRaidTier = this.SetCurrentTier(); this.MigrateOldReports(); this.StartTimer(); } catch (Exception ex) { _logger.LogError($"Error performing class setup for WCL: {ex.Message}"); } }
public WarcraftLogs(IConfigurationRoot config, DiscordSocketClient client, bool throttle = true) { _client = client; _config = config; try { _api = throttle ? new ApiRequestorThrottle(_config["WarcraftLogsApi"]) : new WclApiRequestor(_config["WarcraftLogsApi"]); _apiCmd = throttle ? new ApiRequestorThrottle(_config["WarcraftLogsApiCmd"]) : new WclApiRequestor(_config["WarcraftLogsApiCmd"]); CharClasses = this.GetCharClasses().Result; Zones = this.GetZones().Result; this.StartTimer(); } catch (Exception ex) { System.Console.WriteLine($"Error performing class setup for WCL: {ex.Message}"); } }