The dashboard offered seven switches that nothing read: they promised a behaviour the bot did not have, which is worse than offering nothing. Every setting is now declared once, with its type, its bounds and its explanation, and the services read it: the welcome message and its wording, the automatic role, departure notices, the private notice sent to a sanctioned member, the default mute duration, how much history a ban erases, whether a closed ticket is deleted or archived, and an optional role mention on the Gitea notifications. A test walks the sources and fails when a declared key is read nowhere, so the list cannot drift back into decoration. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
import { MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
|
||
import { ACCESS_LEVELS } from '../../config/constants.js';
|
||
import {
|
||
assertModerationTarget,
|
||
fetchTargetMember,
|
||
logModerationAction,
|
||
notifyTarget,
|
||
targetNoticeEmbed,
|
||
} from '../../services/moderation/moderation-service.js';
|
||
import { successEmbed } from '../../ui/embeds.js';
|
||
|
||
export const access = ACCESS_LEVELS.STAFF;
|
||
|
||
export const data = new SlashCommandBuilder()
|
||
.setName('kick')
|
||
.setDescription('Expulser un membre du serveur')
|
||
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
|
||
.addUserOption((option) => option.setName('user').setDescription('Membre').setRequired(true))
|
||
.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) {
|
||
const user = interaction.options.getUser('user', true);
|
||
const reason = interaction.options.getString('reason');
|
||
|
||
const target = await fetchTargetMember(interaction, user.id);
|
||
assertModerationTarget(interaction, target);
|
||
|
||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||
await notifyTarget(target, {
|
||
embeds: [targetNoticeEmbed({ action: 'kick', guildName: interaction.guild.name, reason })],
|
||
});
|
||
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(
|
||
`C’est fait : **${target.user.tag}** ne fait plus partie du serveur. La personne peut revenir avec une nouvelle invitation.`,
|
||
),
|
||
],
|
||
});
|
||
}
|