mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Type fixes + circular dependency fix
This commit is contained in:
parent
e3b6b017a2
commit
59e75e0584
20 changed files with 70 additions and 83 deletions
|
@ -108,10 +108,6 @@ import { logVoiceChannelLeave } from "./logFunctions/logVoiceChannelLeave";
|
|||
import { logVoiceChannelMove } from "./logFunctions/logVoiceChannelMove";
|
||||
import { logMemberTimedUnban } from "./logFunctions/logMemberTimedUnban";
|
||||
import { logDmFailed } from "./logFunctions/logDmFailed";
|
||||
import { CasesPlugin } from "../Cases/CasesPlugin";
|
||||
|
||||
// Workaround for circular dependency
|
||||
const AnyTypedCasesPlugin = CasesPlugin as any;
|
||||
|
||||
const defaultOptions: PluginOptions<LogsPluginType> = {
|
||||
config: {
|
||||
|
@ -143,7 +139,11 @@ export const LogsPlugin = zeppelinGuildPlugin<LogsPluginType>()({
|
|||
prettyName: "Logs",
|
||||
},
|
||||
|
||||
dependencies: () => [TimeAndDatePlugin, AnyTypedCasesPlugin],
|
||||
dependencies: async () => [
|
||||
TimeAndDatePlugin,
|
||||
// The `as any` cast here is to prevent TypeScript from locking up from the circular dependency
|
||||
((await import("../Cases/CasesPlugin")) as any).CasesPlugin,
|
||||
],
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export function logAutomodAction(pluginData: GuildPluginData<LogsPluginType>, da
|
|||
user: userToTemplateSafeUser(data.user),
|
||||
users: data.users.map(user => userToTemplateSafeUser(user)),
|
||||
actionsTaken: data.actionsTaken,
|
||||
matchSummary: data.matchSummary,
|
||||
matchSummary: data.matchSummary ?? "",
|
||||
}),
|
||||
{
|
||||
userId: data.user.id,
|
||||
|
|
|
@ -17,7 +17,7 @@ export function logMemberRoleAdd(pluginData: GuildPluginData<LogsPluginType>, da
|
|||
pluginData,
|
||||
LogType.MEMBER_ROLE_ADD,
|
||||
createTypedTemplateSafeValueContainer({
|
||||
mod: userToTemplateSafeUser(data.mod),
|
||||
mod: data.mod ? userToTemplateSafeUser(data.mod) : null,
|
||||
member: memberToTemplateSafeMember(data.member),
|
||||
roles: data.roles.map(r => r.name).join(", "),
|
||||
}),
|
||||
|
|
|
@ -17,7 +17,7 @@ export function logMemberRoleRemove(pluginData: GuildPluginData<LogsPluginType>,
|
|||
pluginData,
|
||||
LogType.MEMBER_ROLE_REMOVE,
|
||||
createTypedTemplateSafeValueContainer({
|
||||
mod: userToTemplateSafeUser(data.mod),
|
||||
mod: data.mod ? userToTemplateSafeUser(data.mod) : null,
|
||||
member: memberToTemplateSafeMember(data.member),
|
||||
roles: data.roles.map(r => r.name).join(", "),
|
||||
}),
|
||||
|
|
|
@ -5,10 +5,11 @@ import { log } from "../util/log";
|
|||
import { createTypedTemplateSafeValueContainer } from "../../../templateFormatter";
|
||||
import { User } from "discord.js";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { UnknownUser } from "../../../utils";
|
||||
|
||||
interface LogMemberTimedUnmuteData {
|
||||
mod: User;
|
||||
user: User;
|
||||
user: User | UnknownUser;
|
||||
time: string;
|
||||
caseNumber: number;
|
||||
reason: string;
|
||||
|
@ -25,6 +26,9 @@ export function logMemberTimedUnmute(pluginData: GuildPluginData<LogsPluginType>
|
|||
caseNumber: data.caseNumber,
|
||||
reason: data.reason,
|
||||
}),
|
||||
{},
|
||||
{
|
||||
userId: data.user.id,
|
||||
bot: data.user instanceof User ? data.user.bot : false,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ import { log } from "../util/log";
|
|||
import { createTypedTemplateSafeValueContainer } from "../../../templateFormatter";
|
||||
import { GuildMember, User } from "discord.js";
|
||||
import { memberToTemplateSafeMember, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { UnknownUser } from "../../../utils";
|
||||
|
||||
interface LogMemberUnmuteData {
|
||||
mod: GuildMember;
|
||||
user: User;
|
||||
mod: User;
|
||||
user: User | UnknownUser;
|
||||
caseNumber: number;
|
||||
reason: string;
|
||||
}
|
||||
|
@ -18,14 +19,14 @@ export function logMemberUnmute(pluginData: GuildPluginData<LogsPluginType>, dat
|
|||
pluginData,
|
||||
LogType.MEMBER_UNMUTE,
|
||||
createTypedTemplateSafeValueContainer({
|
||||
mod: memberToTemplateSafeMember(data.mod),
|
||||
mod: userToTemplateSafeUser(data.mod),
|
||||
user: userToTemplateSafeUser(data.user),
|
||||
caseNumber: data.caseNumber,
|
||||
reason: data.reason,
|
||||
}),
|
||||
{
|
||||
userId: data.user.id,
|
||||
bot: data.user.bot,
|
||||
bot: data.user instanceof User ? data.user.bot : false,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ export function logMessageDeleteAuto(pluginData: GuildPluginData<LogsPluginType>
|
|||
}),
|
||||
{
|
||||
userId: data.user.id,
|
||||
bot: data.user.bot,
|
||||
bot: data.user instanceof User ? data.user.bot : false,
|
||||
channel: data.channel.id,
|
||||
category: data.channel.parentId,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue