mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-26 22:23:10 +02:00
trop de truc pour tout ecrire
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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.');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user