feat: Implement dynamic event loading and refactor event handlers into dedicated files.

This commit is contained in:
syntaxbullet
2025-12-14 22:21:28 +01:00
parent 32c614975e
commit 1eace32aa1
8 changed files with 166 additions and 78 deletions

View File

@@ -8,7 +8,8 @@ import {
ComponentType,
type BaseGuildTextChannel,
type ButtonInteraction,
PermissionFlagsBits
PermissionFlagsBits,
MessageFlags
} from "discord.js";
import { userService } from "@/modules/user/user.service";
import { inventoryService } from "@/modules/inventory/inventory.service";
@@ -31,7 +32,7 @@ export const sell = createCommand({
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
execute: async (interaction) => {
await interaction.deferReply({ ephemeral: true });
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
const itemId = interaction.options.getNumber("itemid", true);
const targetChannel = (interaction.options.getChannel("channel") as BaseGuildTextChannel) || interaction.channel as BaseGuildTextChannel;
@@ -90,7 +91,7 @@ export const sell = createCommand({
async function handleBuyInteraction(interaction: ButtonInteraction, item: typeof items.$inferSelect) {
try {
await interaction.deferReply({ ephemeral: true });
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
const userId = interaction.user.id;
const user = await userService.getUserById(userId);
@@ -118,7 +119,7 @@ async function handleBuyInteraction(interaction: ButtonInteraction, item: typeof
if (interaction.deferred || interaction.replied) {
await interaction.editReply({ content: "", embeds: [createErrorEmbed("An error occurred while processing your purchase.")] });
} else {
await interaction.reply({ embeds: [createErrorEmbed("An error occurred while processing your purchase.")], ephemeral: true });
await interaction.reply({ embeds: [createErrorEmbed("An error occurred while processing your purchase.")], flags: MessageFlags.Ephemeral });
}
}
}