Automod work vol 2

This commit is contained in:
Dragory 2020-07-27 21:51:03 +03:00
parent f657b169df
commit 0e9f65e0d5
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
12 changed files with 420 additions and 59 deletions
backend/src/plugins/Automod/functions

View file

@ -14,18 +14,15 @@ const MessageSpamTriggerConfig = t.type({
});
type TMessageSpamTriggerConfig = t.TypeOf<typeof MessageSpamTriggerConfig>;
const MessageSpamMatchResultType = t.type({
archiveId: t.string,
});
type TMessageSpamMatchResultType = t.TypeOf<typeof MessageSpamMatchResultType>;
interface TMessageSpamMatchResultType {
archiveId: string;
}
export function createMessageSpamTrigger(spamType: RecentActionType, prettyName: string) {
return automodTrigger({
return automodTrigger<TMessageSpamMatchResultType>()({
configType: MessageSpamTriggerConfig,
defaultConfig: {},
matchResultType: MessageSpamMatchResultType,
async match({ pluginData, context, triggerConfig }) {
if (!context.message) {
return;