mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Many IDisposable fixes. GlobalNadeko won't have file watchers for creds. Wallet simplified
This commit is contained in:
@@ -84,12 +84,13 @@ public class PatreonRewardsService : INService, IReadyExecutor
|
||||
try
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var res = await http.PostAsync("https://www.patreon.com/api/oauth2/token"
|
||||
using var content = new StringContent(string.Empty);
|
||||
using var res = await http.PostAsync("https://www.patreon.com/api/oauth2/token"
|
||||
+ "?grant_type=refresh_token"
|
||||
+ $"&refresh_token={creds.Patreon.RefreshToken}"
|
||||
+ $"&client_id={creds.Patreon.ClientId}"
|
||||
+ $"&client_secret={creds.Patreon.ClientSecret}",
|
||||
new StringContent(string.Empty));
|
||||
content);
|
||||
|
||||
res.EnsureSuccessStatusCode();
|
||||
|
||||
|
@@ -27,7 +27,7 @@ public sealed class RepeaterService : IReadyExecutor, INService
|
||||
_creds = creds;
|
||||
_client = client;
|
||||
|
||||
var uow = _db.GetDbContext();
|
||||
using var uow = _db.GetDbContext();
|
||||
var shardRepeaters = uow.Set<Repeater>()
|
||||
.Where(x => (int)(x.GuildId / Math.Pow(2, 22)) % _creds.TotalShards
|
||||
== _client.ShardId)
|
||||
|
@@ -336,7 +336,7 @@ public partial class Utility : NadekoModule
|
||||
return;
|
||||
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var res = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
||||
using var res = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
||||
if (!res.IsImage() || res.GetImageSize() is null or > 262_144)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync(strs.invalid_emoji_link);
|
||||
|
Reference in New Issue
Block a user