Error in my ban command

const { EmbedBuilder } = require('discord.js');

module.exports = {
name: "ban",
description: "Permet de bannir un utilisateur de votre serveur.",
usage: "/ban",
category: "mod",
maintenance: false,
options: [
{
name: "user",
description: "Sélectionne l'utilisateur a bannir.",
type: 6,
required: true
},
{
name: "raison",
description: "Donnez une raison à votre bannissement",
type: 3,
required: false
}
],
run: async (client, interaction) => {
try {
const target = interaction.options.getMember('user');
const reason = interaction.options.getString('raison') || "Aucune Raison";
await interaction.guild.members.ban(target)
const embed = new EmbedBuilder()
.setTitle(`Vous venez d'être banni du serveur ${interaction.guild.name}`)
.setColor(client.color)
.setFooter({ text: client.footer, iconURL: client.user.avatarURL() })
.setThumbnail(interaction.guild.iconURL())
.addFields(
{ name: "Auteur du Ban", value: interaction.user.username, inline: true },
{ name: "Raison du Ban", value: reason, inline: true },
);
await target.send({ embeds: [embed] });
interaction.reply({ content: `**${target.user.username}** viens d'être **ban**.`, ephemeral: true });
} catch (error) {
console.error('Une erreur s\'est produite lors du bannissement :', error);
interaction.reply({ content: 'Une erreur s\'est produite lors du bannissement de cet utilisateur.', ephemeral: true });
}
}
}
const { EmbedBuilder } = require('discord.js');

module.exports = {
name: "ban",
description: "Permet de bannir un utilisateur de votre serveur.",
usage: "/ban",
category: "mod",
maintenance: false,
options: [
{
name: "user",
description: "Sélectionne l'utilisateur a bannir.",
type: 6,
required: true
},
{
name: "raison",
description: "Donnez une raison à votre bannissement",
type: 3,
required: false
}
],
run: async (client, interaction) => {
try {
const target = interaction.options.getMember('user');
const reason = interaction.options.getString('raison') || "Aucune Raison";
await interaction.guild.members.ban(target)
const embed = new EmbedBuilder()
.setTitle(`Vous venez d'être banni du serveur ${interaction.guild.name}`)
.setColor(client.color)
.setFooter({ text: client.footer, iconURL: client.user.avatarURL() })
.setThumbnail(interaction.guild.iconURL())
.addFields(
{ name: "Auteur du Ban", value: interaction.user.username, inline: true },
{ name: "Raison du Ban", value: reason, inline: true },
);
await target.send({ embeds: [embed] });
interaction.reply({ content: `**${target.user.username}** viens d'être **ban**.`, ephemeral: true });
} catch (error) {
console.error('Une erreur s\'est produite lors du bannissement :', error);
interaction.reply({ content: 'Une erreur s\'est produite lors du bannissement de cet utilisateur.', ephemeral: true });
}
}
}
No description
3 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
𓆩Ȼꝑłƶ𓆪
𓆩Ȼꝑłƶ𓆪OP9mo ago
ok thanks you
Want results from more Discord servers?
Add your server