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:
9 files changed
+73
-27
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
|
||||
import { ACCESS_LEVELS, COLORS, MODERATION_ACTIONS } from '../../config/constants.js';
|
||||
import { ACCESS_LEVELS, COLORS } from '../../config/constants.js';
|
||||
import { listActions } from '../../database/repositories/moderation-repository.js';
|
||||
import { formatDuration } from '../../services/moderation/moderation-service.js';
|
||||
import { formatDuration, moderationLabel } from '../../services/moderation/moderation-service.js';
|
||||
import { baseEmbed, infoEmbed } from '../../ui/embeds.js';
|
||||
|
||||
export const access = ACCESS_LEVELS.STAFF;
|
||||
@@ -20,11 +20,10 @@ export const data = new SlashCommandBuilder()
|
||||
);
|
||||
|
||||
function formatEntry(row) {
|
||||
const meta = MODERATION_ACTIONS[row.action];
|
||||
const target = row.target_id ? `<@${row.target_id}>` : 'salon';
|
||||
const duration = row.duration_ms ? ` pendant ${formatDuration(row.duration_ms)}` : '';
|
||||
return (
|
||||
`\`${row.created_at}\` **${meta?.label ?? row.action}** — ${target}${duration}\n` +
|
||||
`\`${row.created_at}\` **${moderationLabel(row.action)}** — ${target}${duration}\n` +
|
||||
`↳ par <@${row.moderator_id}> · ${row.reason || 'sans motif'}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export async function execute(interaction) {
|
||||
assertModerationTarget(interaction, target);
|
||||
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
await target.timeout(durationMs, reason ?? `Exclusion temporaire de ${minutes} minutes`);
|
||||
await target.timeout(durationMs, reason ?? `Mise en sourdine de ${minutes} minutes`);
|
||||
|
||||
await logModerationAction(interaction, {
|
||||
action: 'mute',
|
||||
@@ -55,7 +55,7 @@ export async function execute(interaction) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
successEmbed(
|
||||
`C’est fait : **${target.user.tag}** est en exclusion temporaire pour **${formatDuration(durationMs)}**, la personne ne peut plus écrire pendant ce temps.`,
|
||||
`C’est fait : **${target.user.tag}** est en sourdine pour **${formatDuration(durationMs)}**, la personne ne peut plus écrire pendant ce temps.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user