magmastream 2.8.6-dev.2 → 2.8.6-dev.4

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.
@@ -455,8 +455,9 @@ class Manager extends events_1.EventEmitter {
455
455
  if (state.dynamicRepeat) {
456
456
  player.setDynamicRepeat(state.dynamicRepeat, state.dynamicLoopInterval._idleTimeout);
457
457
  }
458
- if (state.isAutoplay && state?.data?.Internal_BotUser) {
459
- player.setAutoplay(state.isAutoplay, state.data.Internal_BotUser);
458
+ if (state.isAutoplay) {
459
+ Object.setPrototypeOf(state.data.clientUser, { constructor: { name: "User" } });
460
+ player.setAutoplay(true, state.data.clientUser, state.autoplayTries);
460
461
  }
461
462
  if (state.data) {
462
463
  for (const [name, value] of Object.entries(state.data)) {
@@ -770,6 +771,11 @@ class Manager extends events_1.EventEmitter {
770
771
  previous: [...value.previous],
771
772
  };
772
773
  }
774
+ if (key === "data") {
775
+ return {
776
+ clientUser: value.Internal_BotUser ?? null,
777
+ };
778
+ }
773
779
  return serialize(value);
774
780
  }));
775
781
  }
@@ -340,14 +340,14 @@ class Player {
340
340
  */
341
341
  setAutoplay(autoplayState, botUser, tries) {
342
342
  if (typeof autoplayState !== "boolean") {
343
- throw new TypeError("autoplayState must be a boolean.");
343
+ throw new Error("autoplayState must be a boolean.");
344
344
  }
345
345
  if (autoplayState) {
346
346
  if (!botUser) {
347
- throw new TypeError("botUser must be provided when enabling autoplay.");
347
+ throw new Error("botUser must be provided when enabling autoplay.");
348
348
  }
349
349
  if (!["ClientUser", "User"].includes(botUser.constructor.name)) {
350
- throw new TypeError("botUser must be a user-object.");
350
+ throw new Error("botUser must be a user-object.");
351
351
  }
352
352
  this.autoplayTries = tries && typeof tries === "number" && tries > 0 ? tries : 3; // Default to 3 if invalid
353
353
  this.isAutoplay = true;
@@ -103,7 +103,7 @@ class Queue extends Array {
103
103
  }
104
104
  }
105
105
  }
106
- if (this.manager.players.get(this.guildId).isAutoplay) {
106
+ if (this.manager.players.has(this.guildId) && this.manager.players.get(this.guildId).isAutoplay) {
107
107
  if (!Array.isArray(track)) {
108
108
  const botUser = this.manager.players.get(this.guildId).get("Internal_BotUser");
109
109
  if (botUser && botUser.id === track.requester.id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magmastream",
3
- "version": "2.8.6-dev.2",
3
+ "version": "2.8.6-dev.4",
4
4
  "description": "A user-friendly Lavalink client designed for NodeJS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",