From 11e3b3095a2105df76dd4207b0dd94cbba3f2c27 Mon Sep 17 00:00:00 2001 From: Tarrgon <61888458+Tarrgon@users.noreply.github.com> Date: Wed, 4 Jun 2025 21:48:02 -0400 Subject: [PATCH] List notes context menu command --- src/context-menus/notes.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/context-menus/notes.ts diff --git a/src/context-menus/notes.ts b/src/context-menus/notes.ts new file mode 100644 index 0000000..232fe3d --- /dev/null +++ b/src/context-menus/notes.ts @@ -0,0 +1,23 @@ +import { ApplicationIntegrationType, Client, InteractionContextType, PermissionFlagsBits, ContextMenuCommandBuilder, ApplicationCommandType, UserContextMenuCommandInteraction, GuildBasedChannel } from 'discord.js'; +import { channelIsInStaffCategory, deferInteraction, getNoteMessage, handleWhoIsInteraction } from '../utils'; + +export default { + name: 'List Notes', + data: new ContextMenuCommandBuilder() + .setName('List Notes') + .setIntegrationTypes(ApplicationIntegrationType.GuildInstall) + .setContexts(InteractionContextType.Guild) + .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) + .setType(ApplicationCommandType.User), + handler: async function (client: Client, interaction: UserContextMenuCommandInteraction) { + const idToUse = interaction.targetUser.id; + + await deferInteraction(interaction); + + const noteMessage = await getNoteMessage(idToUse, 1); + + if (!noteMessage) return interaction.editReply(`No notes found for <@${idToUse}>`); + + interaction.editReply(noteMessage); + } +}; \ No newline at end of file