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:
31 files changed
+469
-201
No files matched your search
@@ -12,17 +12,25 @@ import { baseEmbed } from '../../ui/embeds.js';
|
||||
* @param {import('discord.js').GuildMember} target
|
||||
*/
|
||||
export function assertModerationTarget(interaction, target) {
|
||||
if (!target) throw new UserFacingError('Ce membre n’est pas présent sur le serveur.');
|
||||
if (!target) {
|
||||
throw new UserFacingError(
|
||||
'Je ne trouve pas ce membre sur le serveur : vérifie qu’il y est toujours, puis relance la commande.',
|
||||
);
|
||||
}
|
||||
if (target.id === interaction.user.id) {
|
||||
throw new UserFacingError('Tu ne peux pas t’appliquer cette action à toi-même.');
|
||||
throw new UserFacingError('Tu ne peux pas t’appliquer cette action à toi‑même 😅 Vise un autre membre.');
|
||||
}
|
||||
if (!canActOn(interaction.member, target)) {
|
||||
throw new UserFacingError('Tu ne peux pas agir sur ce membre : son rôle est égal ou supérieur au tien.');
|
||||
throw new UserFacingError(
|
||||
'Cette personne a un rôle égal ou supérieur au tien : je ne peux pas la viser. Demande à quelqu’un de plus haut dans la hiérarchie si c’est nécessaire.',
|
||||
);
|
||||
}
|
||||
|
||||
const bot = interaction.guild.members.me;
|
||||
if (bot && bot.roles.highest.comparePositionTo(target.roles.highest) <= 0) {
|
||||
throw new UserFacingError(`Mon rôle est trop bas pour agir sur ${target.user.tag}.`);
|
||||
throw new UserFacingError(
|
||||
`Je ne peux pas agir sur ${target.user.tag} : mon rôle est placé plus bas que le sien. Remonte mon rôle dans les paramètres du serveur, et je m’en occupe.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,11 +81,11 @@ export async function sendModerationLog(
|
||||
|
||||
const meta = MODERATION_ACTIONS[action];
|
||||
const embed = baseEmbed(meta?.color)
|
||||
.setTitle(`Modération — ${meta?.label ?? action}`)
|
||||
.setTitle(`🛡️ Modération — ${meta?.label ?? action}`)
|
||||
.addFields(
|
||||
{ name: 'Cible', value: targetId ? `<@${targetId}> (${targetId})` : 'Salon', inline: true },
|
||||
{ name: 'Modérateur', value: `<@${moderatorId}>`, inline: true },
|
||||
{ name: 'Raison', value: reason || 'Non précisée' },
|
||||
{ name: 'Membre', value: targetId ? `<@${targetId}> (${targetId})` : 'Salon', inline: true },
|
||||
{ name: 'Par', value: `<@${moderatorId}>`, inline: true },
|
||||
{ name: 'Motif', value: reason || 'Non précisé' },
|
||||
);
|
||||
if (durationMs) {
|
||||
embed.addFields({ name: 'Durée', value: formatDuration(durationMs), inline: true });
|
||||
@@ -92,8 +100,10 @@ export function targetNoticeEmbed({ action, guildName, reason = null, durationMs
|
||||
const meta = MODERATION_ACTIONS[action];
|
||||
const embed = baseEmbed(meta?.color)
|
||||
.setTitle(`Sanction sur ${guildName}`)
|
||||
.setDescription(`Action : **${meta?.label ?? action}**`)
|
||||
.addFields({ name: 'Raison', value: reason || 'Non précisée' });
|
||||
.setDescription(
|
||||
`Action : **${meta?.label ?? action}**\n\nCette décision vient de l’équipe de modération. Tu peux répondre à ce message pour en parler calmement avec elle.`,
|
||||
)
|
||||
.addFields({ name: 'Motif', value: reason || 'Non précisé' });
|
||||
if (durationMs) embed.addFields({ name: 'Durée', value: formatDuration(durationMs) });
|
||||
return embed;
|
||||
}
|
||||
@@ -113,6 +123,10 @@ export function formatDuration(durationMs) {
|
||||
/** Fetches the member targeted by a command, with a clear error if absent. */
|
||||
export async function fetchTargetMember(interaction, userId) {
|
||||
const member = await interaction.guild.members.fetch(userId).catch(() => null);
|
||||
if (!member) throw new UserFacingError('Ce membre n’est pas présent sur le serveur.');
|
||||
if (!member) {
|
||||
throw new UserFacingError(
|
||||
'Je ne trouve pas ce membre sur le serveur : vérifie qu’il y est toujours, puis relance la commande.',
|
||||
);
|
||||
}
|
||||
return member;
|
||||
}
|
||||
Reference in new issue
Block a user