fix(moderation): tell a mute apart from a kick in the logs

A timeout was filed as "Exclusion temporaire" right next to "Expulsion",
so a sanction could not be read back from the log channel, the direct
message or `/mod logs`. Each action now carries its own emoji and wording
behind a single label, used by every surface.
This commit is contained in:
BlackAngelTV committed 2026-09-25 20:29:19 +02:00
1 parent 859b229181
commit 99e1fd2723
9 files changed
+73 -27

No files matched your search

+13 -2
View File
@@ -7,6 +7,17 @@ import { logEvent } from '../../database/repositories/event-log-repository.js';
import { recordAction } from '../../database/repositories/moderation-repository.js';
import { baseEmbed } from '../../ui/embeds.js';
/**
* Label shown for an action everywhere it is rendered (log channel, direct
* message, `/mod logs`, dashboard). Falls back to the raw action name, so a
* row written by another version still reads as something.
* @param {string} action
*/
export function moderationLabel(action) {
const meta = MODERATION_ACTIONS[action];
return meta ? `${meta.emoji} ${meta.label}` : action;
}
/**
* Enforces the role hierarchy before any moderation action (M3-T05 / M8-T08).
* @param {import('discord.js').ChatInputCommandInteraction} interaction
@@ -82,7 +93,7 @@ export async function sendModerationLog(
const meta = MODERATION_ACTIONS[action];
const embed = baseEmbed(meta?.color)
.setTitle(`🛡️ Modération — ${meta?.label ?? action}`)
.setTitle(`🛡️ Modération — ${moderationLabel(action)}`)
.addFields(
{ name: 'Membre', value: targetId ? `<@${targetId}> (${targetId})` : 'Salon', inline: true },
{ name: 'Par', value: `<@${moderatorId}>`, inline: true },
@@ -117,7 +128,7 @@ export function targetNoticeEmbed({ action, guildName, reason = null, durationMs
const embed = baseEmbed(meta?.color)
.setTitle(`Sanction sur ${guildName}`)
.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.`,
`Action : **${moderationLabel(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) });