3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 08:45:03 +00:00
zeppelin/backend/src/plugins/Automod/triggers/anyMessage.ts
2021-06-30 04:56:56 +02:00

30 lines
880 B
TypeScript

import { Snowflake, TextChannel } from "discord.js";
import * as t from "io-ts";
import { verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers";
// tslint:disable-next-line:no-empty-interface
interface AnyMessageResultType {}
export const AnyMessageTrigger = automodTrigger<AnyMessageResultType>()({
configType: t.type({}),
defaultConfig: {},
async match({ pluginData, context, triggerConfig: trigger }) {
if (!context.message) {
return;
}
return {
extra: {},
};
},
renderMatchInformation({ pluginData, contexts, matchResult }) {
const channel = pluginData.guild.channels.cache.get(contexts[0].message!.channel_id as Snowflake) as TextChannel;
return `Matched message (\`${contexts[0].message!.id}\`) in ${
channel ? verboseChannelMention(channel) : "Unknown Channel"
}`;
},
});