mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
refactor: debounce and batch simultaneous audit log requests
This commit is contained in:
parent
d7c6e34695
commit
8f17a835f9
8 changed files with 77 additions and 117 deletions
|
@ -1,11 +1,11 @@
|
|||
import { GuildAuditLogs } from "discord.js";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { safeFindRelevantAuditLogEntry } from "../../../utils/safeFindRelevantAuditLogEntry";
|
||||
import { logsEvt } from "../types";
|
||||
import { logMemberBan } from "../logFunctions/logMemberBan";
|
||||
import { isLogIgnored } from "../util/isLogIgnored";
|
||||
import { logMemberUnban } from "../logFunctions/logMemberUnban";
|
||||
import { findMatchingAuditLogEntry } from "../../../utils/findMatchingAuditLogEntry";
|
||||
|
||||
export const LogsGuildBanAddEvt = logsEvt({
|
||||
event: "guildBanAdd",
|
||||
|
@ -18,11 +18,7 @@ export const LogsGuildBanAddEvt = logsEvt({
|
|||
return;
|
||||
}
|
||||
|
||||
const relevantAuditLogEntry = await safeFindRelevantAuditLogEntry(
|
||||
pluginData,
|
||||
GuildAuditLogs.Actions.MEMBER_BAN_ADD as number,
|
||||
user.id,
|
||||
);
|
||||
const relevantAuditLogEntry = await findMatchingAuditLogEntry(pluginData.guild, "MEMBER_BAN_ADD", user.id);
|
||||
const mod = relevantAuditLogEntry?.executor ?? null;
|
||||
logMemberBan(meta.pluginData, {
|
||||
mod,
|
||||
|
@ -44,11 +40,7 @@ export const LogsGuildBanRemoveEvt = logsEvt({
|
|||
return;
|
||||
}
|
||||
|
||||
const relevantAuditLogEntry = await safeFindRelevantAuditLogEntry(
|
||||
pluginData,
|
||||
GuildAuditLogs.Actions.MEMBER_BAN_REMOVE as number,
|
||||
user.id,
|
||||
);
|
||||
const relevantAuditLogEntry = await findMatchingAuditLogEntry(pluginData.guild, "MEMBER_BAN_REMOVE", user.id);
|
||||
const mod = relevantAuditLogEntry?.executor ?? null;
|
||||
|
||||
logMemberUnban(pluginData, {
|
||||
|
|
|
@ -3,7 +3,6 @@ import diff from "lodash.difference";
|
|||
import isEqual from "lodash.isequal";
|
||||
import { memberToTemplateSafeMember, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { safeFindRelevantAuditLogEntry } from "../../../utils/safeFindRelevantAuditLogEntry";
|
||||
import { logsEvt } from "../types";
|
||||
import { logMemberNickChange } from "../logFunctions/logMemberNickChange";
|
||||
import { logMemberRoleChanges } from "../logFunctions/logMemberRoleChanges";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue