bot(bug-reports): retain original attachments
vi did:web:vt3e.cat
Sat, 04 Jul 2026 19:48:15 +0100
3 files changed,
77 insertions(+),
20 deletions(-)
M
apps/bot/src/feats/bugs/modals.ts
→
apps/bot/src/feats/bugs/modals.ts
@@ -2,7 +2,7 @@ import { option } from "@purrkit/router";
import db, { bugs, eq, getActor, sql } from "@stealth-developers/db"; import { AttachmentBuilder } from "discord.js"; -import { errorMessage, getTextChannel } from "@/lib"; +import { errorMessage, getTextChannel, logger } from "@/lib"; import { useGetData } from "@/middleware"; import { constructBugContainer } from "./shared";@@ -153,20 +153,28 @@
const originalActor = await getActor(updatedBug.actorId); if (!originalActor) return errorMessage(interaction, "Failed to fetch original bug author."); - const container = await constructBugContainer(updatedBug, originalActor); - if (!container) return; - - const channel = await getTextChannel("1512924775842840767"); + const channel = await getTextChannel("1520861689048993843"); if (!channel) return errorMessage(interaction, "Failed to find bug report channel."); + let message; if (updatedBug.messageId) { try { - const message = await channel.messages.fetch(updatedBug.messageId); + message = await channel.messages.fetch(updatedBug.messageId); + } catch (err) { + logger.error(err, "error fetching discord message"); + } + } + + const container = await constructBugContainer(updatedBug, originalActor, undefined, message); + if (!container) return; + + if (message) { + try { await message.edit({ components: [container], }); } catch (err) { - console.error("error updating discord message:", err); + logger.error(err, "error updating discord message"); } }