282 lines
14 KiB
TypeScript
282 lines
14 KiB
TypeScript
/* Metro module 15885; source: modules/guild_automod/AutomodTriggerConfigs.tsx; dependencies: [31, 11454, 1244, 15195, 10925, 2] */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as ExperimentUtilsModule from './ExperimentUtils.tsx'; /* Metro dependency 10925 */
|
|
import * as ConstantsModule from './Constants.tsx'; /* Metro dependency 11454 */
|
|
import * as PermissionUtilsModule from './PermissionUtils.tsx'; /* Metro dependency 15195 */
|
|
|
|
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
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const AutomodActionType = ConstantsModule.AutomodActionType;
|
|
const AutomodEventType = ConstantsModule.AutomodEventType;
|
|
const AutomodTriggerType = ConstantsModule.AutomodTriggerType;
|
|
object = {NEW: 'new', RECOMMENDED: 'recommended', BETA: 'beta', ALPHA: 'alpha'};
|
|
const object2 = {};
|
|
const SPAM_LINK = AutomodTriggerType.SPAM_LINK;
|
|
const object3 = {getDefaultRuleName: function() {
|
|
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.ffR2cM);
|
|
}};
|
|
const SPAM_LINK2 = AutomodTriggerType.SPAM_LINK;
|
|
object3.type = SPAM_LINK2;
|
|
let MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
|
|
object3.eventType = MESSAGE_SEND;
|
|
object3.perGuildMaxCount = 0;
|
|
let Set = global.Set;
|
|
object3.availableActionTypes = new Set();
|
|
Set = global.Set;
|
|
object3.flags = new Set();
|
|
Set = global.Set;
|
|
object3.defaultActionTypes = new Set();
|
|
object2[SPAM_LINK] = object3;
|
|
let KEYWORD = AutomodTriggerType.KEYWORD;
|
|
const object4 = {getDefaultRuleName: function() {
|
|
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.ffR2cM);
|
|
}};
|
|
const KEYWORD2 = AutomodTriggerType.KEYWORD;
|
|
object4.type = KEYWORD2;
|
|
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
|
|
object4.eventType = MESSAGE_SEND;
|
|
object4.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;
|
|
object4.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL, USER_COMMUNICATION_DISABLED]);
|
|
Set = global.Set;
|
|
object4.flags = new Set();
|
|
Set = global.Set;
|
|
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
|
|
object4.defaultActionTypes = new Set([BLOCK_MESSAGE]);
|
|
object2[KEYWORD] = object4;
|
|
let ML_SPAM = AutomodTriggerType.ML_SPAM;
|
|
const object5 = {getDefaultRuleName: function() {
|
|
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t['puF/Os']);
|
|
}};
|
|
const ML_SPAM2 = AutomodTriggerType.ML_SPAM;
|
|
object5.type = ML_SPAM2;
|
|
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
|
|
object5.eventType = MESSAGE_SEND;
|
|
object5.perGuildMaxCount = 1;
|
|
Set = global.Set;
|
|
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
|
|
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
|
|
object5.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL]);
|
|
Set = global.Set;
|
|
object5.flags = new Set([]);
|
|
Set = global.Set;
|
|
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
|
|
object5.defaultActionTypes = new Set([BLOCK_MESSAGE]);
|
|
object2[ML_SPAM] = object5;
|
|
let DEFAULT_KEYWORD_LIST = AutomodTriggerType.DEFAULT_KEYWORD_LIST;
|
|
const object6 = {getDefaultRuleName: function() {
|
|
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.LnGhZv);
|
|
}};
|
|
const DEFAULT_KEYWORD_LIST2 = AutomodTriggerType.DEFAULT_KEYWORD_LIST;
|
|
object6.type = DEFAULT_KEYWORD_LIST2;
|
|
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
|
|
object6.eventType = MESSAGE_SEND;
|
|
object6.perGuildMaxCount = 1;
|
|
Set = global.Set;
|
|
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
|
|
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
|
|
object6.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL]);
|
|
Set = global.Set;
|
|
object6.flags = new Set([]);
|
|
Set = global.Set;
|
|
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
|
|
object6.defaultActionTypes = new Set([BLOCK_MESSAGE]);
|
|
object2[DEFAULT_KEYWORD_LIST] = object6;
|
|
let MENTION_SPAM = AutomodTriggerType.MENTION_SPAM;
|
|
const object7 = {getDefaultRuleName: function() {
|
|
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.pX7i6n);
|
|
}};
|
|
const MENTION_SPAM2 = AutomodTriggerType.MENTION_SPAM;
|
|
object7.type = MENTION_SPAM2;
|
|
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
|
|
object7.eventType = MESSAGE_SEND;
|
|
object7.perGuildMaxCount = 1;
|
|
Set = global.Set;
|
|
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
|
|
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
|
|
USER_COMMUNICATION_DISABLED = AutomodActionType.USER_COMMUNICATION_DISABLED;
|
|
object7.availableActionTypes = new Set([BLOCK_MESSAGE, FLAG_TO_CHANNEL, USER_COMMUNICATION_DISABLED]);
|
|
Set = global.Set;
|
|
object7.flags = new Set([]);
|
|
Set = global.Set;
|
|
BLOCK_MESSAGE = AutomodActionType.BLOCK_MESSAGE;
|
|
object7.defaultActionTypes = new Set([BLOCK_MESSAGE]);
|
|
object2[MENTION_SPAM] = object7;
|
|
let USER_PROFILE = AutomodTriggerType.USER_PROFILE;
|
|
const object8 = {getDefaultRuleName: function() {
|
|
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.q1L2v8);
|
|
}};
|
|
const USER_PROFILE2 = AutomodTriggerType.USER_PROFILE;
|
|
object8.type = USER_PROFILE2;
|
|
const GUILD_MEMBER_JOIN_OR_UPDATE = AutomodEventType.GUILD_MEMBER_JOIN_OR_UPDATE;
|
|
object8.eventType = GUILD_MEMBER_JOIN_OR_UPDATE;
|
|
object8.perGuildMaxCount = 1;
|
|
Set = global.Set;
|
|
let QUARANTINE_USER = AutomodActionType.QUARANTINE_USER;
|
|
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
|
|
object8.availableActionTypes = new Set([QUARANTINE_USER, FLAG_TO_CHANNEL]);
|
|
Set = global.Set;
|
|
object8.flags = new Set([]);
|
|
Set = global.Set;
|
|
QUARANTINE_USER = AutomodActionType.QUARANTINE_USER;
|
|
object8.defaultActionTypes = new Set([QUARANTINE_USER]);
|
|
object2[USER_PROFILE] = object8;
|
|
let SERVER_POLICY = AutomodTriggerType.SERVER_POLICY;
|
|
const object9 = {getDefaultRuleName: function() {
|
|
return require(dependencyMap[2]).intl.string(require(dependencyMap[2]).t.ZQr92M);
|
|
}};
|
|
const SERVER_POLICY2 = AutomodTriggerType.SERVER_POLICY;
|
|
object9.type = SERVER_POLICY2;
|
|
MESSAGE_SEND = AutomodEventType.MESSAGE_SEND;
|
|
object9.eventType = MESSAGE_SEND;
|
|
object9.perGuildMaxCount = 1;
|
|
Set = global.Set;
|
|
FLAG_TO_CHANNEL = AutomodActionType.FLAG_TO_CHANNEL;
|
|
object9.availableActionTypes = new Set([FLAG_TO_CHANNEL]);
|
|
Set = global.Set;
|
|
const ALPHA = object.ALPHA;
|
|
object9.flags = new Set([ALPHA]);
|
|
Set = global.Set;
|
|
object9.defaultActionTypes = new Set();
|
|
object2[SERVER_POLICY] = object9;
|
|
const object10 = {MEMBERS: 'members', CONTENT: 'content'};
|
|
const object11 = {};
|
|
const MEMBERS = object10.MEMBERS;
|
|
USER_PROFILE = AutomodTriggerType.USER_PROFILE;
|
|
object11[MEMBERS] = [object2[USER_PROFILE]];
|
|
const CONTENT = object10.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;
|
|
object11[CONTENT] = [object2[SERVER_POLICY], object2[MENTION_SPAM], object2[ML_SPAM], object2[DEFAULT_KEYWORD_LIST],
|
|
object2[KEYWORD]];
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/guild_automod/AutomodTriggerConfigs.tsx');
|
|
exports.AutomodTriggerConfigFlags = object;
|
|
exports.triggerConfigs = object2;
|
|
exports.AutomodTriggerCategory = object10;
|
|
exports.AUTOMOD_RULE_CONFIGS_BY_CATEGORY = object11;
|
|
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 _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 = ReactModule.availableActionTypes;
|
|
return !availableActionTypes.has(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 ReactModule.useMemo(_fun122580,
|
|
[(PermissionUtilsModule).useIsUserProfileRuleEnabled(a0)]);
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 = (ExperimentUtilsModule).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;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun122566, 15885, [31, 11454, 1244, 15195, 10925,
|
|
2]) /* metro module 15885, dependencies: [31, 11454, 1244, 15195, 10925, 2] */;
|