Files
FWS-DiscordBot/src/commands/general/help.js
T
BlackAngelTV ef8f09da10 refactor(ui): give every message one friendly, ungendered voice
Members read all replies as one voice, so the wording now lives in one place:
the shared titles, the list marker and the "what to do next" hint come from
src/ui/embeds.js, and every module follows them.

An error explains the cause, recalls the rule and offers the way out instead of
blaming; a success says what happens next. Nothing agrees on the gender of a
person ("utilisateur", "cher/chère", "ravie"), which also keeps the sentences
shorter. Two tests lock the shared titles and reject gendered descriptions.
2026-09-15 16:12:19 +02:00

26 lines
1.0 KiB
JavaScript

import { MessageFlags, SlashCommandBuilder } from 'discord.js';
import { ACCESS_LABELS, ACCESS_LEVELS } from '../../config/constants.js';
import { getAccessLevel } from '../../core/permissions.js';
import { baseEmbed, bullets } 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('🤖 Tes commandes')
.setDescription(
`Tu es au niveau **${ACCESS_LABELS[level]}**. Voici ce que tu peux lancer :\n\n${bullets(lines)}`,
);
await interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral });
}