mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-11 15:56:27 +02:00
28 lines
941 B
JavaScript
28 lines
941 B
JavaScript
const { PermissionsBitField} = require("discord.js")
|
|
module.exports = {
|
|
name: 'renew',
|
|
aliases: ['renouveler'],
|
|
description: 'Renew un salon',
|
|
emote: '🔄',
|
|
utilisation: 'renew',
|
|
category: 'gestion',
|
|
|
|
async execute(message, args, client) {
|
|
const guild = message.guild;
|
|
const channel = message.mentions.channels.first() || message.channel;
|
|
const botMember = guild.members.cache.get(client.user.id);
|
|
if (!botMember.permissions.has(PermissionsBitField.Flags.ManageChannels)) {
|
|
return message.reply("Je n'ai pas la permission de gére les salon");
|
|
}
|
|
|
|
if (channel.deletable) {
|
|
const newChannel = await channel.clone();
|
|
|
|
await channel.delete();
|
|
|
|
newChannel.send(`${message.author}, ce salon a été renouvelé.`);
|
|
} else {
|
|
return message.reply("Je ne peux pas supprimer ce salon.");
|
|
}
|
|
},
|
|
}; |