all repos — stealth-developers @ 109863efd2a45dd592cbb2de78d17e0a5a7b71be

bot: create moderator thread
vi did:web:vt3e.cat
Sun, 28 Jun 2026 01:25:19 +0100
commit

109863efd2a45dd592cbb2de78d17e0a5a7b71be

parent

0d45f96600b1ac839d91f93ea7dc0b564e8ec190

1 files changed, 24 insertions(+), 0 deletions(-)

jump to
M apps/bot/src/feats/tickets/actions/lifecycle.tsapps/bot/src/feats/tickets/actions/lifecycle.ts

@@ -225,6 +225,30 @@ .update(tickets)

.set({ channelId: channel.id, status: "open" }) .where(eq(tickets.id, ticket.id)); + try { + const modThread = await channel.threads.create({ + name: `${String(ticket.id).padStart(4, "0")} - mod thread`, + type: ChannelType.PrivateThread, + autoArchiveDuration: 10080, + reason: "Private discussion thread for moderators", + }); + + await modThread.send({ + content: `This thread is only visible to moderators, use it to discuss the ticket.`, + }); + + await channel.send({ + content: `Moderator thread created at ${modThread.url}`, + }); + + await db.update(tickets).set({ threadId: modThread.id }).where(eq(tickets.id, ticket.id)); + } catch (threadError) { + logger.error( + threadError, + `Failed to create private moderator thread for ticket ${ticket.id}`, + ); + } + channel .edit({ name: channelName(localId, "open"),