decord/source/modules/guild_automod/AutomodTriggerConfigs.tsx

267 lines
9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 16857
// Function ID: 16858
2026-07-20 16:05:17 +00:00
// Name: AutomodTriggerType
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 11081, 1236, 16147, 10074, 2]
2026-07-20 16:05:17 +00:00
// Exports: checkTriggerTypeForFlag, getAvailableActionTypes, getDefaultTriggerMetadataForTriggerType, useAvailableTriggerTypes, validateRuleByTriggerConfigOrThrow
2026-08-24 06:08:38 +00:00
// Module 16857 (AutomodTriggerType)
import getSystemLocale from "getSystemLocale" /* 1236 */;
import isInMentionRaidExperiment from "isInMentionRaidExperiment" /* 10074 */;
import closure_2 from "noop" /* 19 */;
import AutomodEventType from "AutomodEventType" /* 11081 */;
import set from "set" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-23 10:11:24 +00:00
({ AutomodActionType, AutomodEventType, AutomodTriggerType } = AutomodEventType);
let closure_4 = AutomodEventType.MENTION_SPAM_LIMIT_DEFAULT;
2026-07-20 16:05:17 +00:00
let obj = { NEW: "new", RECOMMENDED: "recommended", BETA: "beta", ALPHA: "alpha" };
obj = {};
obj = {
getDefaultRuleName() {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t.ffR2cM);
2026-07-20 16:05:17 +00:00
},
type: AutomodTriggerType.SPAM_LINK,
eventType: AutomodEventType.MESSAGE_SEND,
2026-07-29 08:29:29 +00:00
perGuildMaxCount: 0,
availableActionTypes: null,
flags: null,
defaultActionTypes: null
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-07-29 08:29:29 +00:00
obj[4] = set;
obj[5] = new Set();
2026-07-20 16:05:17 +00:00
const set1 = new Set();
2026-07-29 08:29:29 +00:00
obj[6] = new Set();
2026-07-20 16:05:17 +00:00
obj[AutomodTriggerType.SPAM_LINK] = obj;
const obj1 = {
getDefaultRuleName() {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t.ffR2cM);
2026-07-20 16:05:17 +00:00
},
type: AutomodTriggerType.KEYWORD,
eventType: AutomodEventType.MESSAGE_SEND,
2026-07-29 08:29:29 +00:00
perGuildMaxCount: 6,
availableActionTypes: null,
flags: null,
defaultActionTypes: null
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
let items = [, , ];
2026-07-20 16:05:17 +00:00
({ BLOCK_MESSAGE: arr[0], FLAG_TO_CHANNEL: arr[1], USER_COMMUNICATION_DISABLED: arr[2] } = AutomodActionType);
const set2 = new Set();
2026-07-29 08:29:29 +00:00
obj1[4] = new Set(items);
2026-07-20 16:05:17 +00:00
const set3 = new Set(items);
2026-07-29 08:29:29 +00:00
obj1[5] = new Set();
2026-07-20 16:05:17 +00:00
const items1 = [AutomodActionType.BLOCK_MESSAGE];
const set4 = new Set();
2026-07-29 08:29:29 +00:00
obj1[6] = new Set(items1);
2026-07-20 16:05:17 +00:00
obj[AutomodTriggerType.KEYWORD] = obj1;
const obj2 = {
getDefaultRuleName() {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t["puF/Os"]);
2026-07-20 16:05:17 +00:00
},
type: AutomodTriggerType.ML_SPAM,
eventType: AutomodEventType.MESSAGE_SEND,
2026-07-29 08:29:29 +00:00
perGuildMaxCount: 1,
availableActionTypes: null,
flags: null,
defaultActionTypes: null
2026-07-20 16:05:17 +00:00
};
const items2 = [, ];
({ BLOCK_MESSAGE: arr3[0], FLAG_TO_CHANNEL: arr3[1] } = AutomodActionType);
const set5 = new Set(items1);
2026-07-29 08:29:29 +00:00
obj2[4] = new Set(items2);
2026-07-20 16:05:17 +00:00
const set6 = new Set(items2);
2026-07-29 08:29:29 +00:00
obj2[5] = new Set([]);
2026-07-20 16:05:17 +00:00
const items3 = [AutomodActionType.BLOCK_MESSAGE];
const set7 = new Set([]);
2026-07-29 08:29:29 +00:00
obj2[6] = new Set(items3);
2026-07-20 16:05:17 +00:00
obj[AutomodTriggerType.ML_SPAM] = obj2;
const obj3 = {
getDefaultRuleName() {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t.LnGhZv);
2026-07-20 16:05:17 +00:00
},
type: AutomodTriggerType.DEFAULT_KEYWORD_LIST,
eventType: AutomodEventType.MESSAGE_SEND,
2026-07-29 08:29:29 +00:00
perGuildMaxCount: 1,
availableActionTypes: null,
flags: null,
defaultActionTypes: null
2026-07-20 16:05:17 +00:00
};
const items4 = [, ];
({ BLOCK_MESSAGE: arr5[0], FLAG_TO_CHANNEL: arr5[1] } = AutomodActionType);
const set8 = new Set(items3);
2026-07-29 08:29:29 +00:00
obj3[4] = new Set(items4);
2026-07-20 16:05:17 +00:00
const set9 = new Set(items4);
2026-07-29 08:29:29 +00:00
obj3[5] = new Set([]);
2026-07-20 16:05:17 +00:00
const items5 = [AutomodActionType.BLOCK_MESSAGE];
const set10 = new Set([]);
2026-07-29 08:29:29 +00:00
obj3[6] = new Set(items5);
2026-07-20 16:05:17 +00:00
obj[AutomodTriggerType.DEFAULT_KEYWORD_LIST] = obj3;
const obj4 = {
getDefaultRuleName() {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t.pX7i6n);
2026-07-20 16:05:17 +00:00
},
type: AutomodTriggerType.MENTION_SPAM,
eventType: AutomodEventType.MESSAGE_SEND,
2026-07-29 08:29:29 +00:00
perGuildMaxCount: 1,
availableActionTypes: null,
flags: null,
defaultActionTypes: null
2026-07-20 16:05:17 +00:00
};
const items6 = [, , ];
({ BLOCK_MESSAGE: arr7[0], FLAG_TO_CHANNEL: arr7[1], USER_COMMUNICATION_DISABLED: arr7[2] } = AutomodActionType);
const set11 = new Set(items5);
2026-07-29 08:29:29 +00:00
obj4[4] = new Set(items6);
2026-07-20 16:05:17 +00:00
const set12 = new Set(items6);
2026-07-29 08:29:29 +00:00
obj4[5] = new Set([]);
2026-07-20 16:05:17 +00:00
const items7 = [AutomodActionType.BLOCK_MESSAGE];
const set13 = new Set([]);
2026-07-29 08:29:29 +00:00
obj4[6] = new Set(items7);
2026-07-20 16:05:17 +00:00
obj[AutomodTriggerType.MENTION_SPAM] = obj4;
const obj5 = {
getDefaultRuleName() {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t.q1L2v8);
2026-07-20 16:05:17 +00:00
},
type: AutomodTriggerType.USER_PROFILE,
eventType: AutomodEventType.GUILD_MEMBER_JOIN_OR_UPDATE,
2026-07-29 08:29:29 +00:00
perGuildMaxCount: 1,
availableActionTypes: null,
flags: null,
defaultActionTypes: null
2026-07-20 16:05:17 +00:00
};
const items8 = [, ];
({ QUARANTINE_USER: arr9[0], FLAG_TO_CHANNEL: arr9[1] } = AutomodActionType);
const set14 = new Set(items7);
2026-07-29 08:29:29 +00:00
obj5[4] = new Set(items8);
2026-07-20 16:05:17 +00:00
const set15 = new Set(items8);
2026-07-29 08:29:29 +00:00
obj5[5] = new Set([]);
2026-07-20 16:05:17 +00:00
const items9 = [AutomodActionType.QUARANTINE_USER];
const set16 = new Set([]);
2026-07-29 08:29:29 +00:00
obj5[6] = new Set(items9);
2026-07-20 16:05:17 +00:00
obj[AutomodTriggerType.USER_PROFILE] = obj5;
const obj6 = {
getDefaultRuleName() {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
return intl.string(getSystemLocale.t.ZQr92M);
2026-07-20 16:05:17 +00:00
},
type: AutomodTriggerType.SERVER_POLICY,
eventType: AutomodEventType.MESSAGE_SEND,
2026-07-29 08:29:29 +00:00
perGuildMaxCount: 1,
availableActionTypes: null,
flags: null,
defaultActionTypes: null
2026-07-20 16:05:17 +00:00
};
const items10 = [AutomodActionType.FLAG_TO_CHANNEL];
const set17 = new Set(items9);
2026-07-29 08:29:29 +00:00
obj6[4] = new Set(items10);
2026-07-20 16:05:17 +00:00
const items11 = [obj.ALPHA];
const set18 = new Set(items10);
2026-07-29 08:29:29 +00:00
obj6[5] = new Set(items11);
2026-07-20 16:05:17 +00:00
const set19 = new Set(items11);
2026-07-29 08:29:29 +00:00
obj6[6] = new Set();
2026-07-20 16:05:17 +00:00
obj[AutomodTriggerType.SERVER_POLICY] = obj6;
const obj7 = { MEMBERS: "members", CONTENT: "content" };
const obj8 = { [obj7.MEMBERS]: items12, [obj7.CONTENT]: items13 };
2026-07-23 10:11:24 +00:00
items12 = [obj[AutomodTriggerType.USER_PROFILE]];
items13 = [obj[AutomodTriggerType.SERVER_POLICY], obj[AutomodTriggerType.MENTION_SPAM], obj[AutomodTriggerType.ML_SPAM], obj[AutomodTriggerType.DEFAULT_KEYWORD_LIST], obj[AutomodTriggerType.KEYWORD]];
const result = set.fileFinishedImporting("modules/guild_automod/AutomodTriggerConfigs.tsx");
2026-07-20 16:05:17 +00:00
export const AutomodTriggerConfigFlags = obj;
export const triggerConfigs = obj;
export const AutomodTriggerCategory = obj7;
export const AUTOMOD_RULE_CONFIGS_BY_CATEGORY = obj8;
export const checkTriggerTypeForFlag = function checkTriggerTypeForFlag(arg0, arg1) {
const flags = obj[arg0].flags;
return flags.has(arg1);
};
export const getAvailableActionTypes = function getAvailableActionTypes(arg0) {
return Array.from(obj[arg0].availableActionTypes);
};
export const validateRuleByTriggerConfigOrThrow = function validateRuleByTriggerConfigOrThrow(actions, arr) {
2026-07-23 10:11:24 +00:00
({ id: require, triggerType } = actions);
2026-07-20 16:05:17 +00:00
actions = actions.actions;
2026-08-24 06:08:38 +00:00
closure_2 = undefined;
closure_2 = tmp;
2026-07-20 16:05:17 +00:00
if (arr.filter((id) => {
let tmp = closure_0 !== id.id;
if (tmp) {
tmp = id.triggerType === triggerType;
}
return tmp;
}).length > obj[triggerType].perGuildMaxCount) {
const _Error3 = Error;
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
error = new Error("You have exceeded the maximum number of rules of type " + triggerType);
2026-07-20 16:05:17 +00:00
throw error;
} else if (actions.some((type) => {
2026-08-24 06:08:38 +00:00
availableActionTypes = availableActionTypes.availableActionTypes;
2026-07-20 16:05:17 +00:00
return !availableActionTypes.has(type.type);
})) {
const _Error2 = Error;
const error1 = new Error("You have provided an action that is not available for this trigger type");
throw error1;
} else if (actions.eventType !== tmp.eventType) {
const _Error = Error;
const error2 = new Error("You have provided an event type that is not available for this trigger type");
throw error2;
}
};
export const useAvailableTriggerTypes = function useAvailableTriggerTypes(arg0) {
2026-08-24 06:08:38 +00:00
isUserProfileRuleEnabled = isUserProfileRuleEnabled(16147).useIsUserProfileRuleEnabled(arg0);
2026-07-20 16:05:17 +00:00
const items = [isUserProfileRuleEnabled];
return React.useMemo(() => {
2026-08-24 06:08:38 +00:00
const keys = Object.keys(closure_1_7);
2026-07-20 16:05:17 +00:00
return keys.reduce((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
const found = closure_1_7[arg1].filter((type) => {
let tmp2 = type.type !== closure_1_3.SERVER_POLICY;
2026-07-29 08:29:29 +00:00
if (tmp2) {
let tmp3 = type.type === tmp.USER_PROFILE;
2026-07-20 16:05:17 +00:00
if (tmp3) {
2026-07-29 08:29:29 +00:00
tmp3 = !closure_0;
2026-07-20 16:05:17 +00:00
}
let tmp5 = !tmp3;
if (!tmp3) {
tmp5 = type.perGuildMaxCount > 0;
}
2026-07-29 08:29:29 +00:00
tmp2 = tmp5;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
});
arg0[arg1] = found.map((type) => type.type);
return arg0;
2026-08-24 06:08:38 +00:00
}, { [closure_1_6.MEMBERS]: [], [closure_1_6.CONTENT]: [] });
2026-07-20 16:05:17 +00:00
}, items);
};
2026-07-29 08:29:29 +00:00
export const getDefaultTriggerMetadataForTriggerType = function getDefaultTriggerMetadataForTriggerType(arg0, arg1) {
2026-08-24 06:08:38 +00:00
isInMentionRaidExperiment;
2026-07-29 08:29:29 +00:00
if (AutomodTriggerType.DEFAULT_KEYWORD_LIST === arg0) {
2026-08-24 06:08:38 +00:00
obj = { allowList: null, presets: null };
2026-07-29 08:29:29 +00:00
obj[0] = [];
obj[1] = [];
2026-07-20 16:05:17 +00:00
return obj;
} else {
2026-07-29 08:29:29 +00:00
if (tmp3.USER_PROFILE !== arg0) {
if (tmp3.KEYWORD !== arg0) {
if (tmp3.MENTION_SPAM === arg0) {
obj = { mentionTotalLimit: null, mentionRaidProtectionEnabled: null };
obj[0] = closure_4;
obj[1] = tmp2;
2026-07-20 16:05:17 +00:00
return obj;
2026-07-29 08:29:29 +00:00
} else if (tmp3.ML_SPAM !== arg0) {
const SERVER_POLICY = tmp3.SERVER_POLICY;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
obj = { keywordFilter: null, regexPatterns: null, allowList: null };
obj[0] = [];
obj[1] = [];
obj[2] = [];
2026-07-20 16:05:17 +00:00
return obj;
}
};