all repos — stealth-developers @ 730b0d63008e4d6dd26e61fe8b80bdbd46c6fcb3

feat: create threads on new bug reports
willow hai@wlo.moe
Sun, 25 May 2025 00:49:42 +0100
commit

730b0d63008e4d6dd26e61fe8b80bdbd46c6fcb3

parent

99d02e2e27b5c1af7b0feaa60eb7c4bd0a96621b

2 files changed, 20 insertions(+), 6 deletions(-)

jump to
M src/database/schemas.tssrc/database/schemas.ts

@@ -30,6 +30,7 @@ title: z.string(),

description: z.string(), sent: z.boolean().default(false), message_id: z.string().optional(), + thread_id: z.string().optional(), }); export const mediaSchema = z.object({

@@ -76,6 +77,7 @@ game: { type: String, enum: ["wft", "gw", "ab"], required: true },

description: { type: String, required: true }, sent: { type: Boolean, default: false }, message_id: String, + thread_id: String, }, { timestamps: true }, );
M src/interactions/commands/bug.tssrc/interactions/commands/bug.ts

@@ -288,24 +288,36 @@ .setEmoji("🔒"),

new ButtonBuilder() .setCustomId(`bug:edit:${bugId}`) .setLabel("edit") - .setStyle(ButtonStyle.Primary) - .setEmoji("✏️"), + .setStyle(ButtonStyle.Primary), new ButtonBuilder() .setCustomId(`bug:delete:${bugId}`) .setLabel("delete") - .setStyle(ButtonStyle.Danger) - .setEmoji("🗑️"), + .setStyle(ButtonStyle.Danger), new ButtonBuilder() .setCustomId("bug:new") .setLabel("new bug") - .setStyle(ButtonStyle.Success) - .setEmoji("🐛"), + .setStyle(ButtonStyle.Success), ); const message = await channel.send({ embeds: [embed], components: [buttons], }); + + try { + const thread = await message.startThread({ + name: `#${bugId}: ${title.substring(0, 50)}${title.length > 50 ? "..." : ""}`, + reason: `bug report thread for bug #${bugId}`, + }); + + await thread.members.add(interaction.user.id); + await thread.send({ + content: `thread created for bug #${bugId}. use this space to discuss the bug report, provide additional details, or ask questions.`, + }); + + bug.thread_id = thread.id; + await bug.save(); + } catch (error) {} msgUrl = message.url;