decord/source/modules/threads/ThreadManager.tsx

98 lines
3.3 KiB
TypeScript
Raw Normal View History

// Module ID: 17497
// Function ID: 17498
2026-07-29 08:29:29 +00:00
// Name: handleChannelDelete
// Dependencies: [502, 1957, 7118, 504, 573, 7898, 2]
2026-07-20 16:05:17 +00:00
// Module 17497 (handleChannelDelete)
import initializeDefault from "initialize" /* 7118 */;
import withErrorHandlingDefault from "withErrorHandling" /* 7898 */;
import closure_2 from "fetchFingerprint" /* 502 */;
import closure_3 from "ensureGuildLoaded" /* 1957 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
initializeDefault;
2026-07-29 08:29:29 +00:00
class ThreadManager extends tmp2 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
applyArgumentsResult.actions = { CHANNEL_DELETE: applyArgumentsResult.handleChannelDelete, MESSAGE_CREATE: applyArgumentsResult.handleMessageCreate, GUILD_DELETE: applyArgumentsResult.handleGuildDelete };
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
const prototype = ThreadManager.prototype;
prototype["handleChannelDelete"] = function handleChannelDelete(channel) {
channel = channel.channel;
let allThreadsForParent;
if (null != channel.guild_id) {
allThreadsForParent = store.getAllThreadsForParent(channel.id);
if (allThreadsForParent.length > 0) {
const Emitter = allThreadsForParent(504).Emitter;
2026-07-29 08:29:29 +00:00
Emitter.batched(() => {
for (const item10005 of allThreadsForParent) {
let tmp = allThreadsForParent;
2026-08-24 06:08:38 +00:00
let tmp2 = closure_1_1;
let obj = allThreadsForParent(closure_1_1[4]);
2026-07-29 08:29:29 +00:00
obj = { type: "THREAD_DELETE", channel: null };
obj[1] = item10005;
let dispatchResult = obj.dispatch(obj);
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
});
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
};
prototype["handleMessageCreate"] = function handleMessageCreate(channelId) {
const channel = store.getChannel(channelId.channelId);
const author = channelId.message.author;
let id;
if (author != null) {
id = author.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (id === id.getId()) {
let isActiveThreadResult;
if (channel != null) {
isActiveThreadResult = channel.isActiveThread();
}
if (isActiveThreadResult) {
const threadMetadata = channel.threadMetadata;
let num;
if (threadMetadata != null) {
num = threadMetadata.archiveTimestamp;
}
if (num == null) {
num = 0;
}
const date = new Date(num);
const _Date = Date;
const time = date.getTime();
if (Date.now() - time < 5000) {
2026-08-24 06:08:38 +00:00
withErrorHandlingDefault.resort(channel.parent_id);
const obj3 = withErrorHandlingDefault;
2026-07-29 08:29:29 +00:00
}
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
prototype["handleGuildDelete"] = function handleGuildDelete(guild) {
guild = guild.guild;
let allThreadsForGuild;
if (!guild.unavailable) {
allThreadsForGuild = store.getAllThreadsForGuild(guild.id);
if (0 !== allThreadsForGuild.length) {
const Emitter = allThreadsForGuild(504).Emitter;
2026-07-29 08:29:29 +00:00
Emitter.batched(() => {
for (const item10005 of allThreadsForGuild) {
let tmp = allThreadsForGuild;
2026-08-24 06:08:38 +00:00
let tmp2 = closure_1_1;
let obj = allThreadsForGuild(closure_1_1[4]);
2026-07-29 08:29:29 +00:00
obj = { type: "THREAD_DELETE", channel: null };
obj[1] = item10005;
let dispatchResult = obj.dispatch(obj);
continue;
}
});
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
const threadManager = new ThreadManager();
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/threads/ThreadManager.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default threadManager;