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:
parent
0e9f65e0d5
commit
0f0728bc1c
18 changed files with 133 additions and 38 deletions
34
backend/src/plugins/Automod/triggers/memberJoin.ts
Normal file
34
backend/src/plugins/Automod/triggers/memberJoin.ts
Normal 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;
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue