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

146
Views
Mi bot no puede recibir errores cuando no ejecuta un comando de canal de voz "unirse"

Actualmente estoy codificando un bot discord.js e hice este comando de join para que el bot pueda unirse a mi canal de voz

 module.exports.run = async (client, message, args) => { let membervc = message.member.voice.channel; let botvc = message.guild.me.voice.channel; if(!membervc) return message.send('You need to join a voice channel first.'); if(botvc){ if(!(botvc.members.size - 1)) return message.reply(`I am already on ${botvc}`); if(membervc.id == botvc.id) return message.reply('We are already on the same voice channel.'); }; membervc.join(); }

El problema es que no tengo idea de cómo hacerlo para que si la última función da un error o no funciona en absoluto Puede enviar un mensaje de error al usuario como @User, I could not join the channel, "THE ERROR" :/ No quiero que mi bot se bloquee y tenga que volver a ejecutarlo solo por un pequeño detalle. ¿Hay alguna forma de arreglarlo? ¡Me ayudaría un montón! ¡Gracias por adelantado!

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

0

No dejaría que el usuario supiera sobre el error, porque podría confundirlo, pero puede try catch para verificar si pasa y si no se envía el mensaje.

 try { membervc.join(); } catch(error){ console.log(error); message.reply(`Something went wrong while joining voice channel`); }
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!