// src/preconditions/highRank.tsimport { Precondition, type ChatInputCommand, type PreconditionContext } from "@sapphire/framework";import type { ChatInputCommandInteraction } from "discord.js";import type { personnelInfo } from "../types/knex.ts";export class HighRankPrecondition extends Precondition { public override async chatInputRun(interaction: ChatInputCommandInteraction<'cached'>) { return await this.checkHighRank(interaction); } private async checkHighRank(interaction: ChatInputCommandInteraction<'cached'>) { const commandUser = await this.container.knex<personnelInfo>('personnel') .select('*') .where('discordId', interaction.user.id) .first(); if (commandUser && this.container.highRanks.includes(commandUser.acsdRank)) { interaction.cmdUser = commandUser; return this.ok(); } else return this.error({ message: 'bruh' }); }}
// src/preconditions/highRank.tsimport { Precondition, type ChatInputCommand, type PreconditionContext } from "@sapphire/framework";import type { ChatInputCommandInteraction } from "discord.js";import type { personnelInfo } from "../types/knex.ts";export class HighRankPrecondition extends Precondition { public override async chatInputRun(interaction: ChatInputCommandInteraction<'cached'>) { return await this.checkHighRank(interaction); } private async checkHighRank(interaction: ChatInputCommandInteraction<'cached'>) { const commandUser = await this.container.knex<personnelInfo>('personnel') .select('*') .where('discordId', interaction.user.id) .first(); if (commandUser && this.container.highRanks.includes(commandUser.acsdRank)) { interaction.cmdUser = commandUser; return this.ok(); } else return this.error({ message: 'bruh' }); }}
// src/listeners/chatInputCommandDenied.tsimport { Events, Listener, type ChatInputCommandDeniedPayload, type UserError } from '@sapphire/framework';export class ChatInputCommandDenied extends Listener<typeof Events.ChatInputCommandDenied> { public async run(error: UserError, { interaction }: ChatInputCommandDeniedPayload) { return interaction.deferred || interaction.replied ? await interaction.editReply({ content: error.message }) : await interaction.reply({ content: error.message }); }}
// src/listeners/chatInputCommandDenied.tsimport { Events, Listener, type ChatInputCommandDeniedPayload, type UserError } from '@sapphire/framework';export class ChatInputCommandDenied extends Listener<typeof Events.ChatInputCommandDenied> { public async run(error: UserError, { interaction }: ChatInputCommandDeniedPayload) { return interaction.deferred || interaction.replied ? await interaction.editReply({ content: error.message }) : await interaction.reply({ content: error.message }); }}
i intentionally made it so the precondition fails and i see that it fails since there is no response to the interaction. however, the listener doesnt work and it doesnt respond with "bruh". i followed the guide on preconditions and listeners and i'm not sure why it's not working. the