lavalink-client 2.2.0 → 2.2.2

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 (42) hide show
  1. package/README.md +116 -15
  2. package/dist/cjs/structures/Filters.d.ts +1 -1
  3. package/dist/cjs/structures/Filters.js +9 -9
  4. package/dist/cjs/structures/LavalinkManager.d.ts +24 -7
  5. package/dist/cjs/structures/LavalinkManager.js +15 -2
  6. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +3 -0
  7. package/dist/cjs/structures/LavalinkManagerStatics.js +4 -1
  8. package/dist/cjs/structures/Node.d.ts +307 -22
  9. package/dist/cjs/structures/Node.js +328 -72
  10. package/dist/cjs/structures/NodeManager.js +3 -1
  11. package/dist/cjs/structures/Player.d.ts +44 -8
  12. package/dist/cjs/structures/Player.js +27 -18
  13. package/dist/cjs/structures/Queue.d.ts +47 -0
  14. package/dist/cjs/structures/Queue.js +104 -1
  15. package/dist/cjs/structures/Track.d.ts +1 -0
  16. package/dist/cjs/structures/Utils.d.ts +3 -0
  17. package/dist/cjs/structures/Utils.js +6 -4
  18. package/dist/esm/structures/Filters.d.ts +1 -1
  19. package/dist/esm/structures/Filters.js +9 -9
  20. package/dist/esm/structures/LavalinkManager.d.ts +24 -7
  21. package/dist/esm/structures/LavalinkManager.js +15 -2
  22. package/dist/esm/structures/LavalinkManagerStatics.d.ts +3 -0
  23. package/dist/esm/structures/LavalinkManagerStatics.js +4 -1
  24. package/dist/esm/structures/Node.d.ts +307 -22
  25. package/dist/esm/structures/Node.js +328 -72
  26. package/dist/esm/structures/NodeManager.js +3 -1
  27. package/dist/esm/structures/Player.d.ts +44 -8
  28. package/dist/esm/structures/Player.js +27 -18
  29. package/dist/esm/structures/Queue.d.ts +47 -0
  30. package/dist/esm/structures/Queue.js +104 -1
  31. package/dist/esm/structures/Track.d.ts +1 -0
  32. package/dist/esm/structures/Utils.d.ts +3 -0
  33. package/dist/esm/structures/Utils.js +6 -4
  34. package/dist/types/structures/Filters.d.ts +1 -1
  35. package/dist/types/structures/LavalinkManager.d.ts +24 -7
  36. package/dist/types/structures/LavalinkManagerStatics.d.ts +3 -0
  37. package/dist/types/structures/Node.d.ts +307 -22
  38. package/dist/types/structures/Player.d.ts +44 -8
  39. package/dist/types/structures/Queue.d.ts +47 -0
  40. package/dist/types/structures/Track.d.ts +1 -0
  41. package/dist/types/structures/Utils.d.ts +3 -0
  42. package/package.json +2 -3
@@ -113,4 +113,51 @@ export declare class Queue {
113
113
  * @returns {Track} Spliced Track
114
114
  */
115
115
  splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
116
+ /**
117
+ * Remove stuff from the queue.tracks array
118
+ * - single Track | UnresolvedTrack
119
+ * - multiple Track | UnresovedTrack
120
+ * - at the index or multiple indexes
121
+ * @param removeQueryTrack
122
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
123
+ *
124
+ * @example
125
+ * ```js
126
+ * // remove single track
127
+ *
128
+ * const track = player.queue.tracks[4];
129
+ * await player.queue.remove(track);
130
+ *
131
+ * // if you already have the index you can straight up pass it too
132
+ * await player.queue.remove(4);
133
+ *
134
+ *
135
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
136
+ * await player.queue.remove(player.queue.tracks.slice(4, 10)) // get's the tracks from 4 - 10, which then get's found in the remove function to be removed
137
+ *
138
+ * // I still highly suggest to use .splice!
139
+ *
140
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
141
+ *
142
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
143
+ *
144
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
145
+ * ```
146
+ */
147
+ remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
148
+ removed: (Track | UnresolvedTrack)[];
149
+ } | null>;
150
+ /**
151
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
152
+ * @returns
153
+ *
154
+ * @example
155
+ * ```js
156
+ * // example on how to play the previous track again
157
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
158
+ * if(!previous) return console.error("No previous track found");
159
+ * await player.play({ clientTrack: previous }); // play it again
160
+ * ```
161
+ */
162
+ shiftPrevious(): Promise<Track>;
116
163
  }
@@ -81,6 +81,7 @@ export interface PluginInfo {
81
81
  uri?: string;
82
82
  /** You can put specific track information here, to transform the tracks... */
83
83
  clientData?: {
84
+ previousTrack?: boolean;
84
85
  [key: string]: any;
85
86
  };
86
87
  }
@@ -105,6 +105,7 @@ export declare class ManagerUtils {
105
105
  validateQueryString(node: LavalinkNode, queryString: string, sourceString?: LavalinkSearchPlatform): void;
106
106
  transformQuery(query: SearchQuery): {
107
107
  query: string;
108
+ extraQueryUrlParams: URLSearchParams;
108
109
  source: any;
109
110
  };
110
111
  transformLavaSearchQuery(query: LavaSearchQuery): {
@@ -453,6 +454,8 @@ export interface LavaSearchResponse {
453
454
  export type SearchQuery = {
454
455
  /** lavalink search Query / identifier string */
455
456
  query: string;
457
+ /** Extra url query params to use, e.g. for flowertts */
458
+ extraQueryUrlParams?: URLSearchParams;
456
459
  /** Source to append to the search query string */
457
460
  source?: SearchPlatform;
458
461
  } | /** Our just the search query / identifier string */ string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
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",
@@ -12,8 +12,7 @@
12
12
  "build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
13
13
  "clean": "node tools/cleanup",
14
14
  "lint": "eslint .",
15
- "lint:fix": "eslint --fix 'src/**/*.{ts}'",
16
- "format": "prettier --write src/**/*.ts --config ./.prettierrc.js",
15
+ "lint:fix": "npm run lint -- --fix",
17
16
  "test": "node -v",
18
17
  "docs": "npx typedoc"
19
18
  },