More cleanup and restructuring, nothing of note

This commit is contained in:
Kwoth
2022-01-02 04:16:34 +01:00
parent 3428073208
commit 25f249ab5e
5 changed files with 5 additions and 10 deletions

View File

@@ -15,21 +15,17 @@ public class VoteRewardService : INService, IReadyExecutor
{ {
private readonly DiscordSocketClient _client; private readonly DiscordSocketClient _client;
private readonly IBotCredentials _creds; private readonly IBotCredentials _creds;
private readonly IHttpClientFactory _httpClientFactory;
private readonly ICurrencyService _currencyService; private readonly ICurrencyService _currencyService;
private readonly GamblingConfigService _gamb; private readonly GamblingConfigService _gamb;
private HttpClient _http;
public VoteRewardService( public VoteRewardService(
DiscordSocketClient client, DiscordSocketClient client,
IBotCredentials creds, IBotCredentials creds,
IHttpClientFactory httpClientFactory,
ICurrencyService currencyService, ICurrencyService currencyService,
GamblingConfigService gamb) GamblingConfigService gamb)
{ {
_client = client; _client = client;
_creds = creds; _creds = creds;
_httpClientFactory = httpClientFactory;
_currencyService = currencyService; _currencyService = currencyService;
_gamb = gamb; _gamb = gamb;
} }
@@ -39,7 +35,7 @@ public class VoteRewardService : INService, IReadyExecutor
if (_client.ShardId != 0) if (_client.ShardId != 0)
return; return;
_http = new(new HttpClientHandler var http = new HttpClient(new HttpClientHandler
{ {
AllowAutoRedirect = false, ServerCertificateCustomValidationCallback = delegate { return true; } AllowAutoRedirect = false, ServerCertificateCustomValidationCallback = delegate { return true; }
}); });
@@ -55,9 +51,9 @@ public class VoteRewardService : INService, IReadyExecutor
{ {
if (!string.IsNullOrWhiteSpace(topggKey) && !string.IsNullOrWhiteSpace(topggServiceUrl)) if (!string.IsNullOrWhiteSpace(topggKey) && !string.IsNullOrWhiteSpace(topggServiceUrl))
{ {
_http.DefaultRequestHeaders.Authorization = new(topggKey); http.DefaultRequestHeaders.Authorization = new(topggKey);
var uri = new Uri(new(topggServiceUrl), "topgg/new"); var uri = new Uri(new(topggServiceUrl), "topgg/new");
var res = await _http.GetStringAsync(uri); var res = await http.GetStringAsync(uri);
var data = JsonSerializer.Deserialize<List<VoteModel>>(res); var data = JsonSerializer.Deserialize<List<VoteModel>>(res);
if (data is { Count: > 0 }) if (data is { Count: > 0 })
@@ -85,8 +81,8 @@ public class VoteRewardService : INService, IReadyExecutor
{ {
if (!string.IsNullOrWhiteSpace(discordsKey) && !string.IsNullOrWhiteSpace(discordsServiceUrl)) if (!string.IsNullOrWhiteSpace(discordsKey) && !string.IsNullOrWhiteSpace(discordsServiceUrl))
{ {
_http.DefaultRequestHeaders.Authorization = new(discordsKey); http.DefaultRequestHeaders.Authorization = new(discordsKey);
var res = await _http.GetStringAsync(new Uri(new(discordsServiceUrl), "discords/new")); var res = await http.GetStringAsync(new Uri(new(discordsServiceUrl), "discords/new"));
var data = JsonSerializer.Deserialize<List<VoteModel>>(res); var data = JsonSerializer.Deserialize<List<VoteModel>>(res);
if (data is { Count: > 0 }) if (data is { Count: > 0 })

View File

@@ -112,7 +112,6 @@ delcustreact:
- dcr - dcr
- exprdel - exprdel
- exd - exd
- exd
crclear: crclear:
- crclear - crclear
- exclear - exclear