3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-06-08 08:05:03 +00:00
zeppelin/backend/src/plugins/Logs/logFunctions/logClean.ts
Dragory 45e3fe2ef0
chore: esm imports
This will make merging this into 'next' much easier.
2024-08-11 21:58:52 +03:00

31 lines
1 KiB
TypeScript

import { GuildTextBasedChannel, User } from "discord.js";
import { GuildPluginData } from "knub";
import { LogType } from "../../../data/LogType.js";
import { createTypedTemplateSafeValueContainer } from "../../../templateFormatter.js";
import { resolveChannelIds } from "../../../utils/resolveChannelIds.js";
import { channelToTemplateSafeChannel, userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js";
import { LogsPluginType } from "../types.js";
import { log } from "../util/log.js";
export interface LogCleanData {
mod: User;
channel: GuildTextBasedChannel;
count: number;
archiveUrl: string;
}
export function logClean(pluginData: GuildPluginData<LogsPluginType>, data: LogCleanData) {
return log(
pluginData,
LogType.CLEAN,
createTypedTemplateSafeValueContainer({
mod: userToTemplateSafeUser(data.mod),
channel: channelToTemplateSafeChannel(data.channel),
count: data.count,
archiveUrl: data.archiveUrl,
}),
{
...resolveChannelIds(data.channel),
},
);
}