3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-13 13:25:03 +00:00

Finish preliminary rework, ready to test

This commit is contained in:
Dark 2021-06-02 04:07:50 +02:00
parent 57893e7f76
commit d0a1beb809
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
177 changed files with 854 additions and 707 deletions

View file

@ -9,6 +9,7 @@ import { LogType } from "../../../data/LogType";
import { resolveUser, stripObjectToScalars, UnknownUser } from "../../../utils";
import { safeFindRelevantAuditLogEntry } from "../../../utils/safeFindRelevantAuditLogEntry";
import { Case } from "../../../data/entities/Case";
import { GuildAuditLogs, User } from "discord.js";
/**
* Create a KICK case automatically when a user is kicked manually.
@ -24,7 +25,7 @@ export const CreateKickCaseOnManualKickEvt = modActionsEvt({
const kickAuditLogEntry = await safeFindRelevantAuditLogEntry(
pluginData,
ErisConstants.AuditLogActions.MEMBER_KICK,
GuildAuditLogs.Actions.MEMBER_KICK as number,
member.id,
);
@ -40,7 +41,7 @@ export const CreateKickCaseOnManualKickEvt = modActionsEvt({
`Tried to create duplicate case for audit log entry ${kickAuditLogEntry.id}, existing case id ${createdCase.id}`,
);
} else {
mod = await resolveUser(pluginData.client, kickAuditLogEntry.user.id);
mod = await resolveUser(pluginData.client, kickAuditLogEntry.executor!.id);
const config = mod instanceof UnknownUser ? pluginData.config.get() : await pluginData.config.getForUser(mod);
@ -48,7 +49,7 @@ export const CreateKickCaseOnManualKickEvt = modActionsEvt({
const casesPlugin = pluginData.getPlugin(CasesPlugin);
createdCase = await casesPlugin.createCase({
userId: member.id,
modId: kickAuditLogEntry.user.id,
modId: mod.id,
type: CaseTypes.Kick,
auditLogId: kickAuditLogEntry.id,
reason: kickAuditLogEntry.reason || undefined,