Made .timely use timestamp tags and fixed a bug

This commit is contained in:
Kwoth
2022-06-17 04:37:08 +02:00
parent 6c58a6a72d
commit 3d3dc532dc
3 changed files with 6 additions and 4 deletions

View File

@@ -126,13 +126,15 @@ public partial class Gambling : GamblingModule<GamblingService>
if (_cache.AddTimelyClaim(ctx.User.Id, period) is { } rem) if (_cache.AddTimelyClaim(ctx.User.Id, period) is { } rem)
{ {
await ReplyErrorLocalizedAsync(strs.timely_already_claimed(rem.ToString(@"dd\d\ hh\h\ mm\m\ ss\s"))); var now = DateTime.UtcNow;
var relativeTag = TimestampTag.FromDateTime(now.Add(rem), TimestampTagStyles.Relative);
await ReplyErrorLocalizedAsync(strs.timely_already_claimed(relativeTag));
return; return;
} }
var result = await _ps.TryGetFeatureLimitAsync(_timelyKey, ctx.User.Id, 0); var result = await _ps.TryGetFeatureLimitAsync(_timelyKey, ctx.User.Id, 0);
val = (int)(val * (1 + (result.Quota * 0.01f))); val = (int)(val * (1 + (result.Quota! * 0.01f)));
await _cs.AddAsync(ctx.User.Id, val, new("timely", "claim")); await _cs.AddAsync(ctx.User.Id, val, new("timely", "claim"));

View File

@@ -697,7 +697,7 @@ public sealed class PatronageService
return new() return new()
{ {
Name = key.PrettyName, Name = key.PrettyName,
Quota = default, Quota = defaultValue,
IsPatronLimit = false IsPatronLimit = false
}; };

View File

@@ -878,7 +878,7 @@
"autodc_enable": "I will disconnect from the voice channel when there are no more tracks to play.", "autodc_enable": "I will disconnect from the voice channel when there are no more tracks to play.",
"autodc_disable": "I will no longer disconnect from the voice channel when there are no more tracks to play.", "autodc_disable": "I will no longer disconnect from the voice channel when there are no more tracks to play.",
"timely_none": "Bot owner didn't specify a timely reward.", "timely_none": "Bot owner didn't specify a timely reward.",
"timely_already_claimed": "You've already claimed your timely reward. You can get it again in {0}.", "timely_already_claimed": "You've already claimed your timely reward. You can get it again {0}.",
"timely": "You've claimed your {0}. You can claim again in {1}h", "timely": "You've claimed your {0}. You can claim again in {1}h",
"timely_set": "Users will be able to claim {0} every {1}h", "timely_set": "Users will be able to claim {0} every {1}h",
"timely_set_none": "Users will not be able to claim any timely currency.", "timely_set_none": "Users will not be able to claim any timely currency.",