Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
tengo problemas para que mi bot se una al canal de voz y reproduzca música

el error que recibo es Cannot read properties of undefined (reading 'join')

código:

 const ytdl = require('ytdl-core'); const ytSearch = require('yt-search'); module.exports = { name: 'play', description: 'Joins and plays a video from youtube', async execute(message, args) { const voiceChannel = message.member.voicechannel; if (!args.length) return message.channel.send('You need to send the second argument!'); const validURL = (str) =>{ var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; if(!regex.test(str)){ return false; } else { return true; } } if(validURL(args[0])){ const connection = await voiceChannel.join(); const stream = ytdl(args[0], {filter: 'audioonly'}); connection.play(stream, {seek: 0, volume: 1}) .on('finish', () =>{ voiceChannel.leave(); message.channel.send('leaving channel'); }); await message.reply(`:thumbsup: Now Playing ***${video.title}!***`) return } const connection = await voiceChannel.join(); const videoFinder = async (query) => { const videoResult = await ytSearch(query); return (videoResult.videos.length > 1) ? videoResult.videos[0] : null; } const video = await videoFinder(args.join(' ')); if(video){ const stream = ytdl(video.url, {filter: 'audioonly'}); connection.play(stream, {seek: 0, volume: 1}) .on('finish', () =>{ voiceChannel.leave(); }); await message.reply(`:thumbsup: Now Playing ***${video.title}***`) } else { message.channel.send('No video results found'); } } }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

.join() ya no funciona en discord.js v13. Necesita definir la conexión de esta manera:

 const { joinVoiceChannel } = require('@discordjs/voice'); const connection = joinVoiceChannel({ channelId: channel.id, guildId: channel.guild.id, adapterCreator: channel.guild.voiceAdapterCreator, });

Puedes encontrar más información aquí

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda