-
Hi, const videoPlayer = async (guild, song) => {
try{
const songQueue = queue.get(guild.id);
const stream = ytdl(song.url, { filter: 'audioonly' });
const resource = createAudioResource(stream);
player.play(resource);
songQueue.connection.subscribe(player)
player.on(AudioPlayerStatus.Idle, () => {
console.log(`idle`);
songQueue.connection.disconnect();
queue.delete(guild.id);
})
await songQueue.text_channel.send(`Now playing: ${song.title}`);
} catch(err){
console.log(err);
return;
}
} Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm not too sure about the rest of your code but I assume the function you have defined here is being called repeatedly and adds the event handler multiple times. |
Beta Was this translation helpful? Give feedback.
I'm not too sure about the rest of your code but I assume the function you have defined here is being called repeatedly and adds the event handler multiple times.