Files
discord-decomp/sources/modules/guild_automod/AutomodTriggerConfigs.tsx
T
2026-07-27 16:20:00 +03:00

278 lines
13 KiB
TypeScript

/* Metro module 15885; source: modules/guild_automod/AutomodTriggerConfigs.tsx; dependencies: [31, 11454, 1244, 15195, 10925, 2] */
function _fun122566(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#122566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:6, offset: 0x0256c19e, size: 1736 bytes, params: 8, frame: 27
var object12;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importAll(31) /* metro dependency 31 */;
const constantsModule = require(11454) /* metro dependency 11454: Constants */;
const AutomodActionType = constantsModule.AutomodActionType;
const AutomodEventType = constantsModule.AutomodEventType;
const AutomodTriggerType = constantsModule.AutomodTriggerType;
const env0_4 = constantsModule.MENTION_SPAM_LIMIT_DEFAULT;
object12 = {NEW: 'new', RECOMMENDED: 'recommended', BETA: 'beta', ALPHA: 'alpha'};
const object13 = {};
const SPAM_LINK = AutomodTriggerType.SPAM_LINK;
const object14 = {getDefaultRuleName: function() {
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.ffR2cM);
}};
const SPAM_LINK2 = AutomodTriggerType.SPAM_LINK;
object14.type = SPAM_LINK2;
let MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
object14.eventType = MESSAGE_SEND;
object14.perGuildMaxCount = 0;
let Set = global.Set;
object14.availableActionTypes = new Set();
Set = global.Set;
object14.flags = new Set();
Set = global.Set;
object14.defaultActionTypes = new Set();
object13[SPAM_LINK] = object14;
let KEYWORD = AutomodTriggerType.KEYWORD;
const object15 = {getDefaultRuleName: function() {
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.ffR2cM);
}};
const KEYWORD2 = AutomodTriggerType.KEYWORD;
object15.type = KEYWORD2;
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
object15.eventType = MESSAGE_SEND;
object15.perGuildMaxCount = 6;
Set = global.Set;
let BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
let FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
let USER_COMMUNICATION_DISABLED = AutomodActionType.USER_COMMUNICATION_DISABLED;
object15.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL, USER_COMMUNICATION_DISABLED]);
Set = global.Set;
object15.flags = new Set();
Set = global.Set;
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
object15.defaultActionTypes = new Set([BLOCK_MESSAGE]);
object13[KEYWORD] = object15;
let ML_SPAM = AutomodTriggerType.ML_SPAM;
const object16 = {getDefaultRuleName: function() {
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t['puF/Os']);
}};
const ML_SPAM2 = AutomodTriggerType.ML_SPAM;
object16.type = ML_SPAM2;
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
object16.eventType = MESSAGE_SEND;
object16.perGuildMaxCount = 1;
Set = global.Set;
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
object16.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL]);
Set = global.Set;
object16.flags = new Set([]);
Set = global.Set;
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
object16.defaultActionTypes = new Set([BLOCK_MESSAGE]);
object13[ML_SPAM] = object16;
let DEFAULT_KEYWORD_LIST = AutomodTriggerType.DEFAULT_KEYWORD_LIST;
const object17 = {getDefaultRuleName: function() {
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.LnGhZv);
}};
const DEFAULT_KEYWORD_LIST2 = AutomodTriggerType.DEFAULT_KEYWORD_LIST;
object17.type = DEFAULT_KEYWORD_LIST2;
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
object17.eventType = MESSAGE_SEND;
object17.perGuildMaxCount = 1;
Set = global.Set;
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
object17.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL]);
Set = global.Set;
object17.flags = new Set([]);
Set = global.Set;
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
object17.defaultActionTypes = new Set([BLOCK_MESSAGE]);
object13[DEFAULT_KEYWORD_LIST] = object17;
let MENTION_SPAM = AutomodTriggerType.MENTION_SPAM;
const object18 = {getDefaultRuleName: function() {
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.pX7i6n);
}};
const MENTION_SPAM2 = AutomodTriggerType.MENTION_SPAM;
object18.type = MENTION_SPAM2;
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
object18.eventType = MESSAGE_SEND;
object18.perGuildMaxCount = 1;
Set = global.Set;
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
USER_COMMUNICATION_DISABLED = AutomodActionType.USER_COMMUNICATION_DISABLED;
object18.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL, USER_COMMUNICATION_DISABLED]);
Set = global.Set;
object18.flags = new Set([]);
Set = global.Set;
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
object18.defaultActionTypes = new Set([BLOCK_MESSAGE]);
object13[MENTION_SPAM] = object18;
let USER_PROFILE = AutomodTriggerType.USER_PROFILE;
const object19 = {getDefaultRuleName: function() {
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.q1L2v8);
}};
const USER_PROFILE2 = AutomodTriggerType.USER_PROFILE;
object19.type = USER_PROFILE2;
const GUILD_MEMBER_JOIN_OR_UPDATE = AutomodEventType.GUILD_MEMBER_JOIN_OR_UPDATE;
object19.eventType = GUILD_MEMBER_JOIN_OR_UPDATE;
object19.perGuildMaxCount = 1;
Set = global.Set;
let QUARANTINE_USER = AutomodActionType.QUARANTINE_USER;
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
object19.availableActionTypes = new Set([QUARANTINE_USER, FLAG_TO_CHANNEL]);
Set = global.Set;
object19.flags = new Set([]);
Set = global.Set;
QUARANTINE_USER = AutomodActionType.QUARANTINE_USER;
object19.defaultActionTypes = new Set([QUARANTINE_USER]);
object13[USER_PROFILE] = object19;
let SERVER_POLICY = AutomodTriggerType.SERVER_POLICY;
const object20 = {getDefaultRuleName: function() {
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.ZQr92M);
}};
const SERVER_POLICY2 = AutomodTriggerType.SERVER_POLICY;
object20.type = SERVER_POLICY2;
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
object20.eventType = MESSAGE_SEND;
object20.perGuildMaxCount = 1;
Set = global.Set;
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
object20.availableActionTypes = new Set([FLAG_TO_CHANNEL]);
Set = global.Set;
const ALPHA = object12.ALPHA;
object20.flags = new Set([ALPHA]);
Set = global.Set;
object20.defaultActionTypes = new Set();
object13[SERVER_POLICY] = object20;
const object21 = {MEMBERS: 'members', CONTENT: 'content'};
const object22 = {};
const MEMBERS = object21.MEMBERS;
USER_PROFILE = AutomodTriggerType.USER_PROFILE;
object22[MEMBERS] = [object13[USER_PROFILE]];
const CONTENT = object21.CONTENT;
SERVER_POLICY = AutomodTriggerType.SERVER_POLICY;
MENTION_SPAM = AutomodTriggerType.MENTION_SPAM;
ML_SPAM = AutomodTriggerType.ML_SPAM;
DEFAULT_KEYWORD_LIST = AutomodTriggerType.DEFAULT_KEYWORD_LIST;
KEYWORD = AutomodTriggerType.KEYWORD;
object22[CONTENT] = [object13[SERVER_POLICY], object13[MENTION_SPAM], object13[ML_SPAM],
object13[DEFAULT_KEYWORD_LIST], object13[KEYWORD]];
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_automod/AutomodTriggerConfigs.tsx');
exports.AutomodTriggerConfigFlags = object12;
exports.triggerConfigs = object13;
exports.AutomodTriggerCategory = object21;
exports.AUTOMOD_RULE_CONFIGS_BY_CATEGORY = object22;
exports.checkTriggerTypeForFlag = checkTriggerTypeForFlag;
exports.getAvailableActionTypes = getAvailableActionTypes;
exports.validateRuleByTriggerConfigOrThrow = validateRuleByTriggerConfigOrThrow;
exports.useAvailableTriggerTypes = useAvailableTriggerTypes;
exports.getDefaultTriggerMetadataForTriggerType = getDefaultTriggerMetadataForTriggerType;
}
function checkTriggerTypeForFlag(a0, a1) { // fn#122574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:2642, offset: 0x0256c9dc, size: 34 bytes, params: 3, frame: 11
return env0_5[a0].flags.has(a1);
}
function getAvailableActionTypes(a0) { // fn#122575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:2693, offset: 0x0256c9fe, size: 40 bytes, params: 2, frame: 12
const Array = global.Array;
return Array.from(env0_5[a0].availableActionTypes);
}
function validateRuleByTriggerConfigOrThrow({id, eventType, triggerType, actions}, a1) { // fn#122576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:2812, offset: 0x0256ca26, size: 245 bytes, params: 3, frame: 16
var Error;
var value;
const property = env0_5[triggerType];
if (a1.filter(_fun122577).length > property.perGuildMaxCount) {
Error = global.Error;
value = 'You have exceeded the maximum number of rules of type ' + triggerType;
throw new Error();
}
if (actions.some(_fun122578)) {
throw new global.Error('You have provided an action that is not available for this trigger type');
}
if (eventType !== property.eventType) {
throw new global.Error('You have provided an event type that is not available for this trigger type');
}
}
function useAvailableTriggerTypes(a0) { // fn#122579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:3348, offset: 0x0256cb65, size: 77 bytes, params: 2, frame: 14
return env0_2.useMemo(_fun122580,
[(require(15195) /* metro dependency 15195: PermissionUtils */).useIsUserProfileRuleEnabled(a0)]);
}
function getDefaultTriggerMetadataForTriggerType(a0, a1) { // fn#122584, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:3722, offset: 0x0256cc94, size: 204 bytes, params: 3, frame: 14
const isInMentionRaidExperiment2 = (require(10925) /* metro dependency 10925: ExperimentUtils */).isInMentionRaidExperiment(a1);
const DEFAULT_KEYWORD_LIST = AutomodTriggerType.DEFAULT_KEYWORD_LIST;
if (DEFAULT_KEYWORD_LIST === a0) {
return {allowList: [], presets: []};
}
const USER_PROFILE = AutomodTriggerType.USER_PROFILE;
if (USER_PROFILE === a0) {
return {keywordFilter: [], regexPatterns: [], allowList: []};
}
const KEYWORD = AutomodTriggerType.KEYWORD;
if (KEYWORD === a0) {
return {keywordFilter: [], regexPatterns: [], allowList: []};
}
const MENTION_SPAM = AutomodTriggerType.MENTION_SPAM;
if (MENTION_SPAM === a0) {
return {mentionTotalLimit: MENTION_SPAM_LIMIT_DEFAULT,
mentionRaidProtectionEnabled: isInMentionRaidExperiment2};
}
const ML_SPAM = AutomodTriggerType.ML_SPAM;
if (ML_SPAM !== a0) {
AutomodTriggerType.SERVER_POLICY;
}
}
function _fun122577(a0) { // fn#122577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:2926, offset: 0x0256cb1b, size: 38 bytes, params: 2, frame: 4
return id !== a0.id && a0.triggerType === triggerType;
}
function _fun122578({type}) { // fn#122578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:3074, offset: 0x0256cb41, size: 36 bytes, params: 2, frame: 11
const availableActionTypes = env0_2.availableActionTypes;
return !availableActionTypes.has(type);
}
function _fun122580() { // fn#122580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:3448, offset: 0x0256cbb2, size: 84 bytes, params: 1, frame: 14
var environment;
const value = environment.__proto__;
const {MEMBERS, CONTENT} = env1_6;
const Object = global.Object;
return Object.keys(env1_7).reduce(_fun122581, {[MEMBERS]: [], [CONTENT]: []});
}
function _fun122581(a0, a1) { // fn#122581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:3521, offset: 0x0256cc06, size: 59 bytes, params: 3, frame: 14
var environment;
let value = environment.__proto__.__proto__;
value = env2_7[a1].filter(_fun122582);
a0[a1] = value.map(function(a0) {
return a0.type;
});
return a0;
}
function _fun122582(a0) { // fn#122582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16093:3548, offset: 0x0256cc41, size: 83 bytes, params: 2, frame: 4
var r3;
var r0;
const type = a0.type;
let value = environment.__proto__.__proto__.__proto__;
const SERVER_POLICY = AutomodTriggerType.SERVER_POLICY;
const value2 = type !== SERVER_POLICY;
if (value2) {
value = a0.type === AutomodTriggerType.USER_PROFILE;
if (value) {
value = environment.__proto__.__proto__;
value = !env2_0;
r3 = value;
} else {
r3 = value;
}
value = !r3;
r0 = r3 ? value : a0.perGuildMaxCount > 0;
} else {
r0 = value2;
}
return r0;
}