undo the antialt query change now that mapping should be correct
This commit is contained in:
parent
947b3794e9
commit
f2820c980e
1 changed files with 54 additions and 61 deletions
|
@ -27,7 +27,6 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
private readonly UserPunishService _punishService;
|
private readonly UserPunishService _punishService;
|
||||||
private readonly INotifySubscriber _notifySub;
|
private readonly INotifySubscriber _notifySub;
|
||||||
private readonly ShardData _shardData;
|
private readonly ShardData _shardData;
|
||||||
|
|
||||||
private readonly Channel<PunishQueueItem> _punishUserQueue =
|
private readonly Channel<PunishQueueItem> _punishUserQueue =
|
||||||
Channel.CreateUnbounded<PunishQueueItem>(new()
|
Channel.CreateUnbounded<PunishQueueItem>(new()
|
||||||
{
|
{
|
||||||
|
@ -276,25 +275,23 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
|
|
||||||
await uow.GetTable<AntiRaidSetting>()
|
await uow.GetTable<AntiRaidSetting>()
|
||||||
.InsertOrUpdateAsync(() => new()
|
.InsertOrUpdateAsync(() => new()
|
||||||
{
|
{
|
||||||
GuildId = guildId,
|
GuildId = guildId,
|
||||||
Action = action,
|
Action = action,
|
||||||
Seconds = seconds,
|
Seconds = seconds,
|
||||||
UserThreshold = userThreshold,
|
UserThreshold = userThreshold,
|
||||||
PunishDuration = minutesDuration
|
PunishDuration = minutesDuration
|
||||||
},
|
}, _ => new()
|
||||||
_ => new()
|
{
|
||||||
{
|
Action = action,
|
||||||
Action = action,
|
Seconds = seconds,
|
||||||
Seconds = seconds,
|
UserThreshold = userThreshold,
|
||||||
UserThreshold = userThreshold,
|
PunishDuration = minutesDuration
|
||||||
PunishDuration = minutesDuration
|
}, () => new()
|
||||||
},
|
{
|
||||||
() => new()
|
GuildId = guildId
|
||||||
{
|
});
|
||||||
GuildId = guildId
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return stats;
|
return stats;
|
||||||
|
@ -365,25 +362,23 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
await uow.GetTable<AntiSpamSetting>()
|
await uow.GetTable<AntiSpamSetting>()
|
||||||
.InsertOrUpdateAsync(() => new()
|
.InsertOrUpdateAsync(() => new()
|
||||||
{
|
{
|
||||||
GuildId = guildId,
|
GuildId = guildId,
|
||||||
Action = stats.AntiSpamSettings.Action,
|
Action = stats.AntiSpamSettings.Action,
|
||||||
MessageThreshold = stats.AntiSpamSettings.MessageThreshold,
|
MessageThreshold = stats.AntiSpamSettings.MessageThreshold,
|
||||||
MuteTime = stats.AntiSpamSettings.MuteTime,
|
MuteTime = stats.AntiSpamSettings.MuteTime,
|
||||||
RoleId = stats.AntiSpamSettings.RoleId
|
RoleId = stats.AntiSpamSettings.RoleId
|
||||||
},
|
}, (old) => new()
|
||||||
(old) => new()
|
{
|
||||||
{
|
GuildId = guildId,
|
||||||
GuildId = guildId,
|
Action = stats.AntiSpamSettings.Action,
|
||||||
Action = stats.AntiSpamSettings.Action,
|
MessageThreshold = stats.AntiSpamSettings.MessageThreshold,
|
||||||
MessageThreshold = stats.AntiSpamSettings.MessageThreshold,
|
MuteTime = stats.AntiSpamSettings.MuteTime,
|
||||||
MuteTime = stats.AntiSpamSettings.MuteTime,
|
RoleId = stats.AntiSpamSettings.RoleId
|
||||||
RoleId = stats.AntiSpamSettings.RoleId
|
}, () => new()
|
||||||
},
|
{
|
||||||
() => new()
|
GuildId = guildId
|
||||||
{
|
});
|
||||||
GuildId = guildId
|
|
||||||
});
|
|
||||||
|
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
@ -464,24 +459,22 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
|
|
||||||
await uow.GetTable<AntiAltSetting>()
|
await uow.GetTable<AntiAltSetting>()
|
||||||
.InsertOrUpdateAsync(() => new()
|
.InsertOrUpdateAsync(() => new()
|
||||||
{
|
{
|
||||||
GuildId = guildId,
|
GuildId = guildId,
|
||||||
Action = action,
|
Action = action,
|
||||||
ActionDurationMinutes = actionDurationMinutes,
|
ActionDurationMinutes = actionDurationMinutes,
|
||||||
MinAge = TimeSpan.FromMinutes(minAgeMinutes),
|
MinAge = TimeSpan.FromMinutes(minAgeMinutes),
|
||||||
RoleId = roleId
|
RoleId = roleId
|
||||||
},
|
}, _ => new()
|
||||||
_ => new()
|
{
|
||||||
{
|
Action = action,
|
||||||
Action = action,
|
ActionDurationMinutes = actionDurationMinutes,
|
||||||
ActionDurationMinutes = actionDurationMinutes,
|
MinAge = TimeSpan.FromMinutes(minAgeMinutes),
|
||||||
MinAge = TimeSpan.FromMinutes(minAgeMinutes),
|
RoleId = roleId
|
||||||
RoleId = roleId
|
}, () => new()
|
||||||
},
|
{
|
||||||
() => new()
|
GuildId = guildId
|
||||||
{
|
});
|
||||||
GuildId = guildId
|
|
||||||
});
|
|
||||||
|
|
||||||
_antiAltGuilds[guildId] = new(new()
|
_antiAltGuilds[guildId] = new(new()
|
||||||
{
|
{
|
||||||
|
@ -509,10 +502,10 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
{
|
{
|
||||||
await using var uow = _db.GetDbContext();
|
await using var uow = _db.GetDbContext();
|
||||||
|
|
||||||
var configs = await uow.Set<AntiAltSetting>()
|
var configs = await uow.GetTable<AntiAltSetting>()
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.Where(x => x.GuildId / 4194304 % (ulong)_shardData.TotalShards == (ulong)_shardData.ShardId)
|
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
|
||||||
.ToListAsyncEF();
|
.ToListAsyncLinqToDB();
|
||||||
|
|
||||||
foreach (var config in configs)
|
foreach (var config in configs)
|
||||||
_antiAltGuilds[config.GuildId] = new(config);
|
_antiAltGuilds[config.GuildId] = new(config);
|
||||||
|
@ -532,7 +525,7 @@ public class ProtectionService : IReadyExecutor, IEService
|
||||||
var spamConfigs = await uow.GetTable<AntiSpamSetting>()
|
var spamConfigs = await uow.GetTable<AntiSpamSetting>()
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
|
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
|
||||||
.ToListAsyncEF();
|
.ToListAsyncLinqToDB();
|
||||||
|
|
||||||
foreach (var config in spamConfigs)
|
foreach (var config in spamConfigs)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue