mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-19 16:05:01 +00:00
Migrate Spam to new Plugin structure
This commit is contained in:
parent
4b33322127
commit
ef35f17eca
14 changed files with 622 additions and 0 deletions
12
backend/src/plugins/Spam/util/saveSpamArchives.ts
Normal file
12
backend/src/plugins/Spam/util/saveSpamArchives.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { SavedMessage } from "src/data/entities/SavedMessage";
|
||||
import moment from "moment-timezone";
|
||||
import { getBaseUrl } from "src/pluginUtils";
|
||||
|
||||
const SPAM_ARCHIVE_EXPIRY_DAYS = 90;
|
||||
|
||||
export async function saveSpamArchives(pluginData, savedMessages: SavedMessage[]) {
|
||||
const expiresAt = moment().add(SPAM_ARCHIVE_EXPIRY_DAYS, "days");
|
||||
const archiveId = await pluginData.state.archives.createFromSavedMessages(savedMessages, pluginData.guild, expiresAt);
|
||||
|
||||
return pluginData.state.archives.getUrl(getBaseUrl, archiveId);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue