chore(auto): task completed - unknown

This commit is contained in:
MythEclipse
2026-06-13 13:35:11 +07:00
parent d569ffa2db
commit 2e14b5e4ed
22 changed files with 516 additions and 172 deletions
@@ -7,8 +7,11 @@ const logger = createChildLogger("thread-tracking");
function isMonitoredGuild(guildId: string | null | undefined): boolean {
if (!guildId) return false;
const guildIds = (config as any).EFFECTIVE_MONITOR_GUILD_IDS as string[] | undefined;
if (!guildIds || guildIds.length === 0) return config.MONITOR_GUILD_ID === guildId;
const guildIds = (config as any).EFFECTIVE_MONITOR_GUILD_IDS as
| string[]
| undefined;
if (!guildIds || guildIds.length === 0)
return config.MONITOR_GUILD_ID === guildId;
return guildIds.includes(guildId);
}
@@ -51,20 +54,23 @@ export function registerThreadCapture(
await eventBroadcaster.threadDeleted(data).catch(() => {});
});
client.on("threadUpdate", async (_oldThread: ThreadChannel, newThread: ThreadChannel) => {
if (!isMonitoredGuild(newThread.guildId)) return;
client.on(
"threadUpdate",
async (_oldThread: ThreadChannel, newThread: ThreadChannel) => {
if (!isMonitoredGuild(newThread.guildId)) return;
const data = {
id: newThread.id,
guild_id: newThread.guildId,
channel_id: newThread.parentId ?? newThread.guildId,
name: newThread.name,
archived: (newThread as any).archived ?? false,
rate_limit_per_user: (newThread as any).rateLimitPerUser ?? null,
updated_at: Date.now(),
};
const data = {
id: newThread.id,
guild_id: newThread.guildId,
channel_id: newThread.parentId ?? newThread.guildId,
name: newThread.name,
archived: (newThread as any).archived ?? false,
rate_limit_per_user: (newThread as any).rateLimitPerUser ?? null,
updated_at: Date.now(),
};
logger.debug({ threadId: newThread.id }, "Thread updated");
await eventBroadcaster.threadUpdated(data).catch(() => {});
});
logger.debug({ threadId: newThread.id }, "Thread updated");
await eventBroadcaster.threadUpdated(data).catch(() => {});
},
);
}