mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 19:17:19 +00:00
14 lines
679 B
TypeScript
14 lines
679 B
TypeScript
import { GuildPluginData } from "knub";
|
|
import moment from "moment-timezone";
|
|
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
|
import { getBaseUrl } from "../../../pluginUtils.js";
|
|
import { SpamPluginType } from "../types.js";
|
|
|
|
const SPAM_ARCHIVE_EXPIRY_DAYS = 90;
|
|
|
|
export async function saveSpamArchives(pluginData: GuildPluginData<SpamPluginType>, savedMessages: SavedMessage[]) {
|
|
const expiresAt = moment.utc().add(SPAM_ARCHIVE_EXPIRY_DAYS, "days");
|
|
const archiveId = await pluginData.state.archives.createFromSavedMessages(savedMessages, pluginData.guild, expiresAt);
|
|
|
|
return pluginData.state.archives.getUrl(getBaseUrl(pluginData), archiveId);
|
|
}
|