mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-15 06:05:03 +00:00
39 lines
1.3 KiB
TypeScript
39 lines
1.3 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 LogRepeatedMessageData {
|
|
author: User;
|
|
channel: GuildTextBasedChannel;
|
|
datetime: string;
|
|
date: string;
|
|
time: string;
|
|
repeatInterval: string;
|
|
repeatDetails: string;
|
|
}
|
|
|
|
export function logRepeatedMessage(pluginData: GuildPluginData<LogsPluginType>, data: LogRepeatedMessageData) {
|
|
return log(
|
|
pluginData,
|
|
LogType.REPEATED_MESSAGE,
|
|
createTypedTemplateSafeValueContainer({
|
|
author: userToTemplateSafeUser(data.author),
|
|
channel: channelToTemplateSafeChannel(data.channel),
|
|
datetime: data.datetime,
|
|
date: data.date,
|
|
time: data.time,
|
|
repeatInterval: data.repeatInterval,
|
|
repeatDetails: data.repeatDetails,
|
|
}),
|
|
{
|
|
userId: data.author.id,
|
|
bot: data.author.bot,
|
|
...resolveChannelIds(data.channel),
|
|
},
|
|
);
|
|
}
|