lavalink-client 2.7.3 → 2.7.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.
package/dist/index.d.mts CHANGED
@@ -24,6 +24,15 @@ declare class FilterManager {
24
24
  data: FilterData;
25
25
  /** The Player assigned to this Filter Manager */
26
26
  player: Player;
27
+ private get _LManager();
28
+ /**
29
+ * Returns wether the plugin validations are enabled or not
30
+ */
31
+ private get _checkForPlugins();
32
+ /**
33
+ * Returns wether the source validations are enabled or not
34
+ */
35
+ private get _checkForSources();
27
36
  /** The Constructor for the FilterManager */
28
37
  constructor(player: Player);
29
38
  /**
@@ -820,6 +829,12 @@ declare class Player {
820
829
  };
821
830
  /** Custom data for the player */
822
831
  private readonly data;
832
+ /**
833
+ * Emits a debug event to the LavalinkManager
834
+ * @param name name of the event
835
+ * @param eventData event data
836
+ */
837
+ private _emitDebugEvent;
823
838
  /**
824
839
  * Create a new Player
825
840
  * @param options
@@ -983,11 +998,15 @@ declare class Player {
983
998
  */
984
999
  changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
985
1000
  /**
986
- * Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
1001
+ * (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
987
1002
  * @param node the id of the node to move to
988
1003
  * @returns the player
989
1004
  * @throws RangeError if there is no available nodes.
990
1005
  * @throws Error if the node to move to is the same as the current node.
1006
+ * @example
1007
+ * ```ts
1008
+ * const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
1009
+ * ```
991
1010
  */
992
1011
  moveNode(node?: string): Promise<string | this>;
993
1012
  /** Converts the Player including Queue to a Json state */
@@ -1770,7 +1789,10 @@ declare enum DebugEvents {
1770
1789
  PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
1771
1790
  FailedToConnectToNodes = "FailedToConnectToNodes",
1772
1791
  NoAudioDebug = "NoAudioDebug",
1773
- PlayerAutoReconnect = "PlayerAutoReconnect"
1792
+ PlayerAutoReconnect = "PlayerAutoReconnect",
1793
+ PlayerDestroyFail = "PlayerDestroyFail",
1794
+ PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
1795
+ PlayerChangeNodeFail = "PlayerChangeNodeFail"
1774
1796
  }
1775
1797
  /**
1776
1798
  * Reasons why a player got destroyed
@@ -2185,7 +2207,6 @@ declare enum ReconnectionState {
2185
2207
  declare class LavalinkNode {
2186
2208
  private heartBeatPingTimestamp;
2187
2209
  private heartBeatPongTimestamp;
2188
- get heartBeatPing(): number;
2189
2210
  private heartBeatInterval?;
2190
2211
  private pingTimeout?;
2191
2212
  isAlive: boolean;
@@ -2216,6 +2237,52 @@ declare class LavalinkNode {
2216
2237
  private socket;
2217
2238
  /** Version of what the Lavalink Server should be */
2218
2239
  private version;
2240
+ /**
2241
+ * Returns the LavalinkManager of the Node
2242
+ */
2243
+ private get _LManager();
2244
+ /**
2245
+ * Returns the Heartbeat Ping of the Node
2246
+ */
2247
+ get heartBeatPing(): number;
2248
+ /**
2249
+ * Returns wether the plugin validations are enabled or not
2250
+ */
2251
+ private get _checkForPlugins();
2252
+ /**
2253
+ * Returns wether the source validations are enabled or not
2254
+ */
2255
+ private get _checkForSources();
2256
+ /**
2257
+ * Emits a debug event to the LavalinkManager
2258
+ * @param name name of the event
2259
+ * @param eventData event data
2260
+ */
2261
+ private _emitDebugEvent;
2262
+ /**
2263
+ * Returns if connected to the Node.
2264
+ *
2265
+ * @example
2266
+ * ```ts
2267
+ * const isConnected = player.node.connected;
2268
+ * console.log("node is connected: ", isConnected ? "yes" : "no")
2269
+ * ```
2270
+ */
2271
+ get connected(): boolean;
2272
+ /**
2273
+ * Returns the current ConnectionStatus
2274
+ *
2275
+ * @example
2276
+ * ```ts
2277
+ * try {
2278
+ * const statusOfConnection = player.node.connectionStatus;
2279
+ * console.log("node's connection status is:", statusOfConnection)
2280
+ * } catch (error) {
2281
+ * console.error("no socket available?", error)
2282
+ * }
2283
+ * ```
2284
+ */
2285
+ get connectionStatus(): string;
2219
2286
  /**
2220
2287
  * Create a new Node
2221
2288
  * @param options Lavalink Node Options
@@ -2361,34 +2428,10 @@ declare class LavalinkNode {
2361
2428
  *
2362
2429
  * @example
2363
2430
  * ```ts
2364
- * player.node.destroy("custom Player Destroy Reason", true);
2431
+ * player.node.disconnect("Forcefully disconnect the connection to the node.");
2365
2432
  * ```
2366
2433
  */
2367
2434
  disconnect(disconnectReason?: DisconnectReasonsType): void;
2368
- /**
2369
- * Returns if connected to the Node.
2370
- *
2371
- * @example
2372
- * ```ts
2373
- * const isConnected = player.node.connected;
2374
- * console.log("node is connected: ", isConnected ? "yes" : "no")
2375
- * ```
2376
- */
2377
- get connected(): boolean;
2378
- /**
2379
- * Returns the current ConnectionStatus
2380
- *
2381
- * @example
2382
- * ```ts
2383
- * try {
2384
- * const statusOfConnection = player.node.connectionStatus;
2385
- * console.log("node's connection status is:", statusOfConnection)
2386
- * } catch (error) {
2387
- * console.error("no socket available?", error)
2388
- * }
2389
- * ```
2390
- */
2391
- get connectionStatus(): string;
2392
2435
  /**
2393
2436
  * Gets all Players of a Node
2394
2437
  * @returns array of players inside of lavalink
@@ -3067,6 +3110,13 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
3067
3110
  linksBlacklist?: (RegExp | string)[];
3068
3111
  /** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
3069
3112
  linksAllowed?: boolean;
3113
+ /** If the library should automatically check something, on default everything is enabled */
3114
+ autoChecks?: {
3115
+ /** Wether or not the client should check if the requested source's plugin is available on the node. */
3116
+ pluginValidations?: boolean;
3117
+ /** Wether or not the client should check if the requested source is available on the node */
3118
+ sourcesValidations?: boolean;
3119
+ };
3070
3120
  /** Advanced Options for the Library, which may or may not be "library breaking" */
3071
3121
  advancedOptions?: {
3072
3122
  /** Max duration for that the filter fix duration works (in ms) - default is 8mins */
@@ -3147,6 +3197,12 @@ declare class LavalinkManager<CustomPlayerT extends Player = Player> extends Eve
3147
3197
  * @param options
3148
3198
  */
3149
3199
  private validateOptions;
3200
+ /**
3201
+ * Emits a debug event to the LavalinkManager
3202
+ * @param name name of the event
3203
+ * @param eventData event data
3204
+ */
3205
+ private _emitDebugEvent;
3150
3206
  /**
3151
3207
  * Create the Lavalink Manager
3152
3208
  * @param options
package/dist/index.d.ts CHANGED
@@ -24,6 +24,15 @@ declare class FilterManager {
24
24
  data: FilterData;
25
25
  /** The Player assigned to this Filter Manager */
26
26
  player: Player;
27
+ private get _LManager();
28
+ /**
29
+ * Returns wether the plugin validations are enabled or not
30
+ */
31
+ private get _checkForPlugins();
32
+ /**
33
+ * Returns wether the source validations are enabled or not
34
+ */
35
+ private get _checkForSources();
27
36
  /** The Constructor for the FilterManager */
28
37
  constructor(player: Player);
29
38
  /**
@@ -820,6 +829,12 @@ declare class Player {
820
829
  };
821
830
  /** Custom data for the player */
822
831
  private readonly data;
832
+ /**
833
+ * Emits a debug event to the LavalinkManager
834
+ * @param name name of the event
835
+ * @param eventData event data
836
+ */
837
+ private _emitDebugEvent;
823
838
  /**
824
839
  * Create a new Player
825
840
  * @param options
@@ -983,11 +998,15 @@ declare class Player {
983
998
  */
984
999
  changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
985
1000
  /**
986
- * Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
1001
+ * (Wrapper-FN for changeNode) Move the player to a different node. If no node is provided, it will find the least used node that is not the same as the current node.
987
1002
  * @param node the id of the node to move to
988
1003
  * @returns the player
989
1004
  * @throws RangeError if there is no available nodes.
990
1005
  * @throws Error if the node to move to is the same as the current node.
1006
+ * @example
1007
+ * ```ts
1008
+ * const newNodeMovedTo = await player.moveNode(); // no need to specify the new node, it will find a least used node automatically, but you can ofc. use a custom node id.
1009
+ * ```
991
1010
  */
992
1011
  moveNode(node?: string): Promise<string | this>;
993
1012
  /** Converts the Player including Queue to a Json state */
@@ -1770,7 +1789,10 @@ declare enum DebugEvents {
1770
1789
  PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
1771
1790
  FailedToConnectToNodes = "FailedToConnectToNodes",
1772
1791
  NoAudioDebug = "NoAudioDebug",
1773
- PlayerAutoReconnect = "PlayerAutoReconnect"
1792
+ PlayerAutoReconnect = "PlayerAutoReconnect",
1793
+ PlayerDestroyFail = "PlayerDestroyFail",
1794
+ PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
1795
+ PlayerChangeNodeFail = "PlayerChangeNodeFail"
1774
1796
  }
1775
1797
  /**
1776
1798
  * Reasons why a player got destroyed
@@ -2185,7 +2207,6 @@ declare enum ReconnectionState {
2185
2207
  declare class LavalinkNode {
2186
2208
  private heartBeatPingTimestamp;
2187
2209
  private heartBeatPongTimestamp;
2188
- get heartBeatPing(): number;
2189
2210
  private heartBeatInterval?;
2190
2211
  private pingTimeout?;
2191
2212
  isAlive: boolean;
@@ -2216,6 +2237,52 @@ declare class LavalinkNode {
2216
2237
  private socket;
2217
2238
  /** Version of what the Lavalink Server should be */
2218
2239
  private version;
2240
+ /**
2241
+ * Returns the LavalinkManager of the Node
2242
+ */
2243
+ private get _LManager();
2244
+ /**
2245
+ * Returns the Heartbeat Ping of the Node
2246
+ */
2247
+ get heartBeatPing(): number;
2248
+ /**
2249
+ * Returns wether the plugin validations are enabled or not
2250
+ */
2251
+ private get _checkForPlugins();
2252
+ /**
2253
+ * Returns wether the source validations are enabled or not
2254
+ */
2255
+ private get _checkForSources();
2256
+ /**
2257
+ * Emits a debug event to the LavalinkManager
2258
+ * @param name name of the event
2259
+ * @param eventData event data
2260
+ */
2261
+ private _emitDebugEvent;
2262
+ /**
2263
+ * Returns if connected to the Node.
2264
+ *
2265
+ * @example
2266
+ * ```ts
2267
+ * const isConnected = player.node.connected;
2268
+ * console.log("node is connected: ", isConnected ? "yes" : "no")
2269
+ * ```
2270
+ */
2271
+ get connected(): boolean;
2272
+ /**
2273
+ * Returns the current ConnectionStatus
2274
+ *
2275
+ * @example
2276
+ * ```ts
2277
+ * try {
2278
+ * const statusOfConnection = player.node.connectionStatus;
2279
+ * console.log("node's connection status is:", statusOfConnection)
2280
+ * } catch (error) {
2281
+ * console.error("no socket available?", error)
2282
+ * }
2283
+ * ```
2284
+ */
2285
+ get connectionStatus(): string;
2219
2286
  /**
2220
2287
  * Create a new Node
2221
2288
  * @param options Lavalink Node Options
@@ -2361,34 +2428,10 @@ declare class LavalinkNode {
2361
2428
  *
2362
2429
  * @example
2363
2430
  * ```ts
2364
- * player.node.destroy("custom Player Destroy Reason", true);
2431
+ * player.node.disconnect("Forcefully disconnect the connection to the node.");
2365
2432
  * ```
2366
2433
  */
2367
2434
  disconnect(disconnectReason?: DisconnectReasonsType): void;
2368
- /**
2369
- * Returns if connected to the Node.
2370
- *
2371
- * @example
2372
- * ```ts
2373
- * const isConnected = player.node.connected;
2374
- * console.log("node is connected: ", isConnected ? "yes" : "no")
2375
- * ```
2376
- */
2377
- get connected(): boolean;
2378
- /**
2379
- * Returns the current ConnectionStatus
2380
- *
2381
- * @example
2382
- * ```ts
2383
- * try {
2384
- * const statusOfConnection = player.node.connectionStatus;
2385
- * console.log("node's connection status is:", statusOfConnection)
2386
- * } catch (error) {
2387
- * console.error("no socket available?", error)
2388
- * }
2389
- * ```
2390
- */
2391
- get connectionStatus(): string;
2392
2435
  /**
2393
2436
  * Gets all Players of a Node
2394
2437
  * @returns array of players inside of lavalink
@@ -3067,6 +3110,13 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
3067
3110
  linksBlacklist?: (RegExp | string)[];
3068
3111
  /** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
3069
3112
  linksAllowed?: boolean;
3113
+ /** If the library should automatically check something, on default everything is enabled */
3114
+ autoChecks?: {
3115
+ /** Wether or not the client should check if the requested source's plugin is available on the node. */
3116
+ pluginValidations?: boolean;
3117
+ /** Wether or not the client should check if the requested source is available on the node */
3118
+ sourcesValidations?: boolean;
3119
+ };
3070
3120
  /** Advanced Options for the Library, which may or may not be "library breaking" */
3071
3121
  advancedOptions?: {
3072
3122
  /** Max duration for that the filter fix duration works (in ms) - default is 8mins */
@@ -3147,6 +3197,12 @@ declare class LavalinkManager<CustomPlayerT extends Player = Player> extends Eve
3147
3197
  * @param options
3148
3198
  */
3149
3199
  private validateOptions;
3200
+ /**
3201
+ * Emits a debug event to the LavalinkManager
3202
+ * @param name name of the event
3203
+ * @param eventData event data
3204
+ */
3205
+ private _emitDebugEvent;
3150
3206
  /**
3151
3207
  * Create the Lavalink Manager
3152
3208
  * @param options