mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 04:25:01 +00:00
automod: add role_added and role_removed triggers
This commit is contained in:
parent
bfa9cf55a7
commit
4c7a51f586
9 changed files with 187 additions and 4 deletions
|
@ -27,6 +27,7 @@ import { RegExpRunner } from "../../RegExpRunner";
|
|||
import { LogType } from "../../data/LogType";
|
||||
import { logger } from "../../logger";
|
||||
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
|
||||
import { RunAutomodOnMemberUpdate } from "./events/RunAutomodOnMemberUpdate";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
@ -83,10 +84,15 @@ const configPreprocessor: ConfigPreprocessorFn<AutomodPluginType> = options => {
|
|||
}
|
||||
|
||||
const triggerBlueprint = availableTriggers[triggerName];
|
||||
triggerObj[triggerName] = configUtils.mergeConfig(
|
||||
triggerBlueprint.defaultConfig,
|
||||
triggerObj[triggerName] || {},
|
||||
);
|
||||
|
||||
if (typeof triggerBlueprint.defaultConfig === "object" && triggerBlueprint.defaultConfig != null) {
|
||||
triggerObj[triggerName] = configUtils.mergeConfig(
|
||||
triggerBlueprint.defaultConfig,
|
||||
triggerObj[triggerName] || {},
|
||||
);
|
||||
} else {
|
||||
triggerObj[triggerName] = triggerObj[triggerName] || triggerBlueprint.defaultConfig;
|
||||
}
|
||||
|
||||
if (triggerObj[triggerName].match_attachment_type) {
|
||||
const white = triggerObj[triggerName].match_attachment_type.whitelist_enabled;
|
||||
|
@ -157,6 +163,7 @@ export const AutomodPlugin = zeppelinPlugin<AutomodPluginType>()("automod", {
|
|||
|
||||
events: [
|
||||
RunAutomodOnJoinEvt,
|
||||
RunAutomodOnMemberUpdate,
|
||||
// Messages use message events from SavedMessages, see onLoad below
|
||||
],
|
||||
|
||||
|
@ -179,6 +186,8 @@ export const AutomodPlugin = zeppelinPlugin<AutomodPluginType>()("automod", {
|
|||
30 * SECONDS,
|
||||
);
|
||||
|
||||
pluginData.state.ignoredRoleChanges = new Set();
|
||||
|
||||
pluginData.state.cooldownManager = new CooldownManager();
|
||||
|
||||
pluginData.state.logs = new GuildLogs(pluginData.guild.id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue