fixing protection init and plantpick issues

This commit is contained in:
Toastie 2025-03-14 15:57:52 +13:00
parent 1cd02222b9
commit 8fa6b0c999
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 5 additions and 10 deletions
src/EllieBot/Modules
Administration/Protection
Gambling/PlantPick

View file

@ -503,8 +503,9 @@ public class ProtectionService : IReadyExecutor, IEService
await using var uow = _db.GetDbContext();
var configs = await uow.GetTable<AntiAltSetting>()
.AsNoTracking()
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
.ToListAsyncLinqToDB();
.ToListAsyncEF();
foreach (var config in configs)
_antiAltGuilds[config.GuildId] = new(config);
@ -522,8 +523,9 @@ public class ProtectionService : IReadyExecutor, IEService
}
var spamConfigs = await uow.GetTable<AntiSpamSetting>()
.AsNoTracking()
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
.ToListAsyncLinqToDB();
.ToListAsyncEF();
foreach (var config in spamConfigs)
{

View file

@ -25,13 +25,11 @@ public class PlantPickService : IEService, IExecNoCommand, IReadyExecutor
private readonly FontProvider _fonts;
private readonly ICurrencyService _cs;
private readonly CommandHandler _cmdHandler;
private readonly EllieRandom _rng;
private readonly DiscordSocketClient _client;
private readonly GamblingConfigService _gss;
private readonly GamblingService _gs;
private ConcurrentHashSet<ulong> _generationChannels;
private readonly SemaphoreSlim _pickLock = new(1, 1);
private ConcurrentHashSet<ulong> _generationChannels = [];
public PlantPickService(
DbService db,
@ -50,13 +48,9 @@ public class PlantPickService : IEService, IExecNoCommand, IReadyExecutor
_fonts = fonts;
_cs = cs;
_cmdHandler = cmdHandler;
_rng = new();
_client = client;
_gss = gss;
_gs = gs;
using var uow = db.GetDbContext();
var guildIds = client.Guilds.Select(x => x.Id).ToList();
}
public Task ExecOnNoCommandAsync(IGuild guild, IUserMessage msg)
@ -416,7 +410,6 @@ public class PlantPickService : IEService, IExecNoCommand, IReadyExecutor
public async Task OnReadyAsync()
{
await using var uow = _db.GetDbContext();
_generationChannels = (await uow.GetTable<GCChannelId>()
.Select(x => x.ChannelId)