3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Migrate Logs to new Plugin structure, also dont ignore it

This commit is contained in:
Dark 2020-07-27 01:53:14 +02:00
parent 140ba84544
commit aea019181c
16 changed files with 764 additions and 1 deletions

View file

@ -0,0 +1,21 @@
import { PluginData } from "knub";
import { LogsPluginType } from "../types";
import { SavedMessage } from "src/data/entities/SavedMessage";
import { LogType } from "src/data/LogType";
import { getBaseUrl } from "src/pluginUtils";
export async function onMessageDeleteBulk(pluginData: PluginData<LogsPluginType>, savedMessages: SavedMessage[]) {
const channel = pluginData.guild.channels.get(savedMessages[0].channel_id);
const archiveId = await pluginData.state.archives.createFromSavedMessages(savedMessages, pluginData.guild);
const archiveUrl = pluginData.state.archives.getUrl(getBaseUrl, archiveId);
pluginData.state.guildLogs.log(
LogType.MESSAGE_DELETE_BULK,
{
count: savedMessages.length,
channel,
archiveUrl,
},
savedMessages[0].id,
);
}