lavalink-client 2.5.3 → 2.5.5

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.
@@ -694,7 +694,7 @@ class FilterManager {
694
694
  }
695
695
  /** Clears the equalizer bands. */
696
696
  async clearEQ() {
697
- return this.setEQ(Array.from({ length: 15 }, () => ({ band: 0, gain: 0 })));
697
+ return this.setEQ(Array.from({ length: 15 }, (_v, i) => ({ band: i, gain: 0 })));
698
698
  }
699
699
  }
700
700
  exports.FilterManager = FilterManager;
@@ -274,8 +274,9 @@ class LavalinkManager extends events_1.EventEmitter {
274
274
  const oldPlayer = this.getPlayer(options?.guildId);
275
275
  if (oldPlayer)
276
276
  return oldPlayer;
277
- const newPlayer = new Player_1.Player(options, this);
277
+ const newPlayer = new Player_1.Player(options, this, true);
278
278
  this.players.set(newPlayer.guildId, newPlayer);
279
+ this.emit("playerCreate", newPlayer);
279
280
  return newPlayer;
280
281
  }
281
282
  /**
@@ -66,7 +66,7 @@ export declare class Player {
66
66
  * @param options
67
67
  * @param LavalinkManager
68
68
  */
69
- constructor(options: PlayerOptions, LavalinkManager: LavalinkManager);
69
+ constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
70
70
  /**
71
71
  * Set custom data.
72
72
  * @param key
@@ -73,7 +73,7 @@ class Player {
73
73
  * @param options
74
74
  * @param LavalinkManager
75
75
  */
76
- constructor(options, LavalinkManager) {
76
+ constructor(options, LavalinkManager, dontEmitPlayerCreateEvent) {
77
77
  if (typeof options?.customData === "object")
78
78
  for (const [key, value] of Object.entries(options.customData))
79
79
  this.set(key, value);
@@ -105,7 +105,8 @@ class Player {
105
105
  this.lavalinkVolume = Math.round(Math.max(Math.min(Math.round(this.LavalinkManager.options.playerOptions.volumeDecrementer
106
106
  ? this.volume * this.LavalinkManager.options.playerOptions.volumeDecrementer
107
107
  : this.volume), 1000), 0));
108
- this.LavalinkManager.emit("playerCreate", this);
108
+ if (!dontEmitPlayerCreateEvent)
109
+ this.LavalinkManager.emit("playerCreate", this);
109
110
  this.queue = new Queue_1.Queue(this.guildId, {}, new Queue_1.QueueSaver(this.LavalinkManager.options.queueOptions), this.LavalinkManager.options.queueOptions);
110
111
  }
111
112
  /**
@@ -691,6 +691,6 @@ export class FilterManager {
691
691
  }
692
692
  /** Clears the equalizer bands. */
693
693
  async clearEQ() {
694
- return this.setEQ(Array.from({ length: 15 }, () => ({ band: 0, gain: 0 })));
694
+ return this.setEQ(Array.from({ length: 15 }, (_v, i) => ({ band: i, gain: 0 })));
695
695
  }
696
696
  }
@@ -271,8 +271,9 @@ export class LavalinkManager extends EventEmitter {
271
271
  const oldPlayer = this.getPlayer(options?.guildId);
272
272
  if (oldPlayer)
273
273
  return oldPlayer;
274
- const newPlayer = new Player(options, this);
274
+ const newPlayer = new Player(options, this, true);
275
275
  this.players.set(newPlayer.guildId, newPlayer);
276
+ this.emit("playerCreate", newPlayer);
276
277
  return newPlayer;
277
278
  }
278
279
  /**
@@ -66,7 +66,7 @@ export declare class Player {
66
66
  * @param options
67
67
  * @param LavalinkManager
68
68
  */
69
- constructor(options: PlayerOptions, LavalinkManager: LavalinkManager);
69
+ constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
70
70
  /**
71
71
  * Set custom data.
72
72
  * @param key
@@ -70,7 +70,7 @@ export class Player {
70
70
  * @param options
71
71
  * @param LavalinkManager
72
72
  */
73
- constructor(options, LavalinkManager) {
73
+ constructor(options, LavalinkManager, dontEmitPlayerCreateEvent) {
74
74
  if (typeof options?.customData === "object")
75
75
  for (const [key, value] of Object.entries(options.customData))
76
76
  this.set(key, value);
@@ -102,7 +102,8 @@ export class Player {
102
102
  this.lavalinkVolume = Math.round(Math.max(Math.min(Math.round(this.LavalinkManager.options.playerOptions.volumeDecrementer
103
103
  ? this.volume * this.LavalinkManager.options.playerOptions.volumeDecrementer
104
104
  : this.volume), 1000), 0));
105
- this.LavalinkManager.emit("playerCreate", this);
105
+ if (!dontEmitPlayerCreateEvent)
106
+ this.LavalinkManager.emit("playerCreate", this);
106
107
  this.queue = new Queue(this.guildId, {}, new QueueSaver(this.LavalinkManager.options.queueOptions), this.LavalinkManager.options.queueOptions);
107
108
  }
108
109
  /**
@@ -66,7 +66,7 @@ export declare class Player {
66
66
  * @param options
67
67
  * @param LavalinkManager
68
68
  */
69
- constructor(options: PlayerOptions, LavalinkManager: LavalinkManager);
69
+ constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
70
70
  /**
71
71
  * Set custom data.
72
72
  * @param key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.5.3",
3
+ "version": "2.5.5",
4
4
  "description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",