all repos — stealth-developers @ 54c2c683f1fd005da86b4962783477b066ac0f59

fix(bugs): fix everyone being able to delete bugs
vi v@vt3e.cat
Wed, 11 Mar 2026 20:50:43 +0000
commit

54c2c683f1fd005da86b4962783477b066ac0f59

parent

72ca0341392ac4531592216c49b26f2f2f0ffd73

1 files changed, 14 insertions(+), 2 deletions(-)

jump to
M src/interactions/commands/bug/buttons.tssrc/interactions/commands/bug/buttons.ts

@@ -1,9 +1,10 @@

import config from "@/config"; import { bugs, db } from "@/database"; import { getGuild } from "@/utils/queries"; -import type { ButtonInteraction, Client } from "discord.js"; +import type { ButtonInteraction, Client, GuildMember } from "discord.js"; import { eq } from "drizzle-orm"; import { buildReportModal, updateBugEmbed } from "./_shared"; +import { hasManagerPermissions } from "@/utils/permissions"; async function fetchBugById(id: string) { const parsedId = Number(id);

@@ -154,7 +155,18 @@ content: "❌ Bug not found.",

flags: ["Ephemeral"], }); return; - } + } + + const isManager = await hasManagerPermissions(interaction.member as GuildMember) + const isBugReporter = bug.reporterId === interaction.user.id + + if (!isManager && !isBugReporter) { + await interaction.reply({ + content: "❌ You don't have permission to delete this bug.", + flags: ["Ephemeral"], + }); + return; + } await db.delete(bugs).where(eq(bugs.id, bug.id)); const { data, exists } = await getGuild(interaction.guildId);