const Discord = require('discord.js'); module.exports = { name: "voicemove", aliases: ["vcmove"], description: "Permet de move un utilisateur d'un vocal", category: 'moderation', emote: '🔊', utilisation: 'voicemove @user/id #salon/id', async execute(message, args, client) { let user = message.guild.members.cache.get(args[0]) || message.mentions.members.first(); let channel = message.guild.channels.cache.get(args[1]) || message.mentions.channels.first() || message.guild.channels.cache.find(c => c.name === args[1]) || message.guild.channels.cache.find(c => c.name.toLowerCase() === args[1].toLowerCase()) if (!user) return; if (!channel) return; if (channel.type !== Discord.ChannelType.GuildVoice) return message.reply("le salon"); let userVoiceChannel = user.voice.channel; if(!userVoiceChannel) return message.reply(`${user.user.username} n'est pas dans un channel vocal`) await user.voice.setChannel(channel) .then(async () => { await message.reply(`${user.user.username} a Ă©tĂ© dĂ©placĂ© du channel vocal (${userVoiceChannel}) vers le channel vocal (${channel})`); }) .catch(error => { message.reply('Une erreur s\'est produite lors du dĂ©placement de l\'utilisateur.'); }); } }