ZPTXDev / Quaver

Simple-to-use music bot with features such as bass boost, nightcore, seek, search, and more.
https://go.zptx.dev/InviteQuaver
GNU General Public License v3.0
6 stars 3 forks source link

Quaver crashes when it gets restarted while 24/7 is enabled on certain conditions. #76

Closed xayanide closed 2 years ago

xayanide commented 2 years ago

Describe the bug Quaver will crash when it gets is restarted while 24/7 is enabled on certain conditions.

To Reproduce Steps to reproduce the behavior:

This applies to both Stage and Voice channels.

I will show the logs with my instance on the console through code blocks with each step.

Step 0. Start Quaver

$ node main.js
[Quaver] Connected to Discord! Logged in as Thighs#3578.
[Quaver] Running version 3.1.0-next.9. For help, see https://github.com/ZapSquared/Quaver/issues.
[Quaver] Connected to Lavalink!

Step 1. Play with any music with Quaver.

On the first step, 24/7 is disabled, so it is untoggled. So that means, if the user leaves the channel, it would use Quaver's conventional features which is the timeout for saving resources.

Current log on console with step 1:

[G 906471497231630336 | U 250934589621665793] Processing command play
[G 906471497231630336 | U 250934589621665793] Executing command play
[G 906471497231630336] Starting track

Step 2. The user leaves the channel.

Since 24/7 is disabled when the user left. Quaver is expected to set a timeout when it is alone and Quaver successfully set a timeout, no problem there.

Current log on console with step 2:

[G 906471497231630336] Setting pause timeout

Message sent by Quaver with step 2:

There's nobody here. I'll leave in x amount of minutes.
Rejoin to resume your session.

Step 3. The user rejoins the channel.

With this, Quaver will resume the user's session.

Current log on console with step 3: There's nothing new on the console.

Message that was sent by Quaver with step 3:

Resuming your session.

Step 4. Toggle 24/7 to enable it.

Current log on console with step 4:

[G 906471497231630336 | U 250934589621665793] Processing command 247
[G 906471497231630336 | U 250934589621665793] Executing command 247

Step 5. The user leaves the channel.

Quaver is expected to not send any prompt for time out since 247 is enabled and Quaver didn't, so there's no problem there.

Current log on console with step 5: There's nothing new on the console.

Step 6. Restart Quaver. Type and enter exit on the console.

Nothing unusual will happen when get's exited.

Current log on console with step 5:

exit
[Quaver] Shutting down...
[Quaver] Disconnecting from all guilds...
[G 906471497231630336] Disconnecting (restarting)

Step 7. Start Quaver again

It shall crash when it reconnects to the channel, but the channel is empty and 24/7 is untoggled, and it attempts to disconnect from the channel and crash.

Current console log with step 7:

$ node main.js
[Quaver] Connected to Discord! Logged in as Thighs#3578.
[Quaver] Running version 3.1.0-next.9. For help, see https://github.com/ZapSquared/Quaver/issues.
[Quaver] Connected to Lavalink!
[G undefined] Disconnecting (alone)
[Quaver] Shutting down...
[Quaver] Disconnecting from all guilds...
[G 906471497231630336] Disconnecting (restarting)
[Quaver] Logging additional output to error.log

Message sent by Quaver on step 7:

Quaver has crashed and will disconnect.
Sorry for the inconvenience caused.

Step 8. See error

See error on error.log

unhandledRejection
Cannot read property 'id' of undefined
TypeError: Cannot read property 'id' of undefined
at getId (/home/runner/t/node_modules/lavaclient/dist/lib/Utils.js:5:54)
at Node.destroyPlayer (/home/runner/t/node_modules/lavaclient/dist/lib/node/Node.js:47:59)
at Client.<anonymous> (/home/runner/t/main.js:525:15)
at Client.emit (node:events:394:28)
at VoiceStateUpdate.handle (/home/runner/t/node_modules/discord.js/src/client/actions/VoiceStateUpdate.js:38:14)
at Object.module.exports [as VOICE_STATE_UPDATE] (/home/runner/t/node_modules/discord.js/src/client/websocket/handlers/VOICE_STATE_UPDATE.js:4:35)
at WebSocketManager.handlePacket (/home/runner/t/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
at WebSocketShard.onPacket (/home/runner/t/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/runner/t/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/runner/t/node_modules/ws/lib/event-target.js:199:18)

Expected behavior Quaver shouldn't crash when it gets started again while 24/7 is enabled with the conditions written above. Quaver should be starting and operating as expected with 24/7 enabled after being restarted.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 3.1.0-next.10 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 3.1.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: