refactor(all): uniformisation
This commit is contained in:
89 files changed
+10215
-10215
No files matched your search
@@ -1,44 +1,44 @@
|
||||
import { MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
|
||||
import { ACCESS_LEVELS } from '../../config/constants.js';
|
||||
import {
|
||||
assertModerationTarget,
|
||||
fetchTargetMember,
|
||||
logModerationAction,
|
||||
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 target
|
||||
.send({
|
||||
embeds: [targetNoticeEmbed({ action: 'kick', guildName: interaction.guild.name, reason })],
|
||||
})
|
||||
.catch(() => {});
|
||||
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.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
import { MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
|
||||
import { ACCESS_LEVELS } from '../../config/constants.js';
|
||||
import {
|
||||
assertModerationTarget,
|
||||
fetchTargetMember,
|
||||
logModerationAction,
|
||||
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 target
|
||||
.send({
|
||||
embeds: [targetNoticeEmbed({ action: 'kick', guildName: interaction.guild.name, reason })],
|
||||
})
|
||||
.catch(() => {});
|
||||
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.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user