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

Automod work vol 3

This commit is contained in:
Dragory 2020-07-27 22:19:34 +03:00
parent 0e9f65e0d5
commit 0f0728bc1c
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
18 changed files with 133 additions and 38 deletions

View file

@ -0,0 +1,34 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { convertDelayStringToMS, tDelayString } from "../../../utils";
export const MemberJoinTrigger = automodTrigger<unknown>()({
configType: t.type({
only_new: t.boolean,
new_threshold: tDelayString,
}),
defaultConfig: {
only_new: false,
new_threshold: "1h",
},
async match({ pluginData, context, triggerConfig }) {
if (!context.joined || !context.member) {
return;
}
if (triggerConfig.only_new) {
const threshold = Date.now() - convertDelayStringToMS(triggerConfig.new_threshold);
if (context.member.createdAt >= threshold) {
return {};
}
}
return {};
},
renderMatchInformation({ pluginData, contexts, triggerConfig }) {
return null;
},
});