mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-12 04:55:01 +00:00
Typed log functions + more
This commit is contained in:
parent
d2ac700143
commit
bed6589d48
166 changed files with 4021 additions and 869 deletions
|
@ -1,5 +1,5 @@
|
|||
import { GuildAuditLogs, User } from "discord.js";
|
||||
import { userToConfigAccessibleUser } from "../../../utils/configAccessibleObjects";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -9,6 +9,7 @@ import { CasesPlugin } from "../../Cases/CasesPlugin";
|
|||
import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
|
||||
import { isEventIgnored } from "../functions/isEventIgnored";
|
||||
import { IgnoredEventType, modActionsEvt } from "../types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
|
||||
/**
|
||||
* Create a BAN case automatically when a user is banned manually.
|
||||
|
@ -65,9 +66,9 @@ export const CreateBanCaseOnManualBanEvt = modActionsEvt({
|
|||
}
|
||||
}
|
||||
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_BAN, {
|
||||
mod: mod ? userToConfigAccessibleUser(mod) : null,
|
||||
user: userToConfigAccessibleUser(user),
|
||||
pluginData.getPlugin(LogsPlugin).logMemberBan({
|
||||
mod: mod ? userToTemplateSafeUser(mod) : null,
|
||||
user: userToTemplateSafeUser(user),
|
||||
caseNumber: createdCase?.case_number ?? 0,
|
||||
reason,
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildAuditLogs, User } from "discord.js";
|
||||
import { userToConfigAccessibleUser } from "../../../utils/configAccessibleObjects";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -10,6 +10,7 @@ import { CasesPlugin } from "../../Cases/CasesPlugin";
|
|||
import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
|
||||
import { isEventIgnored } from "../functions/isEventIgnored";
|
||||
import { IgnoredEventType, modActionsEvt } from "../types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
|
||||
/**
|
||||
* Create a KICK case automatically when a user is kicked manually.
|
||||
|
@ -58,9 +59,9 @@ export const CreateKickCaseOnManualKickEvt = modActionsEvt({
|
|||
}
|
||||
}
|
||||
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_KICK, {
|
||||
user: userToConfigAccessibleUser(member.user!),
|
||||
mod: mod ? userToConfigAccessibleUser(mod) : null,
|
||||
pluginData.getPlugin(LogsPlugin).logMemberKick({
|
||||
user: member.user!,
|
||||
mod,
|
||||
caseNumber: createdCase?.case_number ?? 0,
|
||||
reason: kickAuditLogEntry.reason || "",
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildAuditLogs, User } from "discord.js";
|
||||
import { userToConfigAccessibleUser } from "../../../utils/configAccessibleObjects";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -9,6 +9,7 @@ import { CasesPlugin } from "../../Cases/CasesPlugin";
|
|||
import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
|
||||
import { isEventIgnored } from "../functions/isEventIgnored";
|
||||
import { IgnoredEventType, modActionsEvt } from "../types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
|
||||
/**
|
||||
* Create an UNBAN case automatically when a user is unbanned manually.
|
||||
|
@ -63,10 +64,11 @@ export const CreateUnbanCaseOnManualUnbanEvt = modActionsEvt({
|
|||
}
|
||||
}
|
||||
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_UNBAN, {
|
||||
mod: mod ? userToConfigAccessibleUser(mod) : null,
|
||||
pluginData.getPlugin(LogsPlugin).logMemberUnban({
|
||||
mod,
|
||||
userId: user.id,
|
||||
caseNumber: createdCase?.case_number ?? 0,
|
||||
reason: "",
|
||||
});
|
||||
|
||||
pluginData.state.events.emit("unban", user.id);
|
||||
|
|
|
@ -24,14 +24,14 @@ export const PostAlertOnMemberJoinEvt = modActionsEvt({
|
|||
if (actions.length) {
|
||||
const alertChannel = pluginData.guild.channels.cache.get(alertChannelId as Snowflake);
|
||||
if (!alertChannel) {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
logs.logBotAlert({
|
||||
body: `Unknown \`alert_channel\` configured for \`mod_actions\`: \`${alertChannelId}\``,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(alertChannel instanceof TextChannel)) {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
logs.logBotAlert({
|
||||
body: `Non-text channel configured as \`alert_channel\` in \`mod_actions\`: \`${alertChannelId}\``,
|
||||
});
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ export const PostAlertOnMemberJoinEvt = modActionsEvt({
|
|||
const botMember = await resolveMember(pluginData.client, pluginData.guild, pluginData.client.user!.id);
|
||||
const botPerms = alertChannel.permissionsFor(botMember ?? pluginData.client.user!.id);
|
||||
if (!hasDiscordPermissions(botPerms, Permissions.FLAGS.SEND_MESSAGES)) {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
logs.logBotAlert({
|
||||
body: `Missing "Send Messages" permissions for the \`alert_channel\` configured in \`mod_actions\`: \`${alertChannelId}\``,
|
||||
});
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue