Created At: 2026-11-18T04:15:01Z
Completed At: 2026-11-18T04:15:01Z
Command exited with code 0.
Command output:
const logGroupId = process.env.LOG_GROUP_ID;
if (!logGroupId) {
console.log("[THREAD] LOG_GROUP_ID is not configured in env");
return null;
}
try {
const topicName = `${firstName} (${userId}) ${username ? '@' + username : ''}`.trim();
console.log(`[THREAD] Creating forum topic for user ${userId}: ${topicName}`);
const topic = await ctx.telegram.createForumTopic(logGroupId, topicName.substring(0, 128));
threadId = topic.message_thread_id;
await updateUserThreadId(userId, threadId, firstName);
await ctx.telegram.sendMessage(logGroupId, `š User Registered\nš¤ Name: ${firstName}\nš ID: ${userId}\nāļø Username: ${username ? '@' + username : 'None'}`, {
parse_mode: 'HTML',
message_thread_id: threadId
});
return threadId;
} catch (e) {
console.error("Error:", e);
console.error("[THREAD] Failed to create forum topic:", e.message);
if (e.message.includes("chat is not a forum")) {
console.log("[THREAD] Log group is not a forum (Topics not enabled). Falling back to direct group logs.");
await updateUserThreadId(userId, -1, firstName);
await ctx.telegram.sendMessage(logGroupId, `š User Registered\nš¤ Name: ${firstName}\nš ID: ${userId}\nāļø Username: ${username ? '@' + username : 'None'}`, {
parse_mode: 'HTML'
}).catch(() => { });
return -1;
}
return null;
}