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

automod: add any_message trigger

This commit is contained in:
Dragory 2021-04-02 17:57:04 +03:00
parent b28186aa0a
commit 9ac4e15573
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { verboseChannelMention } from "../../../utils";
// 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.get(contexts[0].message!.channel_id);
return `Matched message (\`${contexts[0].message!.id}\`) in ${
channel ? verboseChannelMention(channel) : "Unknown Channel"
}`;
},
});