3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +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

@ -8,6 +8,7 @@ import { safeFindRelevantAuditLogEntry } from "../../../utils/safeFindRelevantAu
import { stripObjectToScalars, resolveUser, UnknownUser } from "../../../utils";
import { LogType } from "../../../data/LogType";
import { Case } from "../../../data/entities/Case";
import { GuildAuditLogs, User } from "discord.js";
/**
* Create an UNBAN case automatically when a user is unbanned manually.
@ -15,7 +16,8 @@ import { Case } from "../../../data/entities/Case";
*/
export const CreateUnbanCaseOnManualUnbanEvt = modActionsEvt({
event: "guildBanRemove",
async listener({ pluginData, args: { guild, user } }) {
async listener({ pluginData, args: { ban } }) {
const user = ban.user;
if (isEventIgnored(pluginData, IgnoredEventType.Unban, user.id)) {
clearIgnoredEvents(pluginData, IgnoredEventType.Unban, user.id);
return;
@ -23,7 +25,7 @@ export const CreateUnbanCaseOnManualUnbanEvt = modActionsEvt({
const relevantAuditLogEntry = await safeFindRelevantAuditLogEntry(
pluginData,
ErisConstants.AuditLogActions.MEMBER_BAN_REMOVE,
GuildAuditLogs.Actions.MEMBER_BAN_REMOVE as number,
user.id,
);
@ -33,7 +35,7 @@ export const CreateUnbanCaseOnManualUnbanEvt = modActionsEvt({
let mod: User | UnknownUser | null = null;
if (relevantAuditLogEntry) {
const modId = relevantAuditLogEntry.user.id;
const modId = relevantAuditLogEntry.executor!.id;
const auditLogId = relevantAuditLogEntry.id;
mod = await resolveUser(pluginData.client, modId);