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 with unhandledRejection when users leave before Quaver plays a track. #109

Closed xayanide closed 2 years ago

xayanide commented 2 years ago

Describe the bug Directly related to #104 , still persisted.

If a user leaves before Quaver could play a track, it crashes, shows an error on console and crashes with unhandledRejection in error.log

Reproducible with play and search. Applies to both stage and voice channels.

Affected versions What versions of Quaver are affected by this bug? All versions after 2.8.0-next.1

This exact version. https://github.com/ZapSquared/Quaver/compare/2.7.0...2.8.0-next.1

https://github.com/ZapSquared/Quaver/commit/652504b3ef1f31098b8b3050d91473dd604a3a38

Every version below 2.8.0-next.1 doesn't crash Quaver, but still plays the track, or queries the track while it is not even in the channel after doing the steps.

Play command

To reproduce Steps to reproduce the behavior:

  1. Make sure 24/7 is off.

  2. Join the channel

  3. Put your hand near the enter key.

  4. Use play, input any track, and prepare to enter it.

  5. After entering, wait for Quaver to process it a bit,

  6. If the text that shows "Quaver is typing..." is no longer grey, in that moment, disconnect from the channel you're in.

  7. Quaver shall crash.

  8. See error.

    Console of the whole reproduction process.

    [Quaver] Connected to Discord! Logged in as ThatKid#6969
    [Quaver] Running version 3.3.0-next.1. For help, see https://github.com/ZapSquared/Quaver/issues.
    [Quaver] Connected to Lavalink!
    [G 906471497231630336 | U 250934589621665793] Processing command play
    [G 906471497231630336 | U 250934589621665793] Executing command play
    [G 906471497231630336 | U 250934589621665793] Encountered error with command play
    Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
    at CommandInteraction.reply (D:\Documents\GitHub\Quaver\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:90:46)
    at Object.execute (D:\Documents\GitHub\Quaver\commands\play.js:121:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.<anonymous> (D:\Documents\GitHub\Quaver\main.js:283:4) {
    }
    [Quaver] Shutting down...
    [Quaver] Disconnecting from all guilds...
    [Quaver] Logging additional output to error.log.

    error.log after the reproduction process.

    unhandledRejection
    The reply to this interaction has already been sent or deferred.
    Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
    at SelectMenuInteraction.reply (D:\Documents\GitHub\Quaver\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:90:46)
    at Client.<anonymous> (D:\Documents\GitHub\Quaver\main.js:445:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

    Search command

    To reproduce Steps to reproduce the behavior:

  9. Make sure 24/7 is off.

  10. Join the channel

  11. Search any track.

  12. Select 1 or more tracks.

  13. Put your cursor near the disconnect button.

  14. Queue the tracks by clicking away.

  15. Wait for Quaver to process it a bit..

  16. If the text that shows "Quaver is typing..." is no longer grey, in that moment, disconnect from the channel you're in.

  17. Disconnect, and Quaver shall crash.

  18. See error.

    Console of the whole reproduction process.

    [Quaver] Connected to Discord! Logged in as ThatKid#6969
    [Quaver] Running version 3.3.0-next.1. For help, see https://github.com/ZapSquared/Quaver/issues.
    [Quaver] Connected to Lavalink!
    [G 906471497231630336 | U 250934589621665793] Processing command search
    [G 906471497231630336 | U 250934589621665793] Executing command search
    [G 906471497231630336] Disconnecting (alone)
    [Quaver] Shutting down...
    [Quaver] Disconnecting from all guilds...       
    [Quaver] Logging additional output to error.log.

    error.log of the whole reproduction process.

    unhandledRejection
    Cannot read properties of null (reading 'type')
    TypeError: Cannot read properties of null (reading 'type')
    at Client.<anonymous> (D:\Documents\GitHub\Quaver\main.js:488:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Either way these errors are similar and may interchange, because both play and search query tracks anyway.

Expected behavior Should provide the check correctly and cancel the interaction instead. Quaver shouldn't crash from this behaviour from its users.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 3.3.0-next.4 :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.3.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: