diff --git a/src/NadekoBot/Modules/Utility/Commands/PatreonCommands.cs b/src/NadekoBot/Modules/Utility/Commands/PatreonCommands.cs index 924c720f..583b1f5b 100644 --- a/src/NadekoBot/Modules/Utility/Commands/PatreonCommands.cs +++ b/src/NadekoBot/Modules/Utility/Commands/PatreonCommands.cs @@ -28,6 +28,16 @@ namespace NadekoBot.Modules.Utility { patreon = PatreonThingy.Instance; } + + [NadekoCommand, Usage, Description, Aliases] + [OwnerOnly] + public async Task PatreonRewardsReload() + { + await patreon.LoadPledges().ConfigureAwait(false); + + await Context.Channel.SendConfirmAsync("👌").ConfigureAwait(false); + } + [NadekoCommand, Usage, Description, Aliases] public async Task ClaimPatreonRewards() { @@ -53,13 +63,15 @@ namespace NadekoBot.Modules.Utility await ReplyConfirmLocalized("clpa_success", amount + NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false); return; } + var rem = (patreon.Interval - (DateTime.UtcNow - patreon.LastUpdate)); var helpcmd = Format.Code(NadekoBot.ModulePrefixes[typeof(Help.Help).Name] + "donate"); await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithDescription(GetText("clpa_fail")) .AddField(efb => efb.WithName(GetText("clpa_fail_already_title")).WithValue(GetText("clpa_fail_already"))) .AddField(efb => efb.WithName(GetText("clpa_fail_wait_title")).WithValue(GetText("clpa_fail_wait"))) .AddField(efb => efb.WithName(GetText("clpa_fail_conn_title")).WithValue(GetText("clpa_fail_conn"))) - .AddField(efb => efb.WithName(GetText("clpa_fail_sup_title")).WithValue(GetText("clpa_fail_sup", helpcmd)))) + .AddField(efb => efb.WithName(GetText("clpa_fail_sup_title")).WithValue(GetText("clpa_fail_sup", helpcmd))) + .WithFooter(efb => efb.WithText(GetText("clpa_next_update", rem)))) .ConfigureAwait(false); } } @@ -72,21 +84,25 @@ namespace NadekoBot.Modules.Utility private readonly SemaphoreSlim getPledgesLocker = new SemaphoreSlim(1, 1); public ImmutableArray Pledges { get; private set; } + public DateTime LastUpdate { get; private set; } = DateTime.UtcNow; private readonly Timer update; private readonly SemaphoreSlim claimLockJustInCase = new SemaphoreSlim(1, 1); private readonly Logger _log; + public readonly TimeSpan Interval = TimeSpan.FromHours(1); + private PatreonThingy() { if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.PatreonAccessToken)) return; _log = LogManager.GetCurrentClassLogger(); - update = new Timer(async (_) => await LoadPledges(), null, TimeSpan.Zero, TimeSpan.FromHours(3)); + update = new Timer(async (_) => await LoadPledges(), null, TimeSpan.Zero, Interval); } public async Task LoadPledges() { + LastUpdate = DateTime.UtcNow; await getPledgesLocker.WaitAsync(1000).ConfigureAwait(false); try { diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 1a943af1..cb6958bb 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -2596,10 +2596,10 @@ listquotes liqu - `{0}liqu` or `{0}liqu 3` + Lists all quotes on the server ordered alphabetically. 15 Per page. - Lists all quotes on the server ordered alphabetically. 15 Per page. + `{0}liqu` or `{0}liqu 3` typedel @@ -3211,7 +3211,7 @@ Toggles whether the response message of the custom reaction will be sent as a direct message. - `{0}crad 44` + `{0}crdm 44` aliaslist cmdmaplist aliases @@ -3334,7 +3334,7 @@ clparew - Claim patreon rewards. If you're subscribed to bot owner's patreon you can user this command to claim your rewards - assuming bot owner did setup has their patreon key. + Claim patreon rewards. If you're subscribed to bot owner's patreon you can use this command to claim your rewards - assuming bot owner did setup has their patreon key. `{0}clparew` @@ -3366,4 +3366,37 @@ `{0}time London, UK` + + parewrel + + + Forces the update of the list of patrons who are eligible for the reward. + + + `{0}parewrel` + + + shopadd + + + Adds an item to the shop by specifying type price and name. + + + `{0}shopadd role 1000 Rich` + + + shoprem shoprm + + + Removes an item from the shop by its color. + + + shop + + + Lists this server's administrators' shop. Paginated. + + + `{0}shop` or `{0}shop 2` + \ No newline at end of file