fixed voting reward, message, logging

This commit is contained in:
Toastie 2025-03-29 21:15:27 +13:00
parent d414ecda2d
commit aaf8522987
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7

View file

@ -8,6 +8,7 @@ namespace EllieBot.Modules.Gambling.Services;
public class VoteRewardService(
ShardData shardData,
GamblingConfigService gcs,
GamblingService gs,
CurrencyService cs,
IBotCache cache,
DiscordSocketClient client,
@ -64,8 +65,12 @@ public class VoteRewardService(
var key = VoteKey(userId);
if (!await cache.AddAsync(key, DateTime.UtcNow, expiry: TimeSpan.FromHours(6)))
{
Log.Information("User {UserId} has already voted in the last 6 hours", userId);
return;
}
(reward, var msg) = await gs.GetAmountAndMessage(userId, reward);
await cs.AddAsync(userId, reward, new("vote", requestType.ToString()));
_ = Task.Run(async () =>
@ -75,7 +80,7 @@ public class VoteRewardService(
var user = await client.GetUserAsync(userId);
await sender.Response(user)
.Confirm(strs.vote_reward(N(reward)))
.Confirm(strs.vote_reward(N(reward)) + "\n\n" + msg)
.SendAsync();
}
catch (Exception ex)