Files
discord-decomp/sources/modules/guild_automod/GuildAutomodMessageStore.tsx
T
2026-07-28 01:06:53 +03:00

255 lines
14 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] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as MessageRecordUtilsModule from '../messages/MessageRecordUtils.tsx'; /* Metro dependency 4625 */
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 MESSAGE_SEND_FAILED_AUTOMOD2 = MESSAGE_SEND_FAILED_AUTOMOD;
const LOAD_MESSAGES_SUCCESS_656312 = LOAD_MESSAGES_SUCCESS_65631;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
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 = (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: LOAD_MESSAGES_SUCCESS_656312,
LOCAL_MESSAGES_LOADED: LOAD_MESSAGES_SUCCESS_656312, MESSAGE_CREATE: MESSAGE_CREATE_65644,
MESSAGE_SEND_FAILED_AUTOMOD: MESSAGE_SEND_FAILED_AUTOMOD2,
MESSAGE_EDIT_FAILED_AUTOMOD: MESSAGE_SEND_FAILED_AUTOMOD2,
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});
(FileImportTrackerModule).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 object = {id: failedMessageId};
object.isBlockedEdit = (require(4862) /* metro dependency 4862: MessageQueue */).isMessageDataEdit(messageData);
object.messageData = messageData;
object.errorMessage = (require(7246) /* metro dependency 7246: AutomodErrorUtils */).getAutomodErrorMessage(messageData,
errorResponseBody);
env0_13[failedMessageId] = object;
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 _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 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 GuildAutomodMessageStore2 = GuildAutomodMessageStore;
Inherits(GuildAutomodMessageStore2, a0);
return CreateClass(GuildAutomodMessageStore2, [{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 GuildAutomodMessageStore() { // fn#65636, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:1173, offset: 0x00e08324, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, GuildAutomodMessageStore);
const value3 = env1_6(GuildAutomodMessageStore);
return env1_5(this, _isNativeReflectConstruct_65627() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
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_65639(a0) { // fn#65639, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8368:1760, offset: 0x00f81888, size: 42 bytes, params: 2, frame: 4
const value = null;
return value == a0 ? value : value != env1_13[a0] ? env1_13[a0] : value;
}
function value_65640() { // fn#65640, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
return env1_14;
}
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;
}
}
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 = (MessageRecordUtilsModule).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;
}
}
global.__d(_fun65626, 8183, [6, 7, 15, 17, 18, 1379, 4814, 661, 4862, 7246, 4625, 5051, 21, 566, 694,
2]) /* metro module 8183, dependencies: [6, 7, 15, 17, 18, 1379, 4814, 661, 4862, 7246, 4625, 5051, 21, 566, 694, 2] */;