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

236
Views
ReferenceError: la voz no está definida discord.js

Estoy tratando de hacer un pequeño Music Bot en Discord.js v16.6 que pueda reproducir archivos locales, pero recibí el error:

ReferenceError: la voz no está definida

No entiendo por qué la voz no está definida. ¿Cómo puedo solucionar este error?

Aquí está la parte de mi código:

 if( isReady && startsWithInList(message.content, settings.commandPlay) ) { isReady = false; const args = message.content.slice(10).trim().split(' '); if( args.length != 1 || !args[0] || args[0] === "" ) { return message.channel.send(settings.warningPlayArgsSentence); } var voiceChannel = message.member.voice.channel; voice.channel.join().then( connection => { const dispatcher = connection.play(settings.filesDir+args[0]+'.mp3') dispatcher.on('finish', () => { voiceChannel.leave(); isReady = true; }) }); }

* No puedo proporcionar el código completo porque stackoverflow no lo permitirá

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

0

Discord.js solo sube a la versión v13.4 al momento de escribir esto. El código aquí parece que es para la versión v12. Supongo que estás en Node.js v16.6.

Con respecto al problema real, estás haciendo referencia a una voice variable que no existe. ver esta línea

 voice.channel.join().then( connection => {

Supongo que solo querías hacer referencia a la variable creada directamente antes de esta línea.

 if( isReady && startsWithInList(message.content, settings.commandPlay) ) { isReady = false; const args = message.content.slice(10).trim().split(' '); if( args.length != 1 || !args[0] || args[0] === "" ) { return message.channel.send(settings.warningPlayArgsSentence); } var voiceChannel = message.member.voice.channel; // See below for the change voiceChannel.join().then( connection => { const dispatcher = connection.play(settings.filesDir+args[0]+'.mp3') dispatcher.on('finish', () => { voiceChannel.leave(); isReady = true; }) }); }
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!