Fixed timely on different shards

.race will now have 82-94% payout rate based on the number of players playign (1-12, x0.01 per player). Any player over 12 won't increase payout
This commit is contained in:
Toastie 2024-11-05 21:11:30 +13:00
parent e7cfd3a752
commit fae15a9e0a
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
5 changed files with 69 additions and 25 deletions
src/EllieBot/Modules/Gambling

View file

@ -291,7 +291,6 @@ public partial class Gambling : GamblingModule<GamblingService>
{
_ = captcha.DeleteAsync();
}
}
await ClaimTimely();
@ -326,22 +325,19 @@ public partial class Gambling : GamblingModule<GamblingService>
{
try
{
var guild = await ((IDiscordClient)_client).GetGuildAsync(gid);
if (guild is null)
return null;
var user = await guild.GetUserAsync(ctx.User.Id);
return user;
var guild = await _client.Rest.GetGuildAsync(gid, false);
var user = await _client.Rest.GetGuildUserAsync(gid, ctx.User.Id);
return (guild, user);
}
catch
{
return null;
return default;
}
})
.WhenAll();
var boostGuildUser = guildUsers.FirstOrDefault(x => x?.PremiumSince is not null);
var booster = boostGuildUser is not null;
var userInfo = guildUsers.FirstOrDefault(x => x.user?.PremiumSince is not null);
var booster = userInfo != default;
if (booster)
val += Config.BoostBonus.BaseTimelyBonus;
@ -360,7 +356,7 @@ public partial class Gambling : GamblingModule<GamblingService>
{
var msg = GetText(strs.timely(N(val), period))
+ "\n\n"
+ $"*+{N(Config.BoostBonus.BaseTimelyBonus)} bonus for boosting {boostGuildUser.Guild}!*";
+ $"*+{N(Config.BoostBonus.BaseTimelyBonus)} bonus for boosting {userInfo.guild}!*";
await Response().Confirm(msg).Interaction(inter).SendAsync();
}