I want to make a music bot, that disconnects after being idle for 15 seconds.
My code:
player.on(AudioPlayerStatus.Idle, () => {
message.channel.send('<:Bye:958269757541466145> **Queue finished... Leaving!**')
connection.disconnect();
});
I am using Discord.js v13.8.0 and Node.js 16
Use setTimeout function -
player.on(AudioPlayerStatus.Idle, () => {
setTimeout(() => {
message.channel.send('<:Bye:958269757541466145> **Queue finished... Leaving!**')
connection.disconnect();
}, 15000);
})