wjael
wjael
DIAdiscord.js - Imagine an app
Created by wjael on 7/6/2023 in #djs-voice
Bot not outputting sound after joining the channel
const play = async (song, connection, message) => {
if (!song) {
connection.leave();
return;
}
console.log('music start')
connection.play(createAudioResource(song.url))
// .on("finish", () => {
// message.client.music_queue.shift();
// play(message.client.music_queue[0], connection, message);
// })

}
const play = async (song, connection, message) => {
if (!song) {
connection.leave();
return;
}
console.log('music start')
connection.play(createAudioResource(song.url))
// .on("finish", () => {
// message.client.music_queue.shift();
// play(message.client.music_queue[0], connection, message);
// })

}
The code seem to be called but not giving any output. I suspect there is an issue in the player to connection connection?
try {
const connection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: guildId,
adapterCreator: message.guild.voiceAdapterCreator
})

const player = createAudioPlayer();
connection.subscribe(player);

playSong(musicQueue[0], player, message);

} catch(err) {
console.log(err)
}
try {
const connection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: guildId,
adapterCreator: message.guild.voiceAdapterCreator
})

const player = createAudioPlayer();
connection.subscribe(player);

playSong(musicQueue[0], player, message);

} catch(err) {
console.log(err)
}
above is the connection code
23 replies