magmastream 2.9.0-dev.25 → 2.9.0-dev.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -799,8 +799,14 @@ class Player {
799
799
  }
800
800
  try {
801
801
  const playerPosition = this.position;
802
- const { sessionId, event: { token, endpoint }, } = this.voiceState;
803
802
  const currentTrack = (await this.queue.getCurrent()) ? await this.queue.getCurrent() : null;
803
+ // Safely get voice state properties with null checks
804
+ const sessionId = this.voiceState?.sessionId;
805
+ const token = this.voiceState?.event?.token;
806
+ const endpoint = this.voiceState?.event?.endpoint;
807
+ if (!sessionId || !token || !endpoint) {
808
+ throw new Error(`Voice state is not properly initialized for player ${this.guildId}. The bot might not be connected to a voice channel.`);
809
+ }
804
810
  await this.node.rest.destroyPlayer(this.guildId).catch(() => { });
805
811
  this.manager.players.delete(this.guildId);
806
812
  this.node = node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magmastream",
3
- "version": "2.9.0-dev.25",
3
+ "version": "2.9.0-dev.26",
4
4
  "description": "A user-friendly Lavalink client designed for NodeJS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -90,4 +90,4 @@
90
90
  "homepage": "https://docs.magmastream.com",
91
91
  "author": "Abel Purnwasy",
92
92
  "license": "Apache-2.0"
93
- }
93
+ }