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

229 lines
11 KiB
TypeScript

/* Metro module 8183; source: modules/guild_automod/GuildAutomodMessageStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 4814, 661, 4862, 7246, 4625, 5051, 21, 566, 694, 2] */
function _fun65626(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#65626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:6, offset: 0x01bd5b73, size: 494 bytes, params: 8, frame: 21
const env0_0 = require;
const closure = MESSAGE_SEND_FAILED_AUTOMOD;
const closure2 = LOAD_MESSAGES_SUCCESS_65631;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_10 = value.AbortCodes;
const env0_11 = value.MessageEmbedTypes;
const env0_12 = value.MessageTypes;
const env0_13 = {};
const env0_15 = {};
const env0_16 = {};
const PersistedStore = (importDefault(566) /* metro dependency 566: flux */).PersistedStore;
value = _fun65635(PersistedStore);
value.displayName = 'GuildAutomodMessageStore';
value.persistKey = 'GuildAutomodMessages';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{CONNECTION_OPEN: CONNECTION_OPEN_65643, LOAD_MESSAGES_SUCCESS: closure2, LOCAL_MESSAGES_LOADED: closure2,
MESSAGE_CREATE: MESSAGE_CREATE_65644, MESSAGE_SEND_FAILED_AUTOMOD: closure,
MESSAGE_EDIT_FAILED_AUTOMOD: closure, REMOVE_AUTOMOD_MESSAGE_NOTICE: function({messageId}) {
removeFailedMessage(messageId);
return true;
}, MESSAGE_END_EDIT: function({response}) {
var value = undefined;
if ((response == null ? value : response.body) == null) {
return false;
}
if (response.body.code === AbortCodes.AUTOMOD_MESSAGE_BLOCKED) {
return false;
}
response = response.body.id;
if (response == null) {
return false;
}
removeFailedMessage(response);
return value;
}, AUTO_MODERATION_MENTION_RAID_DETECTION: AUTO_MODERATION_MENTION_RAID_DETECTION,
AUTO_MODERATION_MENTION_RAID_NOTICE_DISMISS: AUTO_MODERATION_MENTION_RAID_NOTICE_DISMISS});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_automod/GuildAutomodMessageStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_65627() { // fn#65627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:232, offset: 0x01bd5d61, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_65627_isNativeReflectConstruct = function() {
return !!result;
})();
}
function MESSAGE_EDIT_FAILED_AUTOMOD_65630({messageData, errorResponseBody}) { // fn#65630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:501, offset: 0x01bd5dc3, size: 139 bytes, params: 2, frame: 19
const failedMessageId = (require(4862) /* metro dependency 4862: MessageQueue */).getFailedMessageId(messageData);
const object2 = {id: failedMessageId};
object2.isBlockedEdit = (require(4862) /* metro dependency 4862: MessageQueue */).isMessageDataEdit(messageData);
object2.messageData = messageData;
object2.errorMessage = (require(7246) /* metro dependency 7246: AutomodErrorUtils */).getAutomodErrorMessage(messageData,
errorResponseBody);
env0_13[failedMessageId] = object2;
const binding = env0_14;
env0_14 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
return true;
}
function LOAD_MESSAGES_SUCCESS_65631({channelId, messages}) { // fn#65631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:765, offset: 0x01bd5e4e, size: 123 bytes, params: 2, frame: 16
const guildId = ChannelStore.getChannel(channelId)?.getGuildId();
if (guildId == null) {
return false;
}
const value5 = messages.reduce(_fun65632, env0_16[guildId]);
let r0 = value5 != null && env0_16[guildId] !== value5;
if (r0) {
env0_16[guildId] = value5;
r0 = true;
}
return r0;
}
function removeFailedMessage(a0) { // fn#65634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:468, offset: 0x01bd5f6f, size: 43 bytes, params: 2, frame: 4
if (env0_13[a0] != null) {
delete env0_13[a0];
}
const binding = env0_14;
env0_14 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
function _fun65635(a0) { // fn#65635, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:1161, offset: 0x01bd5f9a, size: 203 bytes, params: 2, frame: 16
const closure = GuildAutomodMessageStore;
env0_7(closure, a0);
return env0_4(closure, [{key: 'initialize', value: function(a0) {
this.waitFor(ChannelStore, MessageStore);
if (a0 != null) {
env1_13 = a0.automodFailedMessages;
env1_15 = a0.mentionRaidDetectionByGuild;
}
}}, {key: 'getState', value: value_65638}, {key: 'getMessage', value: value_65639}, {key: 'getMessagesVersion',
value: value_65640}, {key: 'getMentionRaidDetected', value: value_65641}, {key: 'getLastIncidentAlertMessage',
value: value_65642}]);
}
function CONNECTION_OPEN_65643() { // fn#65643, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:2194, offset: 0x01bd60fc, size: 60 bytes, params: 1, frame: 12
const Object = global.Object;
return Object.keys(env0_13).length !== 0 && true;
}
function MESSAGE_CREATE_65644({guildId, message}) { // fn#65644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:2372, offset: 0x01bd6138, size: 177 bytes, params: 2, frame: 16
var r1;
var r0;
var isAutomodNotification2;
if (guildId == null) {
return false;
}
const type = message.type;
const AUTO_MODERATION_ACTION = MessageTypes.AUTO_MODERATION_ACTION;
if (type !== AUTO_MODERATION_ACTION) {
return false;
}
const messageRecord = (require(4625) /* metro dependency 4625: MessageRecordUtils */).createMessageRecord(message);
const isAutomodMessageRecord2 = (require(5051) /* metro dependency 5051: AutomodMessageUtils */).isAutomodMessageRecord(messageRecord);
if (isAutomodMessageRecord2) {
isAutomodNotification2 = (require(5051) /* metro dependency 5051: AutomodMessageUtils */).isAutomodNotification(messageRecord);
if (isAutomodNotification2) {
env0_16[guildId] = messageRecord.id;
r1 = true;
} else {
r1 = !!isAutomodNotification2;
}
r0 = r1;
} else {
r0 = !!isAutomodMessageRecord2;
}
return r0;
}
function AUTO_MODERATION_MENTION_RAID_DETECTION({guildId, decisionId, suspiciousMentionActivityUntil}) { // fn#65647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:3126, offset: 0x01bd6262, size: 51 bytes, params: 2, frame: 6
env0_15[guildId] = {guildId: guildId, decisionId: decisionId,
suspiciousMentionActivityUntil: suspiciousMentionActivityUntil};
return true;
}
function AUTO_MODERATION_MENTION_RAID_NOTICE_DISMISS({guildId}) { // fn#65648, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:3339, offset: 0x01bd6295, size: 23 bytes, params: 2, frame: 2
delete env0_15[guildId];
return true;
}
function _fun65632(a0, a1) { // fn#65632, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:918, offset: 0x01bd5ec9, size: 139 bytes, params: 3, frame: 19
var id;
var r0;
var embeds;
var value3;
var defaultImport;
var compare;
let value = a0;
const type = a1.type;
const AUTO_MODERATION_ACTION = MessageTypes.AUTO_MODERATION_ACTION;
if (type !== AUTO_MODERATION_ACTION) {
r0 = value;
} else {
embeds = a1.embeds;
value3 = undefined;
if (embeds == null ? value3 : embeds.some(function({type}) {
return type === MessageEmbedTypes.AUTO_MODERATION_NOTIFICATION;
})) {
if (value == null) {
id = a1.id;
} else {
defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
compare = defaultImport.compare;
id = a1.id;
value = Reflect.apply(compare, defaultImport, [value, id]);
id = value !== -1 ? value3 : a1.id;
}
r0 = id;
} else {
r0 = value;
}
}
return r0;
}
function value_65638() { // fn#65638, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:1634, offset: 0x01bd60a0, size: 36 bytes, params: 1, frame: 3
return {automodFailedMessages: env1_13, mentionRaidDetectionByGuild: env1_15, lastIncidentAlertMessage: env1_16};
}
function value_65641(a0) { // fn#65641, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:1912, offset: 0x01bd60c4, size: 28 bytes, params: 2, frame: 3
let value = environment.__proto__;
const property = env1_15[a0];
value = null;
return value != property ? property : value;
}
function value_65642(a0) { // fn#65642, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:2002, offset: 0x01bd60e0, size: 28 bytes, params: 2, frame: 3
let value = environment.__proto__;
const property = env1_16[a0];
value = null;
return value != property ? property : value;
}