import { createCommand } from "@shared/lib/utils"; import { SlashCommandBuilder, PermissionFlagsBits, MessageFlags } from "discord.js"; import { ModerationService } from "@shared/modules/moderation/moderation.service"; import { getCasesListEmbed, getModerationErrorEmbed } from "@/modules/moderation/moderation.view"; export const notes = createCommand({ data: new SlashCommandBuilder() .setName("notes") .setDescription("View all staff notes for a user") .addUserOption(option => option .setName("user") .setDescription("The user to check notes for") .setRequired(true) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), execute: async (interaction) => { await interaction.deferReply({ flags: MessageFlags.Ephemeral }); try { const targetUser = interaction.options.getUser("user", true); // Get all notes for the user const userNotes = await ModerationService.getUserNotes(targetUser.id); // Display the notes await interaction.editReply({ embeds: [getCasesListEmbed( userNotes, `📝 Staff Notes for ${targetUser.username}`, userNotes.length === 0 ? undefined : `Total notes: **${userNotes.length}**` )] }); } catch (error) { console.error("Notes command error:", error); await interaction.editReply({ embeds: [getModerationErrorEmbed("An error occurred while fetching notes.")] }); } } });