fixing protection init and plantpick issues
This commit is contained in:
parent
1cd02222b9
commit
8fa6b0c999
2 changed files with 5 additions and 10 deletions
src/EllieBot/Modules
|
@ -503,8 +503,9 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
|
|
||||||
var configs = await uow.GetTable<AntiAltSetting>()
|
var configs = await uow.GetTable<AntiAltSetting>()
|
||||||
|
.AsNoTracking()
|
||||||
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
|
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
|
||||||
.ToListAsyncLinqToDB();
|
.ToListAsyncEF();
|
||||||
|
|
||||||
foreach (var config in configs)
|
foreach (var config in configs)
|
||||||
_antiAltGuilds[config.GuildId] = new(config);
|
_antiAltGuilds[config.GuildId] = new(config);
|
||||||
|
@ -522,8 +523,9 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
}
|
}
|
||||||
|
|
||||||
var spamConfigs = await uow.GetTable<AntiSpamSetting>()
|
var spamConfigs = await uow.GetTable<AntiSpamSetting>()
|
||||||
|
.AsNoTracking()
|
||||||
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
|
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
|
||||||
.ToListAsyncLinqToDB();
|
.ToListAsyncEF();
|
||||||
|
|
||||||
foreach (var config in spamConfigs)
|
foreach (var config in spamConfigs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,13 +25,11 @@ public class PlantPickService : IEService, IExecNoCommand, IReadyExecutor
|
||||||
private readonly FontProvider _fonts;
|
private readonly FontProvider _fonts;
|
||||||
private readonly ICurrencyService _cs;
|
private readonly ICurrencyService _cs;
|
||||||
private readonly CommandHandler _cmdHandler;
|
private readonly CommandHandler _cmdHandler;
|
||||||
private readonly EllieRandom _rng;
|
|
||||||
private readonly DiscordSocketClient _client;
|
private readonly DiscordSocketClient _client;
|
||||||
private readonly GamblingConfigService _gss;
|
private readonly GamblingConfigService _gss;
|
||||||
private readonly GamblingService _gs;
|
private readonly GamblingService _gs;
|
||||||
|
|
||||||
private ConcurrentHashSet<ulong> _generationChannels;
|
private ConcurrentHashSet<ulong> _generationChannels = [];
|
||||||
private readonly SemaphoreSlim _pickLock = new(1, 1);
|
|
||||||
|
|
||||||
public PlantPickService(
|
public PlantPickService(
|
||||||
DbService db,
|
DbService db,
|
||||||
|
@ -50,13 +48,9 @@ public class PlantPickService : IEService, IExecNoCommand, IReadyExecutor
|
||||||
_fonts = fonts;
|
_fonts = fonts;
|
||||||
_cs = cs;
|
_cs = cs;
|
||||||
_cmdHandler = cmdHandler;
|
_cmdHandler = cmdHandler;
|
||||||
_rng = new();
|
|
||||||
_client = client;
|
_client = client;
|
||||||
_gss = gss;
|
_gss = gss;
|
||||||
_gs = gs;
|
_gs = gs;
|
||||||
|
|
||||||
using var uow = db.GetDbContext();
|
|
||||||
var guildIds = client.Guilds.Select(x => x.Id).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task ExecOnNoCommandAsync(IGuild guild, IUserMessage msg)
|
public Task ExecOnNoCommandAsync(IGuild guild, IUserMessage msg)
|
||||||
|
@ -416,7 +410,6 @@ public class PlantPickService : IEService, IExecNoCommand, IReadyExecutor
|
||||||
|
|
||||||
public async Task OnReadyAsync()
|
public async Task OnReadyAsync()
|
||||||
{
|
{
|
||||||
|
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
_generationChannels = (await uow.GetTable<GCChannelId>()
|
_generationChannels = (await uow.GetTable<GCChannelId>()
|
||||||
.Select(x => x.ChannelId)
|
.Select(x => x.ChannelId)
|
||||||
|
|
Loading…
Add table
Reference in a new issue