"leaveOnEmpty" and "channelEmpty" not working
See original GitHub issueDescribe the bug When creating the queue with the option “leaveOnEmpty”, nothing happens when everyone leaves the channel. Also the “channelEmpty” event is never emitted.
To Reproduce When creating the queue add the option “leaveOnEmpty” to “true”. Exit the channel and the bot will keep playing. In the events, add the event “channelEmpty”. When everyone leaves the channel, nothing will be emitted.
Expected behavior In the “leaveOnEmpty”, the bot should disconnect when everyone leaves. In the “channelEmpty” event, when everyone leaves the channel, the event should be emitted.
Screenshots/Codes
const queue = await player.createQueue(message.guild, { metadata: message.channel, autoSelfDeaf: true, leaveOnEnd: false, leaveOnStop: true, leaveOnEmpty: true, ytdlOptions: { quality: "highest", filter: "audioonly", highWaterMark: 1 << 25, dlChunkSize: 0, }, });
player.on("channelEmpty", async (queue) => {console.log("Example")}
Please complete the following information:
- Node Version: 16.6.1
- Discord Player Version: 5.2.0
- Discord.js Version: 13.3.1
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:5 (2 by maintainers)
Top GitHub Comments
You need to create leaveOnEndCooldown handler by yourself, Maybe take a look of this code.
endTimeout.js
player-handler.js
Hope this will work for you.
# #986