patreon error fix

This commit is contained in:
Kwoth 2017-04-06 19:48:21 +02:00
parent 349f76af85
commit b09cd7ea43

View File

@ -13,6 +13,7 @@ using NadekoBot.Services;
using NadekoBot.Services.Database.Models;
using NadekoBot.Extensions;
using Discord;
using NLog;
namespace NadekoBot.Modules.Utility
{
@ -74,11 +75,13 @@ namespace NadekoBot.Modules.Utility
private readonly Timer update;
private readonly SemaphoreSlim claimLockJustInCase = new SemaphoreSlim(1, 1);
private readonly Logger _log;
private PatreonThingy()
{
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.PatreonAccessToken))
return;
_log = LogManager.GetCurrentClassLogger();
update = new Timer(async (_) => await LoadPledges(), null, TimeSpan.Zero, TimeSpan.FromHours(3));
}
@ -119,6 +122,10 @@ namespace NadekoBot.Modules.Utility
Reward = x,
}).ToImmutableArray();
}
catch (Exception ex)
{
_log.Warn(ex);
}
finally
{
var _ = Task.Run(async () =>