mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Fix logAutomodAction error if Automod context doesn't include a user
This commit is contained in:
parent
204a8619ae
commit
3c8355babf
2 changed files with 5 additions and 5 deletions
|
@ -8,7 +8,7 @@ import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
|||
|
||||
interface LogAutomodActionData {
|
||||
rule: string;
|
||||
user: User;
|
||||
user?: User | null;
|
||||
users: User[];
|
||||
actionsTaken: string;
|
||||
matchSummary: string;
|
||||
|
@ -20,14 +20,14 @@ export function logAutomodAction(pluginData: GuildPluginData<LogsPluginType>, da
|
|||
LogType.AUTOMOD_ACTION,
|
||||
createTypedTemplateSafeValueContainer({
|
||||
rule: data.rule,
|
||||
user: userToTemplateSafeUser(data.user),
|
||||
user: data.user ? userToTemplateSafeUser(data.user) : null,
|
||||
users: data.users.map(user => userToTemplateSafeUser(user)),
|
||||
actionsTaken: data.actionsTaken,
|
||||
matchSummary: data.matchSummary ?? "",
|
||||
}),
|
||||
{
|
||||
userId: data.user.id,
|
||||
bot: data.user.bot,
|
||||
userId: data.user ? data.user.id : null,
|
||||
bot: data.user ? data.user.bot : false,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -458,7 +458,7 @@ export const LogTypeData = z.object({
|
|||
|
||||
[LogType.AUTOMOD_ACTION]: z.object({
|
||||
rule: z.string(),
|
||||
user: z.instanceof(TemplateSafeUser),
|
||||
user: z.instanceof(TemplateSafeUser).nullable(),
|
||||
users: z.array(z.instanceof(TemplateSafeUser)),
|
||||
actionsTaken: z.string(),
|
||||
matchSummary: z.string(),
|
||||
|
|
Loading…
Add table
Reference in a new issue