timely fixes

This commit is contained in:
Toastie 2024-11-05 20:20:44 +13:00
parent 9f44d6a854
commit c5aeb43046
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
3 changed files with 21 additions and 10 deletions

View file

@ -215,6 +215,7 @@ public partial class Gambling : GamblingModule<GamblingService>
});
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task Timely()
{
var val = Config.Timely.Amount;
@ -259,10 +260,24 @@ public partial class Gambling : GamblingModule<GamblingService>
var val = Config.Timely.Amount;
var guildUsers = await (Config.BoostBonus
.GuildIds
?? new())
.Select(x => ((IGuild)_client.GetGuild(x))?.GetUserAsync(ctx.User.Id))
var boostGuilds = Config.BoostBonus.GuildIds ?? new();
var guildUsers = await boostGuilds
.Select(async gid =>
{
try
{
var guild = await ((IDiscordClient)_client).GetGuildAsync(gid);
if (guild is null)
return null;
var user = await guild.GetUserAsync(ctx.User.Id);
return user;
}
catch
{
return null;
}
})
.WhenAll();
var boostGuildUser = guildUsers.FirstOrDefault(x => x?.PremiumSince is not null);

View file

@ -425,10 +425,7 @@ public sealed partial class BotCutConfig
public sealed partial class BoostBonusConfig
{
[Comment("Users will receive a bonus if they boost any of these servers")]
public List<ulong> GuildIds { get; set; } =
[
117523346618318850
];
public List<ulong> GuildIds { get; set; } = new();
[Comment("This bonus will be added before any other multiplier is applied to the .timely command")]

View file

@ -276,7 +276,6 @@ slots:
# Bonus config for server boosts
boostBonus:
# Users will receive a bonus if they boost any of these servers
guildIds:
- 117523346618318850
guildIds: []
# This bonus will be added before any other multiplier is applied to the .timely command
baseTimelyBonus: 50