lavalink-client 1.0.3 → 1.0.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.
Files changed (32) hide show
  1. package/README.md +32 -98
  2. package/dist/cjs/structures/LavalinkManager.d.ts +17 -15
  3. package/dist/cjs/structures/LavalinkManager.js +66 -16
  4. package/dist/cjs/structures/Node.js +16 -13
  5. package/dist/cjs/structures/NodeManager.d.ts +1 -1
  6. package/dist/cjs/structures/NodeManager.js +55 -5
  7. package/dist/cjs/structures/Player.d.ts +4 -4
  8. package/dist/cjs/structures/Player.js +22 -7
  9. package/dist/cjs/structures/Queue.d.ts +13 -11
  10. package/dist/cjs/structures/Queue.js +31 -28
  11. package/dist/cjs/structures/Track.d.ts +14 -3
  12. package/dist/cjs/structures/Utils.d.ts +34 -7
  13. package/dist/cjs/structures/Utils.js +136 -13
  14. package/dist/esm/structures/LavalinkManager.d.ts +17 -15
  15. package/dist/esm/structures/LavalinkManager.js +66 -16
  16. package/dist/esm/structures/Node.js +16 -13
  17. package/dist/esm/structures/NodeManager.d.ts +1 -1
  18. package/dist/esm/structures/NodeManager.js +55 -5
  19. package/dist/esm/structures/Player.d.ts +4 -4
  20. package/dist/esm/structures/Player.js +22 -7
  21. package/dist/esm/structures/Queue.d.ts +13 -11
  22. package/dist/esm/structures/Queue.js +32 -29
  23. package/dist/esm/structures/Track.d.ts +14 -3
  24. package/dist/esm/structures/Utils.d.ts +34 -7
  25. package/dist/esm/structures/Utils.js +136 -13
  26. package/dist/types/structures/LavalinkManager.d.ts +17 -15
  27. package/dist/types/structures/NodeManager.d.ts +1 -1
  28. package/dist/types/structures/Player.d.ts +4 -4
  29. package/dist/types/structures/Queue.d.ts +13 -11
  30. package/dist/types/structures/Track.d.ts +14 -3
  31. package/dist/types/structures/Utils.d.ts +34 -7
  32. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { Player } from "./Player";
1
2
  import { Base64 } from "./Utils";
2
3
  type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
3
4
  type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
@@ -44,11 +45,21 @@ export interface Track extends LavalinkTrack {
44
45
  /** The Track's Requester */
45
46
  requester?: unknown;
46
47
  }
47
- export interface UnresolvedQuery {
48
+ export interface UnresolvedTrackInfo extends Partial<TrackInfo> {
49
+ /** Required */
50
+ title: string;
51
+ }
52
+ export interface UnresolvedQuery extends UnresolvedTrackInfo {
48
53
  /** The base64 of the unresolved track to "encode" */
49
54
  encoded?: Base64;
50
- /** Search for the closest track possible, by providing as much information as you can! */
51
- info?: Partial<TrackInfo>;
55
+ }
56
+ export interface UnresolvedTrack {
57
+ /** Required */
58
+ resolve: (player: Player) => Promise<void>;
59
+ /** The Base 64 encoded String */
60
+ encoded?: Base64;
61
+ /** Track Information */
62
+ info: UnresolvedTrackInfo;
52
63
  /** The Track's Requester */
53
64
  requester?: unknown;
54
65
  }
@@ -1,9 +1,8 @@
1
1
  import { LavalinkFilterData } from "./Filters";
2
2
  import { LavalinkManager } from "./LavalinkManager";
3
- import { LavalinkNode, NodeStats } from "./Node";
4
- import { PlayOptions } from "./Player";
5
- import { Queue } from "./Queue";
6
- import { PluginInfo, Track } from "./Track";
3
+ import { LavalinkNode, LavalinkNodeOptions, NodeStats } from "./Node";
4
+ import { PlayOptions, Player } from "./Player";
5
+ import { PluginInfo, Track, UnresolvedTrack, UnresolvedQuery } from "./Track";
7
6
  export declare const TrackSymbol: unique symbol;
8
7
  export declare const UnresolvedTrackSymbol: unique symbol;
9
8
  export declare const QueueSymbol: unique symbol;
@@ -40,12 +39,39 @@ export interface ManagerUitls {
40
39
  export declare class ManagerUitls {
41
40
  constructor(LavalinkManager?: LavalinkManager);
42
41
  buildTrack(data: any, requester: any): Track;
42
+ /**
43
+ * Validate if a data is equal to a node
44
+ * @param data
45
+ */
46
+ isNode(data: LavalinkNode): boolean;
47
+ /**
48
+ * Validate if a data is equal to node options
49
+ * @param data
50
+ */
51
+ isNodeOptions(data: LavalinkNodeOptions | any): boolean;
43
52
  /**
44
53
  * Validate if a data is euqal to a track
45
- * @param {Track|any} data the Track to validate
46
- * @returns {boolean}
54
+ * @param data the Track to validate
55
+ * @returns
47
56
  */
48
57
  isTrack(data: Track | any): boolean;
58
+ /**
59
+ * Checks if the provided argument is a valid UnresolvedTrack.
60
+ * @param track
61
+ */
62
+ isUnresolvedTrack(data: UnresolvedTrack | any): boolean;
63
+ /**
64
+ * Checks if the provided argument is a valid UnresolvedTrack.
65
+ * @param track
66
+ */
67
+ isUnresolvedTrackQuery(data: UnresolvedTrack | any): boolean;
68
+ getClosestTrack(data: UnresolvedTrack, player: Player): Promise<Track>;
69
+ /**
70
+ * Builds a UnresolvedTrack to be resolved before being played .
71
+ * @param query
72
+ * @param requester
73
+ */
74
+ buildUnresolvedTrack(query: UnresolvedQuery | UnresolvedTrack, requester: unknown): UnresolvedTrack;
49
75
  validatedQuery(queryString: string, node: LavalinkNode): void;
50
76
  }
51
77
  /**
@@ -85,6 +111,7 @@ export declare class MiniMap<K, V> extends Map<K, V> {
85
111
  filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
86
112
  filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
87
113
  filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
114
+ toJSON(): V[];
88
115
  /**
89
116
  * Maps each item to another value into an array. Identical in behavior to
90
117
  * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
@@ -254,5 +281,5 @@ export interface NodeMessage extends NodeStats {
254
281
  op: "stats" | "playerUpdate" | "event";
255
282
  guildId: string;
256
283
  }
257
- export declare function queueTrackEnd(queue: Queue, addBackToQueue?: boolean): Promise<Track>;
284
+ export declare function queueTrackEnd(player: Player): Promise<Track>;
258
285
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Easy and advanced lavalink client. Use it with lavalink plugins as well as latest lavalink versions",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",