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

Turn on strict TS compilation. Fix up and tweak types accordingly.

This commit is contained in:
Dragory 2020-11-09 20:03:57 +02:00
parent 690955a399
commit 629002b8d9
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
172 changed files with 720 additions and 534 deletions

View file

@ -1,12 +1,12 @@
import { IgnoredEventType, modActionsEvt } from "../types";
import { isEventIgnored } from "../functions/isEventIgnored";
import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
import { Constants as ErisConstants } from "eris";
import { Constants as ErisConstants, User } from "eris";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { CaseTypes } from "../../../data/CaseTypes";
import { safeFindRelevantAuditLogEntry } from "../../../utils/safeFindRelevantAuditLogEntry";
import { LogType } from "../../../data/LogType";
import { stripObjectToScalars, resolveUser } from "../../../utils";
import { stripObjectToScalars, resolveUser, UnknownUser } from "../../../utils";
/**
* Create a BAN case automatically when a user is banned manually.
@ -29,27 +29,27 @@ export const CreateBanCaseOnManualBanEvt = modActionsEvt(
const casesPlugin = pluginData.getPlugin(CasesPlugin);
let createdCase;
let mod = null;
let mod: User | UnknownUser | null = null;
let reason = "";
if (relevantAuditLogEntry) {
const modId = relevantAuditLogEntry.user.id;
const auditLogId = relevantAuditLogEntry.id;
mod = resolveUser(pluginData.client, modId);
reason = relevantAuditLogEntry.reason;
mod = await resolveUser(pluginData.client, modId);
reason = relevantAuditLogEntry.reason || "";
createdCase = await casesPlugin.createCase({
userId: user.id,
modId,
type: CaseTypes.Ban,
auditLogId,
reason,
reason: reason || undefined,
automatic: true,
});
} else {
createdCase = await casesPlugin.createCase({
userId: user.id,
modId: null,
modId: "0",
type: CaseTypes.Ban,
});
}