decord/source/modules/messages/setupLoadFromMessageManagerHandlers.tsx

103 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-08-13 07:00:46 +00:00
// Module ID: 16579
// Function ID: 16580
2026-07-20 16:05:17 +00:00
// Name: setupLoadFromMessageManagerHandlers
2026-07-23 10:11:24 +00:00
// Dependencies: [2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-13 07:00:46 +00:00
// Module 16579 (setupLoadFromMessageManagerHandlers)
2026-07-23 10:11:24 +00:00
const result = require("set").fileFinishedImporting("modules/messages/setupLoadFromMessageManagerHandlers.tsx");
2026-07-20 16:05:17 +00:00
export default function setupLoadFromMessageManagerHandlers(actions) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1;
2026-07-29 08:29:29 +00:00
let obj = arg2;
2026-07-20 16:05:17 +00:00
if (arg2 === undefined) {
obj = {};
}
let onBeforeBatch;
let set;
function handleMessage(message) {
message = message.message;
let hasItem = null != message.channel_id;
if (hasItem) {
hasItem = set.has(message.channel_id);
}
if (hasItem) {
2026-07-29 08:29:29 +00:00
if (onBeforeBatch != null) {
tmp3();
}
let hasItem1 = null != message.channel_id;
if (hasItem1) {
hasItem1 = set.has(message.channel_id);
}
if (hasItem1) {
callback(message);
2026-07-20 16:05:17 +00:00
}
}
}
function handleLoadMessages(messages) {
messages = messages.messages;
set.add(messages.channelId);
2026-07-29 08:29:29 +00:00
if (onBeforeBatch != null) {
tmp2();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const item = messages.forEach((channel_id) => {
let hasItem = null != channel_id.channel_id;
if (hasItem) {
hasItem = set.has(channel_id.channel_id);
}
if (hasItem) {
callback(channel_id);
}
2026-07-20 16:05:17 +00:00
});
}
function handleSearchMessagesSuccess(data) {
data = data.data;
2026-07-29 08:29:29 +00:00
if (onBeforeBatch != null) {
tmp();
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let item = data.forEach((messages) => {
2026-07-20 16:05:17 +00:00
messages = messages.messages;
2026-07-23 10:11:24 +00:00
let item = messages.forEach((arr) => {
2026-07-29 08:29:29 +00:00
const item = arr.forEach((arg0) => callback(arg0));
2026-07-20 16:05:17 +00:00
});
});
}
onBeforeBatch = obj.onBeforeBatch;
set = new Set();
obj = {};
const merged = Object.assign(actions.actions);
2026-07-29 08:29:29 +00:00
obj.POST_CONNECTION_OPEN = function POST_CONNECTION_OPEN() {
2026-07-20 16:05:17 +00:00
set.clear();
};
2026-07-29 08:29:29 +00:00
obj.MESSAGE_CREATE = { callback: handleMessage, autoSubscribe: false };
obj.MESSAGE_UPDATE = handleMessage;
obj.LOAD_MESSAGES_SUCCESS = handleLoadMessages;
obj.LOAD_MESSAGES_AROUND_SUCCESS = handleLoadMessages;
obj.LOAD_RECENT_MENTIONS_SUCCESS = function LOAD_RECENT_MENTIONS_SUCCESS(messages) {
2026-07-20 16:05:17 +00:00
messages = messages.messages;
2026-07-29 08:29:29 +00:00
if (onBeforeBatch != null) {
tmp();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const item = messages.forEach((arg0) => callback(arg0));
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
obj.LOAD_PINNED_MESSAGES_SUCCESS = function LOAD_PINNED_MESSAGES_SUCCESS(pins) {
2026-07-20 16:05:17 +00:00
pins = pins.pins;
2026-07-29 08:29:29 +00:00
if (onBeforeBatch != null) {
tmp();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const item = pins.forEach((message) => callback(message.message));
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
obj.SEARCH_MESSAGES_SUCCESS = handleSearchMessagesSuccess;
obj.MOD_VIEW_SEARCH_MESSAGES_SUCCESS = handleSearchMessagesSuccess;
obj.CHANNEL_SELECT = {
2026-07-20 16:05:17 +00:00
callback(channelId) {
channelId = channelId.channelId;
if (null != channelId) {
set.add(channelId);
}
},
autoSubscribe: false
};
actions.actions = obj;
};