Tengo un problema donde me uní a un canal de voz y quiero reproducir una canción pero el bot me dice que me una a un canal de voz aunque ya estoy en uno aquí hay una imagen
Aquí está mi código:
import ytdl from 'ytdl-core' import ytSearch from 'yt-search' export const name = 'play'; export const description = 'Play a desired song!'; export const args = 1; export const usage = '{song}'; export const execute = async (message, args) => { const voiceChannel = message.member.voice.channel; if (!voiceChannel) return message.channel.send('Please join a voice channel first!'); const connection = await joinVoiceChannel(); 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(`:arrow_forward: Now playing ***${video.title}***`) } else { message.channel.send(`I could not find the video :c`) }}
Esta es la primera vez que pido ayuda aquí, así que si algo no está claro, ¡hazme cualquier pregunta!
La ayuda sería muy apreciada (creo que es porque joinVoiceChannel(); no es una función).