Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
DiscordJS mueve a todos los miembros en un vc específico

Estoy tratando de encontrar una manera de mover todos los miembros que están en un vc específico al vc en el que se encuentra el remitente del comando. El comando debe ser -warp. Esto es lo que tengo hasta ahora:

 if (!message.member?.permissions.has('MOVE_MEMBERS')) return; const member = message.mentions.members?.first(); if (!member) return message.reply("Error: Didn't specify member."); if (!member.voice.channel) return message.reply("Error: Mentioned member is not in a Voice Channel."); if (!message.member.voice.channel) return message.reply("Error: Executor of command is not in a Voice Channel."); member.voice.setChannel(message.member.voice.channel) message.reply('Success: Moved member.')

Funciona, pero solo puedo mover un usuario a la vez y de cada vc. Quiero que todos puedan mover a otros pero solo desde un vc específico. ¡Gracias por tu ayuda!

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Esto funciona para mí, avísame si tienes algún problema:

 client.on('messageCreate', async message => { if (message.author.bot) return; if (message.content === '-warp') { // doing the same validation here as you did if (!message.member.voice.channel) { await message.reply('Error: Executor of command is not in a Voice Channel.'); return; } const sendersChannel = message.member.voice.channel; const mentionedMember = message.mentions.members?.first(); if (!mentionedMember) { await message.reply('Error: Didn\'t specify member.'); return; } if (!mentionedMember.voice.channel) { await message.reply('Error: Mentioned member is not in a Voice Channel.'); return; } // get the channel of the mentioned member const targetChannel = mentionedMember.voice.channel; // iterate over all the members in that voice channel and move them to the sender's channel for (const [, member] of targetChannel.members) { await member.voice.setChannel(sendersChannel); } await message.reply(`Moved all members from ${targetChannel.name} to ${sendersChannel.name}`); } });
about 4 years ago · Juan Pablo Isaza Report

0

Prueba esto

 const channel2pullFrom = message.guild.channels.cache.get('channelID') const sendersChannel = message.member.voice.channel.id if (!message.member.permissions.has('MOVE_MEMBERS')) return if (!message.member.voice.channel) return message.reply("Error: Executor of command is not in a Voice Channel.") channel2pullFrom.members.map((member) => { member.voice.setChannel(sendersChannel) }) message.reply(`Moved members.`)

Código:

https://i.stack.imgur.com/JLrmP.png

Antes del comando:

https://i.stack.imgur.com/VGbyp.png

Después del comando:

https://i.stack.imgur.com/tTUF4.png

about 4 years ago · Juan Pablo Isaza Report

0

Utilice la función para cada uno.

 members.forEach(member => { //member… }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!