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.
This commit is contained in:
BlackAngelTV committed 2026-09-15 16:12:19 +02:00
1 parent 76e2269555
commit ef8f09da10
31 files changed
+469 -201

No files matched your search

+8 -4
View File
@@ -14,11 +14,11 @@ export const data = new SlashCommandBuilder()
.setDescription('Bannir un membre')
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
.addUserOption((option) => option.setName('user').setDescription('Membre').setRequired(true))
.addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500))
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500))
.addIntegerOption((option) =>
option
.setName('delete_days')
.setDescription('Supprimer les messages des N derniers jours')
.setDescription('Supprimer aussi les messages des N derniers jours (0 à 7)')
.setMinValue(0)
.setMaxValue(7),
);
@@ -41,12 +41,16 @@ export async function execute(interaction) {
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
await interaction.guild.bans.create(user.id, {
reason: reason ?? `Banni par ${interaction.user.tag}`,
reason: reason ?? `Bannissement demandé par ${interaction.user.tag}`,
deleteMessageSeconds: deleteDays * 86_400,
});
await logModerationAction(interaction, { action: 'ban', targetId: user.id, reason });
await interaction.editReply({
embeds: [successEmbed(`**${user.tag}** a été banni du serveur.`)],
embeds: [
successEmbed(
`C’est fait : **${user.tag}** ne peut plus revenir sur le serveur. L’historique reste consultable avec \`/mod logs\`.`,
),
],
});
}
+8 -4
View File
@@ -13,7 +13,7 @@ export const data = new SlashCommandBuilder()
.addIntegerOption((option) =>
option
.setName('amount')
.setDescription('Nombre de messages')
.setDescription('Nombre de messages à supprimer (1 à 100)')
.setRequired(true)
.setMinValue(1)
.setMaxValue(100),
@@ -23,7 +23,9 @@ export const data = new SlashCommandBuilder()
export async function execute(interaction) {
const amount = interaction.options.getInteger('amount', true);
if (!interaction.channel?.isTextBased() || !interaction.channel.bulkDelete) {
throw new UserFacingError('La suppression groupée n’est pas possible dans ce salon.');
throw new UserFacingError(
'Je ne peux pas supprimer plusieurs messages d’un coup ici : lance la commande dans un salon textuel.',
);
}
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
@@ -37,8 +39,10 @@ export async function execute(interaction) {
await interaction.editReply({
embeds: [
successEmbed(
`${deleted.size} message(s) supprimé(s) dans <#${interaction.channelId}>.` +
(deleted.size < amount ? '\n_Les messages de plus de 14 jours sont conservés par Discord._' : ''),
`C’est nettoyé : ${deleted.size} message(s) supprimé(s) dans <#${interaction.channelId}>.` +
(deleted.size < amount
? '\n_Discord conserve les messages de plus de 14 jours : ils n’ont pas pu être retirés._'
: ''),
),
],
});
+7 -3
View File
@@ -15,7 +15,7 @@ export const data = new SlashCommandBuilder()
.setDescription('Expulser un membre du serveur')
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
.addUserOption((option) => option.setName('user').setDescription('Membre').setRequired(true))
.addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500));
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500));
/** Expels the member after the hierarchy checks (M8-T03 / M8-T06). */
export async function execute(interaction) {
@@ -31,10 +31,14 @@ export async function execute(interaction) {
embeds: [targetNoticeEmbed({ action: 'kick', guildName: interaction.guild.name, reason })],
})
.catch(() => {});
await target.kick(reason ?? `Expulsé par ${interaction.user.tag}`);
await target.kick(reason ?? `Expulsion demandée par ${interaction.user.tag}`);
await logModerationAction(interaction, { action: 'kick', targetId: target.id, reason });
await interaction.editReply({
embeds: [successEmbed(`**${target.user.tag}** a été expulsé du serveur.`)],
embeds: [
successEmbed(
`C’est fait : **${target.user.tag}** ne fait plus partie du serveur. La personne peut revenir avec une nouvelle invitation.`,
),
],
});
}
+7 -5
View File
@@ -25,7 +25,7 @@ function formatEntry(row) {
const duration = row.duration_ms ? ` pendant ${formatDuration(row.duration_ms)}` : '';
return (
`\`${row.created_at}\` **${meta?.label ?? row.action}** — ${target}${duration}\n` +
`↳ par <@${row.moderator_id}> · ${row.reason || 'sans raison'}`
`↳ par <@${row.moderator_id}> · ${row.reason || 'sans motif'}`
);
}
@@ -41,13 +41,15 @@ export async function execute(interaction) {
const embed =
actions.length === 0
? infoEmbed(
'Historique de modération',
user ? `Aucune action enregistrée contre ${user}.` : 'Aucune action enregistrée sur ce serveur.',
'📜 Historique de modération',
user
? `Rien à signaler concernant ${user} : aucune action de modération enregistrée.`
: 'Aucune action de modération enregistrée sur ce serveur, tout est calme.',
)
: baseEmbed(COLORS.moderation)
.setTitle(user ? `Historique de ${user.tag}` : 'Dernières actions de modération')
.setTitle(user ? `📜 Historique de ${user.tag}` : '📜 Dernières actions de modération')
.setDescription(actions.map(formatEntry).join('\n\n'))
.setFooter({ text: `${actions.length} dernière(s) action(s)` });
.setFooter({ text: `${actions.length} action(s) affichée(s)` });
await interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral });
}
+5 -3
View File
@@ -19,12 +19,12 @@ export const data = new SlashCommandBuilder()
.addIntegerOption((option) =>
option
.setName('minutes')
.setDescription('Durée en minutes')
.setDescription('Durée de la sanction, en minutes')
.setRequired(true)
.setMinValue(1)
.setMaxValue(40_320),
)
.addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500));
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500));
/** Applies a Discord timeout after the hierarchy checks (M8-T02 / M8-T07). */
export async function execute(interaction) {
@@ -53,7 +53,9 @@ export async function execute(interaction) {
await interaction.editReply({
embeds: [
successEmbed(`**${target.user.tag}** est réduit au silence pendant **${formatDuration(durationMs)}**.`),
successEmbed(
`C’est fait : **${target.user.tag}** est en exclusion temporaire pour **${formatDuration(durationMs)}**, la personne ne peut plus écrire pendant ce temps.`,
),
],
});
}
+15 -7
View File
@@ -6,7 +6,7 @@ import {
removeNotificationChannel,
setNotificationChannel,
} from '../../database/repositories/notification-repository.js';
import { baseEmbed, successEmbed } from '../../ui/embeds.js';
import { baseEmbed, bullets, successEmbed } from '../../ui/embeds.js';
export const access = ACCESS_LEVELS.STAFF;
@@ -58,7 +58,9 @@ export async function execute(interaction) {
const channel = interaction.options.getChannel('channel', true);
setNotificationChannel({ guildId: interaction.guildId, type, channelId: channel.id });
await interaction.reply({
embeds: [successEmbed(`Les notifications **${type}** seront envoyées dans <#${channel.id}>.`)],
embeds: [
successEmbed(`C’est noté : les notifications **${type}** partent maintenant dans <#${channel.id}>.`),
],
flags: MessageFlags.Ephemeral,
});
return;
@@ -67,9 +69,15 @@ export async function execute(interaction) {
if (subcommand === 'remove') {
const type = interaction.options.getString('type', true);
const removed = removeNotificationChannel(interaction.guildId, type);
if (!removed) throw new UserFacingError(`Aucun salon personnalisé n’est configuré pour **${type}**.`);
if (!removed) {
throw new UserFacingError(
`Le type **${type}** utilise déjà la configuration par défaut : il n’y a rien à retirer.`,
);
}
await interaction.reply({
embeds: [successEmbed(`Les notifications **${type}** repassent à la configuration par défaut.`)],
embeds: [
successEmbed(`C’est fait : les notifications **${type}** repassent à la configuration par défaut.`),
],
flags: MessageFlags.Ephemeral,
});
return;
@@ -81,15 +89,15 @@ export async function execute(interaction) {
const lines = NOTIFICATION_TYPES.map((type) => {
const channelId = overrides.get(type);
return channelId
? `\`${type}\` → <#${channelId}> _(personnalisé)_`
? `\`${type}\` → <#${channelId}> _(choisi sur ce serveur)_`
: `\`${type}\` → _configuration par défaut_`;
});
await interaction.reply({
embeds: [
baseEmbed()
.setTitle('Salons de notification')
.setDescription(lines.join('\n'))
.setTitle('🔔 Salons de notification')
.setDescription(`${bullets(lines)}\n\nPour changer une destination : \`/notify set\`.`)
.setFooter({ text: `Serveur ${interaction.guildId}` }),
],
flags: MessageFlags.Ephemeral,
+26 -10
View File
@@ -19,9 +19,12 @@ export const data = new SlashCommandBuilder()
.addStringOption((option) =>
option
.setName('action')
.setDescription('Action')
.setDescription('Ajouter ou retirer le rôle')
.setRequired(true)
.addChoices({ name: 'Ajouter', value: 'add' }, { name: 'Retirer', value: 'remove' }),
.addChoices(
{ name: 'Ajouter le rôle', value: 'add' },
{ name: 'Retirer le rôle', value: 'remove' },
),
),
);
@@ -33,26 +36,37 @@ export async function execute(interaction) {
const adding = action === 'add';
if (role.id === interaction.guild.roles.everyone.id) {
throw new UserFacingError('Le rôle @everyone ne peut pas être attribué.');
throw new UserFacingError(
'Le rôle @everyone ne s’attribue pas : il est porté par tout le monde à la fois.',
);
}
if (role.managed) {
throw new UserFacingError('Ce rôle est géré par une intégration et ne peut pas être modifié.');
throw new UserFacingError(
'Ce rôle appartient à une intégration : Discord le gère tout seul, je ne peux pas le modifier.',
);
}
const bot = interaction.guild.members.me;
if (bot && bot.roles.highest.comparePositionTo(role) <= 0) {
throw new UserFacingError('Mon rôle est trop bas pour gérer ce rôle.');
throw new UserFacingError(
'Je ne peux pas gérer ce rôle : il est placé plus haut que le mien. Remonte mon rôle dans la hiérarchie du serveur, et je m’en occupe.',
);
}
const target = await fetchTargetMember(interaction, user.id);
const hasRole = target.roles.cache.has(role.id);
if (adding && hasRole) throw new UserFacingError(`**${target.user.tag}** possède déjà le rôle ${role}.`);
if (!adding && !hasRole)
throw new UserFacingError(`**${target.user.tag}** ne possède pas le rôle ${role}.`);
if (adding && hasRole) {
throw new UserFacingError(`Rien à faire : **${target.user.tag}** porte déjà le rôle ${role}.`);
}
if (!adding && !hasRole) {
throw new UserFacingError(`Rien à retirer : **${target.user.tag}** n’a pas le rôle ${role}.`);
}
const isGuildOwner = interaction.guild.ownerId === interaction.user.id;
if (!isGuildOwner && interaction.member.roles.highest.comparePositionTo(role) <= 0) {
throw new UserFacingError('Tu ne peux pas gérer un rôle au-dessus ou égal au tien.');
throw new UserFacingError(
'Ce rôle est au même niveau (ou plus haut) que le tien : je ne peux pas y toucher. Demande à quelqu’un de plus haut dans la hiérarchie.',
);
}
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
@@ -69,7 +83,9 @@ export async function execute(interaction) {
});
await interaction.editReply({
embeds: [
successEmbed(`Le rôle ${role} a été ${adding ? 'ajouté à' : 'retiré de'} **${target.user.tag}**.`),
successEmbed(
`C’est fait : le rôle ${role} a été ${adding ? 'ajouté à' : 'retiré de'} **${target.user.tag}**.`,
),
],
});
}
+6 -2
View File
@@ -17,7 +17,7 @@ export const data = new SlashCommandBuilder()
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers)
.addUserOption((option) => option.setName('user').setDescription('Membre').setRequired(true))
.addStringOption((option) =>
option.setName('reason').setDescription('Raison').setRequired(true).setMaxLength(500),
option.setName('reason').setDescription('Motif').setRequired(true).setMaxLength(500),
);
/** Records the warning, notifies the member and logs it (M8-T01 / M8-T06). */
@@ -44,6 +44,10 @@ export async function execute(interaction) {
.catch(() => {});
await interaction.editReply({
embeds: [successEmbed(`**${target.user.tag}** a été averti (${total} avertissement(s) au total).`)],
embeds: [
successEmbed(
`C’est fait : **${target.user.tag}** reçoit un avertissement (${total} au total). La personne a aussi reçu un message privé quand c’était possible.`,
),
],
});
}