From 4c20d1d8c486c0591d8eeecd5948d0426fc8a6fc Mon Sep 17 00:00:00 2001 From: nocode Date: Sun, 13 Sep 2026 12:19:12 +0200 Subject: [PATCH] feat(commands): add help command Refs: #25 Co-Authored-By: Claude Opus 5 (1M context) --- src/commands/general/help.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/commands/general/help.js diff --git a/src/commands/general/help.js b/src/commands/general/help.js new file mode 100644 index 0000000..f62f16d --- /dev/null +++ b/src/commands/general/help.js @@ -0,0 +1,21 @@ +import { MessageFlags, SlashCommandBuilder } from 'discord.js'; +import { ACCESS_LEVELS } from '../../config/constants.js'; +import { getAccessLevel } from '../../core/permissions.js'; +import { baseEmbed } from '../../ui/embeds.js'; + +export const access = ACCESS_LEVELS.USER; + +export const data = new SlashCommandBuilder() + .setName('help') + .setDescription('Affiche les commandes accessibles selon ton rôle'); + +export async function execute(interaction) { + const level = getAccessLevel(interaction.member); + const lines = interaction.client.commands + .filter((command) => (command.access ?? ACCESS_LEVELS.USER) <= level) + .map((command) => `\`/${command.data.name}\` — ${command.data.description}`) + .sort(); + + const embed = baseEmbed().setTitle('Commandes FWS-Bot').setDescription(lines.join('\n')); + await interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral }); +}