diff --git a/commands/gestion/ban.js b/commands/gestion/ban.js index f178cb2..952f9ca 100644 --- a/commands/gestion/ban.js +++ b/commands/gestion/ban.js @@ -9,12 +9,13 @@ module.exports = { permission: 0, async execute(message, args, client) { - if (!interaction.guild.channels.cache.permissionsFor(interaction.user).has(PermissionFlagsBits.BanMembers) && !client.config.owners.includes(interaction.user.id)) { + const authorPerms = message.channel.permissionsFor(message.author) + if ((!authorPerms || !authorPerms.has(PermissionFlagsBits.banMembers)) && !client.config.owners.includes(message.author.id)) { return message.reply({ embeds: [ new EmbedBuilder() .setTitle('Erreur') - .setDescription('❌ Vous n\'avez pas les permissions pour bannir.') + .setDescription('❌ Vous n\'avez pas les permissions pour expulser.') .setColor(await embedColor(message.author.id, message.guild.id)) .setTimestamp() .setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() }) diff --git a/commands/gestion/kick.js b/commands/gestion/kick.js index 6479749..d299f0c 100644 --- a/commands/gestion/kick.js +++ b/commands/gestion/kick.js @@ -9,7 +9,8 @@ module.exports = { permission: 0, async execute(message, args, client) { - if (!interaction.guild.channels.cache.permissionsFor(interaction.user).has(PermissionFlagsBits.KickMembers) && !client.config.owners.includes(interaction.user.id)) { + const authorPerms = message.channel.permissionsFor(message.author) + if ((!authorPerms || !authorPerms.has(PermissionFlagsBits.kickMembers)) && !client.config.owners.includes(message.author.id)) { return message.reply({ embeds: [ new EmbedBuilder()