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
No se pueden leer las propiedades de undefined (leyendo 'adapterCreator')

Estoy intentando hacer un bot de música para mi servidor de discordia. Cuando ejecuto el código, el bot se une a mi llamada, sin embargo, detiene instantáneamente el código y ejecuta "Se produjo un error al intentar conectarse".

Dice en la consola:

TypeError no capturado: no se pueden leer las propiedades de undefined (leyendo 'adapterCreator') No hay depurador disponible, no se pueden enviar 'variables' El proceso finalizó con el código 1

La única parte del código de donde proviene 'adapterCreator' está aquí:

 if (command === 'play'){ if (!args.length) return message.channel.send('Please provide the second argument!'); let song = {}; joinVoiceChannel({ channelId: message.member.voice.channel.id, guildId: message.guild.id, adapterCreator: message.guild.voiceAdapterCreator })

El código que define el mensaje:

Todo esto está bajo async execute(message, args, command, client, Discord){} en la carpeta play.js

 const voiceChannel = message.member.voice.channel; if (!voiceChannel) return message.channel.send('You must be in a channel to run this command!') const permissions = voiceChannel.permissionsFor(message.client.user); if (!permissions.has('CONNECT')) return message.channel.send('You do not have the permissions to do this!'); if(!permissions.has('SPEAK')) return message.channel.send('You do not have the permissions to do this!'); const server_queue = queue.get(message.guild.id);

En el controlador de comandos main.js:

 else if (command === 'play'){ client.commands.get('play').execute(message, args, command); }

EDIT #2: Mostrar intenciones:

 const { Client, Intents, DiscordAPIError, Collection } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); const prefix = '-' const fs = require('fs'); client.commands = new Collection(); const command = require('./command') const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for(const file of commandFiles){ const command = require(`./commands/${file}`); client.commands.set(command.name, command); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intenté de la misma manera que lo hiciste en tu código y funcionó bien y no puedo reproducir el bloqueo. Así que el problema podría no ser el código.

¿Has probado a actualizar los paquetes? ( npm update )

Tiene una advertencia de desuso para el evento de mensaje. Esto no solucionará el problema, pero sería bueno cambiarlo a messageCreate .

Además, para reproducir música más tarde, necesitará la conexión cuando el bot se una a un canal de voz. Asigne el resultado de joinVoiceChannel a una variable.

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!