lavalink-client 2.2.1 → 2.3.0

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 (90) hide show
  1. package/README.md +140 -20
  2. package/dist/cjs/index.d.ts +7 -1
  3. package/dist/cjs/index.js +7 -1
  4. package/dist/cjs/structures/Constants.d.ts +40 -0
  5. package/dist/cjs/structures/Constants.js +244 -0
  6. package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  7. package/dist/cjs/structures/Filters.d.ts +2 -217
  8. package/dist/cjs/structures/Filters.js +12 -236
  9. package/dist/cjs/structures/LavalinkManager.d.ts +31 -166
  10. package/dist/cjs/structures/LavalinkManager.js +60 -8
  11. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
  12. package/dist/cjs/structures/LavalinkManagerStatics.js +1 -1
  13. package/dist/cjs/structures/Node.d.ts +15 -156
  14. package/dist/cjs/structures/Node.js +140 -51
  15. package/dist/cjs/structures/NodeManager.d.ts +54 -52
  16. package/dist/cjs/structures/NodeManager.js +77 -5
  17. package/dist/cjs/structures/Player.d.ts +31 -124
  18. package/dist/cjs/structures/Player.js +78 -43
  19. package/dist/cjs/structures/Queue.d.ts +113 -42
  20. package/dist/cjs/structures/Queue.js +169 -8
  21. package/dist/cjs/structures/Types/Filters.d.ts +190 -0
  22. package/dist/cjs/structures/Types/Manager.d.ts +184 -0
  23. package/dist/cjs/structures/Types/Manager.js +2 -0
  24. package/dist/cjs/structures/Types/Node.d.ts +216 -0
  25. package/dist/cjs/structures/Types/Node.js +2 -0
  26. package/dist/cjs/structures/Types/Player.d.ts +108 -0
  27. package/dist/cjs/structures/Types/Player.js +2 -0
  28. package/dist/cjs/structures/Types/Queue.d.ts +34 -0
  29. package/dist/cjs/structures/Types/Queue.js +2 -0
  30. package/dist/cjs/structures/{Track.d.ts → Types/Track.d.ts} +4 -2
  31. package/dist/cjs/structures/Types/Track.js +2 -0
  32. package/dist/cjs/structures/Types/Utils.d.ts +367 -0
  33. package/dist/cjs/structures/Types/Utils.js +2 -0
  34. package/dist/cjs/structures/Utils.d.ts +13 -369
  35. package/dist/cjs/structures/Utils.js +40 -18
  36. package/dist/esm/index.d.ts +7 -1
  37. package/dist/esm/index.js +7 -1
  38. package/dist/esm/structures/Constants.d.ts +40 -0
  39. package/dist/esm/structures/Constants.js +241 -0
  40. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  41. package/dist/esm/structures/Filters.d.ts +2 -217
  42. package/dist/esm/structures/Filters.js +7 -231
  43. package/dist/esm/structures/LavalinkManager.d.ts +31 -166
  44. package/dist/esm/structures/LavalinkManager.js +58 -6
  45. package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
  46. package/dist/esm/structures/LavalinkManagerStatics.js +1 -1
  47. package/dist/esm/structures/Node.d.ts +15 -156
  48. package/dist/esm/structures/Node.js +132 -43
  49. package/dist/esm/structures/NodeManager.d.ts +54 -52
  50. package/dist/esm/structures/NodeManager.js +74 -2
  51. package/dist/esm/structures/Player.d.ts +31 -124
  52. package/dist/esm/structures/Player.js +77 -42
  53. package/dist/esm/structures/Queue.d.ts +113 -42
  54. package/dist/esm/structures/Queue.js +169 -8
  55. package/dist/esm/structures/Types/Filters.d.ts +190 -0
  56. package/dist/esm/structures/Types/Manager.d.ts +184 -0
  57. package/dist/esm/structures/Types/Manager.js +1 -0
  58. package/dist/esm/structures/Types/Node.d.ts +216 -0
  59. package/dist/esm/structures/Types/Node.js +1 -0
  60. package/dist/esm/structures/Types/Player.d.ts +108 -0
  61. package/dist/esm/structures/Types/Player.js +1 -0
  62. package/dist/esm/structures/Types/Queue.d.ts +34 -0
  63. package/dist/esm/structures/Types/Queue.js +1 -0
  64. package/dist/{types/structures → esm/structures/Types}/Track.d.ts +4 -2
  65. package/dist/esm/structures/Types/Track.js +1 -0
  66. package/dist/esm/structures/Types/Utils.d.ts +367 -0
  67. package/dist/esm/structures/Types/Utils.js +1 -0
  68. package/dist/esm/structures/Utils.d.ts +13 -369
  69. package/dist/esm/structures/Utils.js +40 -18
  70. package/dist/types/index.d.ts +7 -1
  71. package/dist/types/structures/Constants.d.ts +40 -0
  72. package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  73. package/dist/types/structures/Filters.d.ts +2 -217
  74. package/dist/types/structures/LavalinkManager.d.ts +31 -166
  75. package/dist/types/structures/LavalinkManagerStatics.d.ts +1 -1
  76. package/dist/types/structures/Node.d.ts +15 -156
  77. package/dist/types/structures/NodeManager.d.ts +54 -52
  78. package/dist/types/structures/Player.d.ts +31 -124
  79. package/dist/types/structures/Queue.d.ts +113 -42
  80. package/dist/types/structures/Types/Filters.d.ts +190 -0
  81. package/dist/types/structures/Types/Manager.d.ts +184 -0
  82. package/dist/types/structures/Types/Node.d.ts +216 -0
  83. package/dist/types/structures/Types/Player.d.ts +108 -0
  84. package/dist/types/structures/Types/Queue.d.ts +34 -0
  85. package/dist/{esm/structures → types/structures/Types}/Track.d.ts +4 -2
  86. package/dist/types/structures/Types/Utils.d.ts +367 -0
  87. package/dist/types/structures/Utils.d.ts +13 -369
  88. package/package.json +1 -1
  89. /package/dist/cjs/structures/{Track.js → Types/Filters.js} +0 -0
  90. /package/dist/esm/structures/{Track.js → Types/Filters.js} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.
3
3
 
4
4
  <div align="center">
5
- <p>
5
+ <p>
6
6
  <img src="https://madewithlove.now.sh/at?heart=true&template=for-the-badge" alt="Made with love in Austria">
7
7
  <img alt="Made with TypeScript" src="https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white">
8
8
  </p>
@@ -75,7 +75,7 @@ Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) | or the [
75
75
 
76
76
  - ✨ Choose able queue stores (maps, collections, redis, databases, ...)
77
77
  - You can create your own queueStore, thus make it easy to sync queues accross multiple connections (e.g. dashboard-bot)
78
- - Automated Queue Sync methods
78
+ - Automated Queue Sync methods
79
79
  - Automated unresolveable Tracks (save the queries as Partial Track Objects -> Fetch the tracks only once they are gonna play)
80
80
 
81
81
  - 😍 Included Filter & Equalizer Management
@@ -91,20 +91,20 @@ Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) | or the [
91
91
 
92
92
  - 🛡️ Client Validations
93
93
  - Allows you to whitelist links and even blacklist links / words / domain names, so that it doesn't allow requests you don't want!
94
- - Checks almost all Lavalink Requests for out of bound errors, right before the request is made to prevent process breaking errors.
94
+ - Checks almost all Lavalink Requests for out of bound errors, right before the request is made to prevent process breaking errors.
95
95
 
96
96
  - 🧑‍💻 Memory friendly and easy style
97
97
  - Only the required data is displayed, and the store-way & types match Lavalink#IMPLEMENTATION.md
98
98
 
99
99
  - 😘 Automated Handlings
100
- - Skips the songs, on TrackEnd, TrackStuck, TrackError,
100
+ - Skips the songs, on TrackEnd, TrackStuck, TrackError,
101
101
  - Destroys the player on channeldelete
102
102
  - Pauses / resumes the player if it get's muted / unmuted (server-wide) [soon]
103
103
  - ...
104
104
 
105
105
  - 😁 Much much more!
106
106
 
107
- ***
107
+ ***
108
108
 
109
109
  # All Events:
110
110
 
@@ -146,7 +146,7 @@ client.lavalink.on("error", (node, error, payload) => {
146
146
  - `error` ➡️ `(node, error, payload) => {}`
147
147
  - `resumed` ➡️ `(node, payload, players) => {}`
148
148
  - Resuming needs to be handled manually by you *(aka add the players to the manager)*
149
- - e.g.:
149
+ - e.g. of listening to node events:
150
150
  ```js
151
151
  client.lavalink.nodeManager.on("create", (node, payload) => {
152
152
  console.log(`The Lavalink Node #${node.id} connected`);
@@ -169,10 +169,10 @@ class myCustomWatcher implements QueueChangesWatcher {
169
169
  this.client = client;
170
170
  }
171
171
  shuffled(guildId, oldStoredQueue, newStoredQueue) {
172
- console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: Queue got shuffled`)
172
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: Queue got shuffled`)
173
173
  }
174
174
  tracksAdd(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
175
- console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got added into the Queue at position #${position}`);
175
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got added into the Queue at position #${position}`);
176
176
  }
177
177
  tracksRemoved(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
178
178
  console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got removed from the Queue at position #${position}`);
@@ -208,9 +208,77 @@ client.lavalink.nodeManager.on("resumed", (node, payload, fetchedPlayers) => {
208
208
  await player.queue.utils.sync(); // only works with a queuestore
209
209
  // you can now overwride the player.queue.current track from the fetchedPlayer, or use the one from the queue.uztils.sync function
210
210
  // continue with your resuming code...
211
- }
211
+ }
212
212
  })
213
- ```
213
+ ```
214
+
215
+ ## Resuming full Example
216
+ Full code sample: can be found on the [Testbot in here](https://github.com/Tomato6966/lavalink-client/blob/main/testBot/Utils/handleResuming.ts)
217
+ ```js
218
+ // but here is the schema:
219
+ client.lavalink.nodeManager.on("connect", (node) => node.updateSession(true, 360e3));
220
+ client.lavalink.nodeManager.on("resumed", (node, payload, fetchedPlayers) => {
221
+ // create players:
222
+ for(const fetchedPlayer of fetchedPlayers) {
223
+ // fetchedPlayer is the live data from lavalink
224
+ // saved Player data is the config you should save in a database / file or smt
225
+ const savedPlayerData = await getSavedPlayerData(fetchedPlayer.guildId);
226
+ const player = client.lavalink.createPlayer({
227
+ guildId: fetchedPlayer.guildId,
228
+ });
229
+ // if lavalink says the bot got disconnected, we can skip the resuming, or force reconnect whatever you want!, here we choose to not do anything and thus delete the saved player data
230
+ if(!data.state.connected) {
231
+ console.log("skipping resuming player, because it already disconnected");
232
+ await deletedSavedPlayerData(data.guildId);
233
+ continue;
234
+ }
235
+ // now you can create the player based on the live and saved data
236
+ const player = client.lavalink.createPlayer({
237
+ guildId: data.guildId,
238
+ node: node.id,
239
+ // you need to update the volume of the player by the volume of lavalink which might got decremented by the volume decrementer
240
+ volume: client.lavalink.options.playerOptions?.volumeDecrementer
241
+ ? Math.round(data.volume / client.lavalink.options.playerOptions.volumeDecrementer)
242
+ : data.volume,
243
+ // all of the following options are needed to be provided by some sort of player saving
244
+ voiceChannelId: dataOfSaving.voiceChannelId,
245
+ textChannelId: dataOfSaving.textChannelId,
246
+ // all of the following options can either be saved too, or you can use pre-defined defaults
247
+ selfDeaf: dataOfSaving.options?.selfDeaf || true,
248
+ selfMute: dataOfSaving.options?.selfMute || false,
249
+
250
+ applyVolumeAsFilter: dataOfSaving.options.applyVolumeAsFilter,
251
+ instaUpdateFiltersFix: dataOfSaving.options.instaUpdateFiltersFix,
252
+ vcRegion: dataOfSaving.options.vcRegion,
253
+ });
254
+
255
+ // player.voice = data.voice;
256
+ // normally just player.voice is enough, but if you restart the entire bot, you need to create a new connection, thus call player.connect();
257
+ await player.connect();
258
+
259
+ player.filterManager.data = data.filters; // override the filters data
260
+ await player.queue.utils.sync(true, false); // get the queue data including the current track (for the requester)
261
+ // override the current track with the data from lavalink
262
+ if(data.track) player.queue.current = client.lavalink.utils.buildTrack(data.track, player.queue.current?.requester || client.user);
263
+ // override the position of the player
264
+ player.lastPosition = data.state.position;
265
+ player.lastPositionChange = Date.now();
266
+ // you can also override the ping of the player, or wait about 30s till it's done automatically
267
+ player.ping.lavalink = data.state.ping;
268
+ // important to have skipping work correctly later
269
+ player.paused = data.paused;
270
+ player.playing = !data.paused && !!data.track;
271
+ // That's about it
272
+ }
273
+ })
274
+ client.lavalink.on("playerUpdate", (oldPlayer, newPlayer) => { // automatically sync player data on updates. if you don'T want to save everything you can instead also just save the data on playerCreate
275
+ setSavedPlayerData(newPlayer.toJSON());
276
+ });
277
+ // delete the player again
278
+ client.lavalink.on("playerDestroy", (player) => {
279
+ deleteSavedPlayerData(player.guildId);
280
+ })
281
+ ```
214
282
 
215
283
  ***
216
284
 
@@ -228,7 +296,7 @@ const extraParams = new URLSearchParams();
228
296
  if(voice) extraParams.append(`voice`, voice);
229
297
 
230
298
  // all params for flowertts can be found here: https://flowery.pw/docs
231
- const response = await player.search({
299
+ const response = await player.search({
232
300
  query: `${query}`,
233
301
  extraQueryUrlParams: extraParams, // as of my knowledge this is currently only used for flowertts, adjusting the playback url dynamically mid-request
234
302
  source: "ftts"
@@ -236,7 +304,7 @@ const response = await player.search({
236
304
  ```
237
305
 
238
306
 
239
- ***
307
+ ***
240
308
 
241
309
 
242
310
  # UpdateLog
@@ -254,8 +322,8 @@ const response = await player.search({
254
322
  - `player.deleteSponsorBlock()` / `node.deleteSponsorBlock()`
255
323
  - That Plugin adds following **Events** to the **Manager**: `"SegmentsLoaded"`, `"SegmentSkipped"`, `"ChapterStarted"`, `"ChaptersLoaded"`
256
324
  - Example Bot show example in autoplayFunction how to "disable" / "enable" Autoplay with bot data variables.
257
- - Added `ManagerOptions#emitNewSongsOnly`. If set to true, it won't emit "trackStart" Event, when track.loop is active, or the new current track == the previous (current) track.
258
- - Added `ManagerOptions#linksBlacklist` which allows user to specify an array of regExp / strings to match query strings (for links / words) and if a match happens it doesn't allow the request (blacklist)
325
+ - Added `ManagerOptions#emitNewSongsOnly`. If set to true, it won't emit "trackStart" Event, when track.loop is active, or the new current track == the previous (current) track.
326
+ - Added `ManagerOptions#linksBlacklist` which allows user to specify an array of regExp / strings to match query strings (for links / words) and if a match happens it doesn't allow the request (blacklist)
259
327
  - Added `ManagerOptions#linksWhitelist` which allows user to specify an array of regExp / strings to match query strings (for links only) and if a match does NOT HAPPEN it doesn't allow the request (whitelist)
260
328
  - Added `ManagerOptions#linksAllowed` if set to false, it does not allow requests which are links
261
329
  - Moved `ManaagerOptions#debugOptions` to `ManaagerOptions#advancedOptions.debugOptions`
@@ -263,10 +331,10 @@ const response = await player.search({
263
331
  ### **Version 1.2.1**
264
332
  - Adjusted `player.stopPlaying()`
265
333
  - There are now following parameters. `stopPlaying(clearQueue:boolean = true, executeAutoplay:boolean = false)`.
266
- - On Default it now clears the queue and stops playing. Also it does not execute Autoplay on default. IF you want the function to behave differently, you can use the 2 states for that.
334
+ - On Default it now clears the queue and stops playing. Also it does not execute Autoplay on default. IF you want the function to behave differently, you can use the 2 states for that.
267
335
  - Fixed that it looped the current track if repeatmode === "track" / "queue". (it stops playing and loop stays)
268
336
  - Implemented a `parseLavalinkConnUrl(connectionUrl:string)` Util Function.
269
- - It allows you to parse Lavalink Connection Data of a Lavalink Connection Url.
337
+ - It allows you to parse Lavalink Connection Data of a Lavalink Connection Url.
270
338
  Pattern: `lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>`
271
339
  - Note that the nodeId and NodeAuthorization must be encoded via encodeURIComponents before you provide it into the function.
272
340
  - The function will return the following: `{ id: string, authorization: string, host: string, port: number }`
@@ -298,10 +366,10 @@ const response = await player.search({
298
366
  # and after connecting the nodeManager.on("resumed", (node, payload, players) => {}) will be executed, where you can sync the players!
299
367
 
300
368
  # Node Options got adjusted # It's a property not a method should be treated readonly
301
- + node.resuming: { enabled: boolean, timeout: number | null };
369
+ + node.resuming: { enabled: boolean, timeout: number | null };
302
370
 
303
371
  # Player function got added to stop playing without disconnecting
304
- + player.stopPlaying(clearQueue:boolean = true, executeAutoplay:boolean = false);
372
+ + player.stopPlaying(clearQueue:boolean = true, executeAutoplay:boolean = false);
305
373
 
306
374
  # Node functions for sponsorBlock Plugin (https://github.com/topi314/Sponsorblock-Plugin) got added
307
375
  + deleteSponsorBlock(player:Player)
@@ -321,7 +389,7 @@ const response = await player.search({
321
389
  # Lavalink track.userData got added (basically same feature as my custom pluginInfo.clientData system)
322
390
  # You only get the track.userData data through playerUpdate object
323
391
  ```
324
- In one of the next updates, there will be more queueWatcher options and more custom nodeevents to trace
392
+ In one of the next updates, there will be more queueWatcher options and more custom nodeevents to trace
325
393
 
326
394
  Most features of this update got tested, but if you encounter any bugs feel free to open an issue!
327
395
 
@@ -378,9 +446,61 @@ const extraParams = new URLSearchParams();
378
446
  if(voice) extraParams.append(`voice`, voice);
379
447
 
380
448
  // all params for flowertts can be found here: https://flowery.pw/docs
381
- const response = await player.search({
449
+ const response = await player.search({
382
450
  query: `${query}`,
383
451
  extraQueryUrlParams: extraParams, // as of my knowledge this is currently only used for flowertts, adjusting the playback url dynamically mid-request
384
452
  source: "ftts"
385
453
  }, interaction.user);
386
454
  ```
455
+
456
+
457
+ ## **Version 2.2.2**
458
+ - Fixed a bug in player.pause() where when you pause the track longer than the left over currentTrack.info.duration is, then it would auto skip the track on resume.
459
+ - Fixed the handling of the previous track array ( sometimes it adds "null", due to lavalink errors )
460
+ - Added new functions for the queue, to make migrations and coding easier for beginners,
461
+ - ` const previousTrack = await player.queue.shiftPrevious() ` -> removes the previously played track from the player.queue.previous array, and returns it, so you can use it for something like "play previous"
462
+ - *Neat 1-liner: ` await player.queue.shiftPrevious().then(clientTrack => player.play({ clientTrack })) `*
463
+ - ` await player.queue.remove(removeQuery) ` -> Remove function to remove stuff from the queue.tracks array., following params are valid:
464
+ - Array of Tracks / UnresolvedTracks, e.g. ` await player.queue.remove( player.queue.tracks.slice(4, 10) ) ` *(would remove tracks from #4 (incl.) to #10 (excl.) aka those indexes: 4, 5, 6, 7, 8, 9 - this is how array.slice works)*
465
+ - Single Track / UnresolveTrack, e.g. ` await player.queue.remove(player.queue.tracks[player.queue.tracks.length - 1]); ` *(would remove the last track)*
466
+ - Array of track-indexes, e.g. ` await player.queue.remove([1, 4, 5]) ` *(Would remove track #1, #4 and #5)*
467
+ - Single track index, e.g. ` await player.queue.remove(5) ` *(would remove the #5 track from the queue)*
468
+ - **NOTE:** I still highly recommend, to use the ` player.queue.splice() ` function for mutating the queue:
469
+ - it is possible to remove single tracks, multiple tracks and insert tracks at specific positions!
470
+ - *the remove function haven't been fully tested yet*
471
+ - Added `track.pluginInfo.clientData?.previousTrack` handling:
472
+ - If a track has this property in the pluginInfo in the clientData object set to "true" then it won't get added to the previous track array. Example:
473
+ ```js
474
+ const previousTrack = await player.queue.shiftPrevious();
475
+ if(previousTrack) {
476
+ const previousClientData = previousTrack.pluginInfo.clientData || {};
477
+ previousTrack.pluginInfo.clientData = { previousTrack: true, ...previousClientData }
478
+ await player.play({ clientTrack: previousTrack });
479
+ }
480
+ ```
481
+
482
+
483
+ ## **Version 2.3.0**
484
+
485
+ - Added a heartbeat + ping-pong system to check wether the client is still connected to the node, if the node doesn't receive a ping in time, it will destroy the node and thus cause a reconnect.
486
+ - For that following new nodeOptions got added:
487
+ - `enablePingOnStatsCheck: boolean` (default: true)
488
+ - `heartBeatInterval: number` (default: 30_000)
489
+ - Added new Property on a node:
490
+ - `isAlive: boolean` (if it's false, then it's not connected to the node anymore, and will AUTOMATICALLY Cause a reconnect within the heartBeatInterval)
491
+ - `heartBeatPing: number` (the ping it takes lavalink to respond to the acknowledge of heartbeat)
492
+ - Added new NodeManager Events:
493
+ - `reconnectinprogress` (when the client internal reconnect system is triggered, the actual reconnect gets triggered by the node after your retryDelay)
494
+ - Refactored internal code for better readability and maintainability
495
+ - Removed several intermediate promises
496
+ - Added new types for better type safety
497
+ - Updated types for better type safety
498
+ - Reduced default retryDelay from 30s to 10s
499
+ - Added example on the testbot how to store player data easily and how to use the resume feature, and updated the Resuming Example in the README [jump](#how-to-do-resuming) by adding a [full example](#resuming-full-example)
500
+
501
+ - **"Breaking Change" for providing track / clientTrack for player.play()**
502
+ - Instead of adding the track to the queue and skipping to it, they get directly played by lavalink through replacing the track.
503
+ - To make this work, we need to pass the transformed requester object to the userData of the track. (all handled by the client)
504
+ - *This is technically better than skipping to a track but i wanted to point it out.*
505
+ - You can play with clientTrack like this: `player.play({ clientTrack: searchResult.tracks[0] })`
506
+ - You can play with just track like this: `player.play({ track: { encoded: "base64string..." }, requester: interaction.user })`
@@ -5,5 +5,11 @@ export * from "./structures/Node";
5
5
  export * from "./structures/NodeManager";
6
6
  export * from "./structures/Player";
7
7
  export * from "./structures/Queue";
8
- export * from "./structures/Track";
9
8
  export * from "./structures/Utils";
9
+ export * from "./structures/Types/Track";
10
+ export * from "./structures/Types/Utils";
11
+ export * from "./structures/Types/Filters";
12
+ export * from "./structures/Types/Player";
13
+ export * from "./structures/Types/Queue";
14
+ export * from "./structures/Types/Node";
15
+ export * from "./structures/Constants";
package/dist/cjs/index.js CHANGED
@@ -8,5 +8,11 @@ tslib_1.__exportStar(require("./structures/Node"), exports);
8
8
  tslib_1.__exportStar(require("./structures/NodeManager"), exports);
9
9
  tslib_1.__exportStar(require("./structures/Player"), exports);
10
10
  tslib_1.__exportStar(require("./structures/Queue"), exports);
11
- tslib_1.__exportStar(require("./structures/Track"), exports);
12
11
  tslib_1.__exportStar(require("./structures/Utils"), exports);
12
+ tslib_1.__exportStar(require("./structures/Types/Track"), exports);
13
+ tslib_1.__exportStar(require("./structures/Types/Utils"), exports);
14
+ tslib_1.__exportStar(require("./structures/Types/Filters"), exports);
15
+ tslib_1.__exportStar(require("./structures/Types/Player"), exports);
16
+ tslib_1.__exportStar(require("./structures/Types/Queue"), exports);
17
+ tslib_1.__exportStar(require("./structures/Types/Node"), exports);
18
+ tslib_1.__exportStar(require("./structures/Constants"), exports);
@@ -0,0 +1,40 @@
1
+ import type { AudioOutputs, ChannelMixFilter, EQBand } from "./Types/Filters";
2
+ export declare enum DestroyReasons {
3
+ QueueEmpty = "QueueEmpty",
4
+ NodeDestroy = "NodeDestroy",
5
+ NodeDeleted = "NodeDeleted",
6
+ LavalinkNoVoice = "LavalinkNoVoice",
7
+ NodeReconnectFail = "NodeReconnectFail",
8
+ Disconnected = "Disconnected",
9
+ PlayerReconnectFail = "PlayerReconnectFail",
10
+ ChannelDeleted = "ChannelDeleted",
11
+ DisconnectAllNodes = "DisconnectAllNodes",
12
+ ReconnectAllNodes = "ReconnectAllNodes"
13
+ }
14
+ export declare const validSponsorBlocks: string[];
15
+ /** The audio Outputs Data map declaration */
16
+ export declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
17
+ export declare const EQList: {
18
+ /** A Bassboost Equalizer, so high it distorts the audio */
19
+ BassboostEarrape: EQBand[];
20
+ /** A High and decent Bassboost Equalizer */
21
+ BassboostHigh: EQBand[];
22
+ /** A decent Bassboost Equalizer */
23
+ BassboostMedium: EQBand[];
24
+ /** A slight Bassboost Equalizer */
25
+ BassboostLow: EQBand[];
26
+ /** Makes the Music slightly "better" */
27
+ BetterMusic: EQBand[];
28
+ /** Makes the Music sound like rock music / sound rock music better */
29
+ Rock: EQBand[];
30
+ /** Makes the Music sound like Classic music / sound Classic music better */
31
+ Classic: EQBand[];
32
+ /** Makes the Music sound like Pop music / sound Pop music better */
33
+ Pop: EQBand[];
34
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
35
+ Electronic: EQBand[];
36
+ /** Boosts all Bands slightly for louder and fuller sound */
37
+ FullSound: EQBand[];
38
+ /** Boosts basses + lower highs for a pro gaming sound */
39
+ Gaming: EQBand[];
40
+ };
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EQList = exports.audioOutputsData = exports.validSponsorBlocks = exports.DestroyReasons = void 0;
4
+ var DestroyReasons;
5
+ (function (DestroyReasons) {
6
+ DestroyReasons["QueueEmpty"] = "QueueEmpty";
7
+ DestroyReasons["NodeDestroy"] = "NodeDestroy";
8
+ DestroyReasons["NodeDeleted"] = "NodeDeleted";
9
+ DestroyReasons["LavalinkNoVoice"] = "LavalinkNoVoice";
10
+ DestroyReasons["NodeReconnectFail"] = "NodeReconnectFail";
11
+ DestroyReasons["Disconnected"] = "Disconnected";
12
+ DestroyReasons["PlayerReconnectFail"] = "PlayerReconnectFail";
13
+ DestroyReasons["ChannelDeleted"] = "ChannelDeleted";
14
+ DestroyReasons["DisconnectAllNodes"] = "DisconnectAllNodes";
15
+ DestroyReasons["ReconnectAllNodes"] = "ReconnectAllNodes";
16
+ })(DestroyReasons || (exports.DestroyReasons = DestroyReasons = {}));
17
+ ;
18
+ exports.validSponsorBlocks = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "filler"];
19
+ /** The audio Outputs Data map declaration */
20
+ exports.audioOutputsData = {
21
+ mono: {
22
+ leftToLeft: 0.5,
23
+ leftToRight: 0.5,
24
+ rightToLeft: 0.5,
25
+ rightToRight: 0.5,
26
+ },
27
+ stereo: {
28
+ leftToLeft: 1,
29
+ leftToRight: 0,
30
+ rightToLeft: 0,
31
+ rightToRight: 1,
32
+ },
33
+ left: {
34
+ leftToLeft: 1,
35
+ leftToRight: 0,
36
+ rightToLeft: 1,
37
+ rightToRight: 0,
38
+ },
39
+ right: {
40
+ leftToLeft: 0,
41
+ leftToRight: 1,
42
+ rightToLeft: 0,
43
+ rightToRight: 1,
44
+ },
45
+ };
46
+ exports.EQList = {
47
+ /** A Bassboost Equalizer, so high it distorts the audio */
48
+ BassboostEarrape: [
49
+ { band: 0, gain: 0.6 * 0.375 },
50
+ { band: 1, gain: 0.67 * 0.375 },
51
+ { band: 2, gain: 0.67 * 0.375 },
52
+ { band: 3, gain: 0.4 * 0.375 },
53
+ { band: 4, gain: -0.5 * 0.375 },
54
+ { band: 5, gain: 0.15 * 0.375 },
55
+ { band: 6, gain: -0.45 * 0.375 },
56
+ { band: 7, gain: 0.23 * 0.375 },
57
+ { band: 8, gain: 0.35 * 0.375 },
58
+ { band: 9, gain: 0.45 * 0.375 },
59
+ { band: 10, gain: 0.55 * 0.375 },
60
+ { band: 11, gain: -0.6 * 0.375 },
61
+ { band: 12, gain: 0.55 * 0.375 },
62
+ { band: 13, gain: -0.5 * 0.375 },
63
+ { band: 14, gain: -0.75 * 0.375 },
64
+ ],
65
+ /** A High and decent Bassboost Equalizer */
66
+ BassboostHigh: [
67
+ { band: 0, gain: 0.6 * 0.25 },
68
+ { band: 1, gain: 0.67 * 0.25 },
69
+ { band: 2, gain: 0.67 * 0.25 },
70
+ { band: 3, gain: 0.4 * 0.25 },
71
+ { band: 4, gain: -0.5 * 0.25 },
72
+ { band: 5, gain: 0.15 * 0.25 },
73
+ { band: 6, gain: -0.45 * 0.25 },
74
+ { band: 7, gain: 0.23 * 0.25 },
75
+ { band: 8, gain: 0.35 * 0.25 },
76
+ { band: 9, gain: 0.45 * 0.25 },
77
+ { band: 10, gain: 0.55 * 0.25 },
78
+ { band: 11, gain: -0.6 * 0.25 },
79
+ { band: 12, gain: 0.55 * 0.25 },
80
+ { band: 13, gain: -0.5 * 0.25 },
81
+ { band: 14, gain: -0.75 * 0.25 },
82
+ ],
83
+ /** A decent Bassboost Equalizer */
84
+ BassboostMedium: [
85
+ { band: 0, gain: 0.6 * 0.1875 },
86
+ { band: 1, gain: 0.67 * 0.1875 },
87
+ { band: 2, gain: 0.67 * 0.1875 },
88
+ { band: 3, gain: 0.4 * 0.1875 },
89
+ { band: 4, gain: -0.5 * 0.1875 },
90
+ { band: 5, gain: 0.15 * 0.1875 },
91
+ { band: 6, gain: -0.45 * 0.1875 },
92
+ { band: 7, gain: 0.23 * 0.1875 },
93
+ { band: 8, gain: 0.35 * 0.1875 },
94
+ { band: 9, gain: 0.45 * 0.1875 },
95
+ { band: 10, gain: 0.55 * 0.1875 },
96
+ { band: 11, gain: -0.6 * 0.1875 },
97
+ { band: 12, gain: 0.55 * 0.1875 },
98
+ { band: 13, gain: -0.5 * 0.1875 },
99
+ { band: 14, gain: -0.75 * 0.1875 },
100
+ ],
101
+ /** A slight Bassboost Equalizer */
102
+ BassboostLow: [
103
+ { band: 0, gain: 0.6 * 0.125 },
104
+ { band: 1, gain: 0.67 * 0.125 },
105
+ { band: 2, gain: 0.67 * 0.125 },
106
+ { band: 3, gain: 0.4 * 0.125 },
107
+ { band: 4, gain: -0.5 * 0.125 },
108
+ { band: 5, gain: 0.15 * 0.125 },
109
+ { band: 6, gain: -0.45 * 0.125 },
110
+ { band: 7, gain: 0.23 * 0.125 },
111
+ { band: 8, gain: 0.35 * 0.125 },
112
+ { band: 9, gain: 0.45 * 0.125 },
113
+ { band: 10, gain: 0.55 * 0.125 },
114
+ { band: 11, gain: -0.6 * 0.125 },
115
+ { band: 12, gain: 0.55 * 0.125 },
116
+ { band: 13, gain: -0.5 * 0.125 },
117
+ { band: 14, gain: -0.75 * 0.125 },
118
+ ],
119
+ /** Makes the Music slightly "better" */
120
+ BetterMusic: [
121
+ { band: 0, gain: 0.25 },
122
+ { band: 1, gain: 0.025 },
123
+ { band: 2, gain: 0.0125 },
124
+ { band: 3, gain: 0 },
125
+ { band: 4, gain: 0 },
126
+ { band: 5, gain: -0.0125 },
127
+ { band: 6, gain: -0.025 },
128
+ { band: 7, gain: -0.0175 },
129
+ { band: 8, gain: 0 },
130
+ { band: 9, gain: 0 },
131
+ { band: 10, gain: 0.0125 },
132
+ { band: 11, gain: 0.025 },
133
+ { band: 12, gain: 0.25 },
134
+ { band: 13, gain: 0.125 },
135
+ { band: 14, gain: 0.125 },
136
+ ],
137
+ /** Makes the Music sound like rock music / sound rock music better */
138
+ Rock: [
139
+ { band: 0, gain: 0.300 },
140
+ { band: 1, gain: 0.250 },
141
+ { band: 2, gain: 0.200 },
142
+ { band: 3, gain: 0.100 },
143
+ { band: 4, gain: 0.050 },
144
+ { band: 5, gain: -0.050 },
145
+ { band: 6, gain: -0.150 },
146
+ { band: 7, gain: -0.200 },
147
+ { band: 8, gain: -0.100 },
148
+ { band: 9, gain: -0.050 },
149
+ { band: 10, gain: 0.050 },
150
+ { band: 11, gain: 0.100 },
151
+ { band: 12, gain: 0.200 },
152
+ { band: 13, gain: 0.250 },
153
+ { band: 14, gain: 0.300 },
154
+ ],
155
+ /** Makes the Music sound like Classic music / sound Classic music better */
156
+ Classic: [
157
+ { band: 0, gain: 0.375 },
158
+ { band: 1, gain: 0.350 },
159
+ { band: 2, gain: 0.125 },
160
+ { band: 3, gain: 0 },
161
+ { band: 4, gain: 0 },
162
+ { band: 5, gain: 0.125 },
163
+ { band: 6, gain: 0.550 },
164
+ { band: 7, gain: 0.050 },
165
+ { band: 8, gain: 0.125 },
166
+ { band: 9, gain: 0.250 },
167
+ { band: 10, gain: 0.200 },
168
+ { band: 11, gain: 0.250 },
169
+ { band: 12, gain: 0.300 },
170
+ { band: 13, gain: 0.250 },
171
+ { band: 14, gain: 0.300 },
172
+ ],
173
+ /** Makes the Music sound like Pop music / sound Pop music better */
174
+ Pop: [
175
+ { band: 0, gain: 0.2635 },
176
+ { band: 1, gain: 0.22141 },
177
+ { band: 2, gain: -0.21141 },
178
+ { band: 3, gain: -0.1851 },
179
+ { band: 4, gain: -0.155 },
180
+ { band: 5, gain: 0.21141 },
181
+ { band: 6, gain: 0.22456 },
182
+ { band: 7, gain: 0.237 },
183
+ { band: 8, gain: 0.237 },
184
+ { band: 9, gain: 0.237 },
185
+ { band: 10, gain: -0.05 },
186
+ { band: 11, gain: -0.116 },
187
+ { band: 12, gain: 0.192 },
188
+ { band: 13, gain: 0 },
189
+ ],
190
+ /** Makes the Music sound like Electronic music / sound Electronic music better */
191
+ Electronic: [
192
+ { band: 0, gain: 0.375 },
193
+ { band: 1, gain: 0.350 },
194
+ { band: 2, gain: 0.125 },
195
+ { band: 3, gain: 0 },
196
+ { band: 4, gain: 0 },
197
+ { band: 5, gain: -0.125 },
198
+ { band: 6, gain: -0.125 },
199
+ { band: 7, gain: 0 },
200
+ { band: 8, gain: 0.25 },
201
+ { band: 9, gain: 0.125 },
202
+ { band: 10, gain: 0.15 },
203
+ { band: 11, gain: 0.2 },
204
+ { band: 12, gain: 0.250 },
205
+ { band: 13, gain: 0.350 },
206
+ { band: 14, gain: 0.400 },
207
+ ],
208
+ /** Boosts all Bands slightly for louder and fuller sound */
209
+ FullSound: [
210
+ { band: 0, gain: 0.25 + 0.375 },
211
+ { band: 1, gain: 0.25 + 0.025 },
212
+ { band: 2, gain: 0.25 + 0.0125 },
213
+ { band: 3, gain: 0.25 + 0 },
214
+ { band: 4, gain: 0.25 + 0 },
215
+ { band: 5, gain: 0.25 + -0.0125 },
216
+ { band: 6, gain: 0.25 + -0.025 },
217
+ { band: 7, gain: 0.25 + -0.0175 },
218
+ { band: 8, gain: 0.25 + 0 },
219
+ { band: 9, gain: 0.25 + 0 },
220
+ { band: 10, gain: 0.25 + 0.0125 },
221
+ { band: 11, gain: 0.25 + 0.025 },
222
+ { band: 12, gain: 0.25 + 0.375 },
223
+ { band: 13, gain: 0.25 + 0.125 },
224
+ { band: 14, gain: 0.25 + 0.125 },
225
+ ],
226
+ /** Boosts basses + lower highs for a pro gaming sound */
227
+ Gaming: [
228
+ { band: 0, gain: 0.350 },
229
+ { band: 1, gain: 0.300 },
230
+ { band: 2, gain: 0.250 },
231
+ { band: 3, gain: 0.200 },
232
+ { band: 4, gain: 0.150 },
233
+ { band: 5, gain: 0.100 },
234
+ { band: 6, gain: 0.050 },
235
+ { band: 7, gain: -0.0 },
236
+ { band: 8, gain: -0.050 },
237
+ { band: 9, gain: -0.100 },
238
+ { band: 10, gain: -0.150 },
239
+ { band: 11, gain: -0.200 },
240
+ { band: 12, gain: -0.250 },
241
+ { band: 13, gain: -0.300 },
242
+ { band: 14, gain: -0.350 },
243
+ ],
244
+ };
@@ -1,3 +1,3 @@
1
- import { Player } from "../Player";
2
- import { UnresolvedSearchResult } from "../Utils";
1
+ import type { Player } from "../Player";
2
+ import type { UnresolvedSearchResult } from "../Types/Utils";
3
3
  export declare const bandCampSearch: (player: Player, query: string, requestUser: unknown) => Promise<UnresolvedSearchResult>;