feat: exorcise entity framework core from most responders
This commit is contained in:
parent
33b78a7ac5
commit
5891f28f7c
32 changed files with 743 additions and 145 deletions
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
using Catalogger.Backend.Cache.InMemoryCache;
|
||||
using Catalogger.Backend.Database;
|
||||
using Catalogger.Backend.Database.Dapper.Repositories;
|
||||
using Catalogger.Backend.Database.Queries;
|
||||
using Catalogger.Backend.Extensions;
|
||||
using Catalogger.Backend.Services;
|
||||
|
|
@ -27,7 +28,7 @@ namespace Catalogger.Backend.Bot.Responders.Guilds;
|
|||
|
||||
public class GuildBanRemoveResponder(
|
||||
ILogger logger,
|
||||
DatabaseContext db,
|
||||
GuildRepository guildRepository,
|
||||
WebhookExecutorService webhookExecutor,
|
||||
UserCache userCache,
|
||||
AuditLogCache auditLogCache,
|
||||
|
|
@ -38,7 +39,7 @@ public class GuildBanRemoveResponder(
|
|||
|
||||
public async Task<Result> RespondAsync(IGuildBanRemove evt, CancellationToken ct = default)
|
||||
{
|
||||
var guildConfig = await db.GetGuildAsync(evt.GuildID, false, ct);
|
||||
var guildConfig = await guildRepository.GetAsync(evt.GuildID);
|
||||
|
||||
// Delay 2 seconds for the audit log
|
||||
await Task.Delay(2000, ct);
|
||||
|
|
@ -68,10 +69,7 @@ public class GuildBanRemoveResponder(
|
|||
var pkSystem = await pluralkitApi.GetPluralKitSystemAsync(evt.User.ID.Value, ct);
|
||||
if (pkSystem != null)
|
||||
{
|
||||
guildConfig.BannedSystems.Remove(pkSystem.Id);
|
||||
guildConfig.BannedSystems.Remove(pkSystem.Uuid.ToString());
|
||||
db.Update(guildConfig);
|
||||
await db.SaveChangesAsync(ct);
|
||||
await guildRepository.UnbanSystemAsync(evt.GuildID, pkSystem.Id, pkSystem.Uuid);
|
||||
|
||||
embed.AddField(
|
||||
"PluralKit system",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue