Files
gestion/commands/moderation/voicemoveall.js
T
2024-02-29 18:57:43 +01:00

25 lines
1.2 KiB
JavaScript

const Discord = require('discord.js');
module.exports = {
name: "voicemoveall",
aliases: ["vcmoveall"],
description: "Permet de faire venir tous les membres en vocal du serveur dans un channel",
category: 'moderation',
emote: '🔊',
utilisation: 'voicemoveall [#channel/id]',
async execute(message, args, client) {
let channelInput = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]) || message.member.voice.channel;
if (!channelInput) return message.channel.send(`Vous devez être dans un salon vocal pour utiliser cette commande ou sinon en mentionner un.`)
if (channelInput.type !== Discord.ChannelType.GuildVoice) return;
const channels = message.guild.channels.cache.filter(ch => ch.id !== channelInput.id && ch.type !== Discord.ChannelType.GuildVoice && ch.members.size > 0)
for await(const [_, channel] of channels)
for await(const [_, member] of channel.members) {
await member.voice.setChannel(channelInput, `voicemoveall by ${message.author.tag}`).catch(() => {
})
}
message.channel.send(`Tout les membres ont été déplacé vers ${channelInput}`)
}
}