lavalibs / lavalink.js

A JavaScript wrapper for Lavalink.
MIT License
57 stars 19 forks source link

Destroyed players get recreated immediately after closure #18

Closed appellation closed 5 years ago

appellation commented 5 years ago

Describe the bug After destroying a player, Lavalink sends back an "event" event describing the websocket close. This event recreates the player and puts it into a "stuck" state. This is caused by Lavalink changing the available values of the type property to include websocket close events.

To Reproduce Steps to reproduce the behavior:

  1. Create a player by playing something using the Player#play method
  2. Destroy the player using the Player#destroy method
  3. Wait a short bit (200ms is probably plenty)
  4. The player still exists and is in a stuck state

Expected behavior The player should be destroyed and not recreated.

Screenshots image

Additional context Reported by a user in the Discord server. Unable to reproduce personally, but likely caused by a newer version of Lavalink. Unsure which Lavalink version.

Fixing this problem will involve adjusting the available event types.

Changing https://github.com/lavalibs/lavalink.js/blob/3b2bc663915283e917ba68c586dc8a5550cdeb1a/src/core/Connection.ts#L46 to check for the existence of the player should resolve this issue.