lavalink-client 2.2.2 → 2.3.1

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 (111) hide show
  1. package/README.md +95 -1
  2. package/dist/cjs/index.d.ts +8 -1
  3. package/dist/cjs/index.js +8 -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 +8 -232
  9. package/dist/cjs/structures/LavalinkManager.d.ts +31 -166
  10. package/dist/cjs/structures/LavalinkManager.js +59 -7
  11. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
  12. package/dist/cjs/structures/Node.d.ts +15 -156
  13. package/dist/cjs/structures/Node.js +131 -49
  14. package/dist/cjs/structures/NodeManager.d.ts +54 -52
  15. package/dist/cjs/structures/NodeManager.js +74 -4
  16. package/dist/cjs/structures/Player.d.ts +31 -124
  17. package/dist/cjs/structures/Player.js +77 -43
  18. package/dist/cjs/structures/Queue.d.ts +66 -42
  19. package/dist/cjs/structures/Queue.js +69 -11
  20. package/dist/cjs/structures/Types/Filters.d.ts +190 -0
  21. package/dist/cjs/structures/Types/Manager.d.ts +184 -0
  22. package/dist/cjs/structures/Types/Manager.js +2 -0
  23. package/dist/cjs/structures/Types/Node.d.ts +216 -0
  24. package/dist/cjs/structures/Types/Node.js +2 -0
  25. package/dist/cjs/structures/Types/Player.d.ts +108 -0
  26. package/dist/cjs/structures/Types/Player.js +2 -0
  27. package/dist/cjs/structures/Types/Queue.d.ts +34 -0
  28. package/dist/cjs/structures/Types/Queue.js +2 -0
  29. package/dist/cjs/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
  30. package/dist/{structures → cjs/structures/Types}/Track.js +2 -2
  31. package/dist/cjs/structures/Types/Utils.d.ts +367 -0
  32. package/dist/cjs/structures/Types/Utils.js +2 -0
  33. package/dist/cjs/structures/Utils.d.ts +13 -369
  34. package/dist/cjs/structures/Utils.js +35 -14
  35. package/dist/esm/index.d.ts +8 -1
  36. package/dist/esm/index.js +8 -1
  37. package/dist/esm/structures/Constants.d.ts +40 -0
  38. package/dist/esm/structures/Constants.js +241 -0
  39. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  40. package/dist/esm/structures/Filters.d.ts +2 -217
  41. package/dist/esm/structures/Filters.js +3 -227
  42. package/dist/esm/structures/LavalinkManager.d.ts +31 -166
  43. package/dist/esm/structures/LavalinkManager.js +57 -5
  44. package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
  45. package/dist/esm/structures/Node.d.ts +15 -156
  46. package/dist/esm/structures/Node.js +122 -40
  47. package/dist/esm/structures/NodeManager.d.ts +54 -52
  48. package/dist/esm/structures/NodeManager.js +71 -1
  49. package/dist/esm/structures/Player.d.ts +31 -124
  50. package/dist/esm/structures/Player.js +76 -42
  51. package/dist/esm/structures/Queue.d.ts +66 -42
  52. package/dist/esm/structures/Queue.js +69 -11
  53. package/dist/esm/structures/Types/Filters.d.ts +190 -0
  54. package/dist/esm/structures/Types/Manager.d.ts +184 -0
  55. package/dist/esm/structures/Types/Manager.js +1 -0
  56. package/dist/esm/structures/Types/Node.d.ts +216 -0
  57. package/dist/esm/structures/Types/Node.js +1 -0
  58. package/dist/esm/structures/Types/Player.d.ts +108 -0
  59. package/dist/esm/structures/Types/Player.js +1 -0
  60. package/dist/esm/structures/Types/Queue.d.ts +34 -0
  61. package/dist/esm/structures/Types/Queue.js +1 -0
  62. package/dist/esm/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
  63. package/dist/esm/structures/Types/Track.js +1 -0
  64. package/dist/esm/structures/Types/Utils.d.ts +367 -0
  65. package/dist/esm/structures/Types/Utils.js +1 -0
  66. package/dist/esm/structures/Utils.d.ts +13 -369
  67. package/dist/esm/structures/Utils.js +35 -14
  68. package/dist/types/index.d.ts +8 -1
  69. package/dist/types/structures/Constants.d.ts +40 -0
  70. package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +2 -2
  71. package/dist/types/structures/Filters.d.ts +2 -217
  72. package/dist/types/structures/LavalinkManager.d.ts +31 -166
  73. package/dist/types/structures/LavalinkManagerStatics.d.ts +1 -1
  74. package/dist/types/structures/Node.d.ts +15 -156
  75. package/dist/types/structures/NodeManager.d.ts +54 -52
  76. package/dist/types/structures/Player.d.ts +31 -124
  77. package/dist/types/structures/Queue.d.ts +66 -42
  78. package/dist/types/structures/Types/Filters.d.ts +190 -0
  79. package/dist/types/structures/Types/Manager.d.ts +184 -0
  80. package/dist/types/structures/Types/Node.d.ts +216 -0
  81. package/dist/types/structures/Types/Player.d.ts +108 -0
  82. package/dist/types/structures/Types/Queue.d.ts +34 -0
  83. package/dist/types/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
  84. package/dist/types/structures/Types/Utils.d.ts +367 -0
  85. package/dist/types/structures/Utils.d.ts +13 -369
  86. package/package.json +1 -1
  87. package/dist/index.d.ts +0 -10
  88. package/dist/index.js +0 -13
  89. package/dist/structures/Filters.d.ts +0 -230
  90. package/dist/structures/Filters.js +0 -472
  91. package/dist/structures/LavalinkManager.d.ts +0 -47
  92. package/dist/structures/LavalinkManager.js +0 -36
  93. package/dist/structures/LavalinkManagerStatics.d.ts +0 -3
  94. package/dist/structures/LavalinkManagerStatics.js +0 -76
  95. package/dist/structures/Node.d.ts +0 -171
  96. package/dist/structures/Node.js +0 -462
  97. package/dist/structures/NodeManager.d.ts +0 -58
  98. package/dist/structures/NodeManager.js +0 -25
  99. package/dist/structures/Player.d.ts +0 -101
  100. package/dist/structures/Player.js +0 -232
  101. package/dist/structures/PlayerManager.d.ts +0 -62
  102. package/dist/structures/PlayerManager.js +0 -26
  103. package/dist/structures/Queue.d.ts +0 -93
  104. package/dist/structures/Queue.js +0 -160
  105. package/dist/structures/QueueManager.d.ts +0 -77
  106. package/dist/structures/QueueManager.js +0 -74
  107. package/dist/structures/Track.d.ts +0 -27
  108. package/dist/structures/Utils.d.ts +0 -183
  109. package/dist/structures/Utils.js +0 -43
  110. /package/dist/cjs/structures/{Track.js → Types/Filters.js} +0 -0
  111. /package/dist/esm/structures/{Track.js → Types/Filters.js} +0 -0
@@ -1,58 +1,13 @@
1
- import { LavalinkFilterData } from "./Filters";
2
- import { LavalinkManager } from "./LavalinkManager";
3
- import { LavalinkNode, LavalinkNodeOptions, NodeStats } from "./Node";
4
- import { LavalinkPlayOptions, Player } from "./Player";
5
- import { LavalinkTrack, PluginInfo, Track, UnresolvedQuery, UnresolvedTrack } from "./Track";
1
+ import type { LavalinkNodeOptions } from "./Types/Node";
2
+ import type { LavalinkSearchPlatform, LavaSearchQuery, MiniMapConstructor, SearchPlatform, SearchQuery } from "./Types/Utils";
3
+ import type { LavalinkManager } from "./LavalinkManager";
4
+ import type { LavalinkNode } from "./Node";
5
+ import type { Player } from "./Player";
6
+ import type { LavalinkTrack, Track, UnresolvedQuery, UnresolvedTrack } from "./Types/Track";
6
7
  export declare const TrackSymbol: unique symbol;
7
8
  export declare const UnresolvedTrackSymbol: unique symbol;
8
9
  export declare const QueueSymbol: unique symbol;
9
10
  export declare const NodeSymbol: unique symbol;
10
- type Opaque<T, K> = T & {
11
- __opaque__: K;
12
- };
13
- export type IntegerNumber = Opaque<number, 'Int'>;
14
- export type FloatNumber = Opaque<number, 'Float'>;
15
- export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "ymsearch";
16
- export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
17
- export type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
18
- export type LavalinkClientSearchPlatform = "bcsearch";
19
- export type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
20
- export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | LavalinkClientSearchPlatform;
21
- export type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
22
- export type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
23
- "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
24
- export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
25
- export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "appleMusic" | "TwitchTv" | "vimeo";
26
- export interface PlaylistInfo {
27
- /** The playlist name */
28
- name: string;
29
- /** The playlist title (same as name) */
30
- title: string;
31
- /** The playlist Author */
32
- author?: string;
33
- /** The playlist Thumbnail */
34
- thumbnail?: string;
35
- /** A Uri to the playlist */
36
- uri?: string;
37
- /** The playlist selected track. */
38
- selectedTrack: Track | null;
39
- /** The duration of the entire playlist. (calcualted) */
40
- duration: number;
41
- }
42
- export interface SearchResult {
43
- loadType: LoadTypes;
44
- exception: Exception | null;
45
- pluginInfo: PluginInfo;
46
- playlist: PlaylistInfo | null;
47
- tracks: Track[];
48
- }
49
- export interface UnresolvedSearchResult {
50
- loadType: LoadTypes;
51
- exception: Exception | null;
52
- pluginInfo: PluginInfo;
53
- playlist: PlaylistInfo | null;
54
- tracks: UnresolvedTrack[];
55
- }
56
11
  /**
57
12
  * Parses Node Connection Url: "lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>"
58
13
  * @param connectionUrl
@@ -80,27 +35,28 @@ export declare class ManagerUtils {
80
35
  * @param data
81
36
  */
82
37
  isNode(data: LavalinkNode): boolean;
38
+ getTransformedRequester(requester: unknown): unknown;
83
39
  /**
84
40
  * Validate if a data is equal to node options
85
41
  * @param data
86
42
  */
87
- isNodeOptions(data: LavalinkNodeOptions | any): boolean;
43
+ isNodeOptions(data: LavalinkNodeOptions): boolean;
88
44
  /**
89
- * Validate if a data is euqal to a track
45
+ * Validate if a data is equal to a track
90
46
  * @param data the Track to validate
91
47
  * @returns
92
48
  */
93
- isTrack(data: Track | any): boolean;
49
+ isTrack(data: Track | UnresolvedTrack): data is Track;
94
50
  /**
95
51
  * Checks if the provided argument is a valid UnresolvedTrack.
96
52
  * @param track
97
53
  */
98
- isUnresolvedTrack(data: UnresolvedTrack | any): boolean;
54
+ isUnresolvedTrack(data: UnresolvedTrack | Track): data is UnresolvedTrack;
99
55
  /**
100
56
  * Checks if the provided argument is a valid UnresolvedTrack.
101
57
  * @param track
102
58
  */
103
- isUnresolvedTrackQuery(data: UnresolvedQuery | any): boolean;
59
+ isUnresolvedTrackQuery(data: UnresolvedQuery): boolean;
104
60
  getClosestTrack(data: UnresolvedTrack, player: Player): Promise<Track | undefined>;
105
61
  validateQueryString(node: LavalinkNode, queryString: string, sourceString?: LavalinkSearchPlatform): void;
106
62
  transformQuery(query: SearchQuery): {
@@ -115,16 +71,6 @@ export declare class ManagerUtils {
115
71
  };
116
72
  validateSourceString(node: LavalinkNode, sourceString: SearchPlatform): void;
117
73
  }
118
- /**
119
- * @internal
120
- */
121
- export interface MiniMapConstructor {
122
- new (): MiniMap<unknown, unknown>;
123
- new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): MiniMap<K, V>;
124
- new <K, V>(iterable: Iterable<readonly [K, V]>): MiniMap<K, V>;
125
- readonly prototype: MiniMap<unknown, unknown>;
126
- readonly [Symbol.species]: MiniMapConstructor;
127
- }
128
74
  /**
129
75
  * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself
130
76
  *
@@ -134,7 +80,7 @@ export interface MiniMap<K, V> extends Map<K, V> {
134
80
  constructor: MiniMapConstructor;
135
81
  }
136
82
  export declare class MiniMap<K, V> extends Map<K, V> {
137
- constructor(data?: any[]);
83
+ constructor(data?: [K, V][]);
138
84
  /**
139
85
  * Identical to
140
86
  * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
@@ -166,306 +112,4 @@ export declare class MiniMap<K, V> extends Map<K, V> {
166
112
  map<T>(fn: (value: V, key: K, miniMap: this) => T): T[];
167
113
  map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[];
168
114
  }
169
- export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents;
170
- export type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
171
- export interface Exception {
172
- /** Severity of the error */
173
- severity: Severity;
174
- /** Nodejs Error */
175
- error?: Error;
176
- /** Message by lavalink */
177
- message: string;
178
- /** Cause by lavalink */
179
- cause: string;
180
- }
181
- export interface PlayerEvent {
182
- op: "event";
183
- type: PlayerEventType;
184
- guildId: string;
185
- }
186
- export interface TrackStartEvent extends PlayerEvent {
187
- type: "TrackStartEvent";
188
- track: string;
189
- }
190
- export interface TrackEndEvent extends PlayerEvent {
191
- type: "TrackEndEvent";
192
- track: string;
193
- reason: TrackEndReason;
194
- }
195
- export interface TrackExceptionEvent extends PlayerEvent {
196
- type: "TrackExceptionEvent";
197
- exception?: Exception;
198
- error: string;
199
- }
200
- export interface TrackStuckEvent extends PlayerEvent {
201
- type: "TrackStuckEvent";
202
- thresholdMs: number;
203
- }
204
- export interface WebSocketClosedEvent extends PlayerEvent {
205
- type: "WebSocketClosedEvent";
206
- code: number;
207
- byRemote: boolean;
208
- reason: string;
209
- }
210
- /**
211
- * Types & Events for Sponsorblock-plugin from Lavalink: https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
212
- */
213
- export type SponsorBlockSegmentEvents = SponsorBlockSegmentSkipped | SponsorBlockSegmentsLoaded | SponsorBlockChapterStarted | SponsorBlockChaptersLoaded;
214
- export type SponsorBlockSegmentEventType = "SegmentSkipped" | "SegmentsLoaded" | "ChaptersLoaded" | "ChapterStarted";
215
- export interface SponsorBlockSegmentsLoaded extends PlayerEvent {
216
- type: "SegmentsLoaded";
217
- segments: {
218
- category: string;
219
- start: number;
220
- end: number;
221
- }[];
222
- }
223
- export interface SponsorBlockSegmentSkipped extends PlayerEvent {
224
- type: "SegmentSkipped";
225
- segment: {
226
- category: string;
227
- start: number;
228
- end: number;
229
- };
230
- }
231
- export interface SponsorBlockChapterStarted extends PlayerEvent {
232
- type: "ChapterStarted";
233
- /** The Chapter which started */
234
- chapter: {
235
- /** The Name of the Chapter */
236
- name: string;
237
- start: number;
238
- end: number;
239
- duration: number;
240
- };
241
- }
242
- export interface SponsorBlockChaptersLoaded extends PlayerEvent {
243
- type: "ChaptersLoaded";
244
- /** All Chapters loaded */
245
- chapters: {
246
- /** The Name of the Chapter */
247
- name: string;
248
- start: number;
249
- end: number;
250
- duration: number;
251
- }[];
252
- }
253
- export type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
254
- export type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
255
- export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType;
256
- export type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
257
- export interface InvalidLavalinkRestRequest {
258
- /** Rest Request Data for when it was made */
259
- timestamp: number;
260
- /** Status of the request */
261
- status: number;
262
- /** Specific Errro which was sent */
263
- error: string;
264
- /** Specific Message which was created */
265
- message?: string;
266
- /** The specific error trace from the request */
267
- trace?: unknown;
268
- /** Path of where it's from */
269
- path: string;
270
- }
271
- export interface LavalinkPlayerVoice {
272
- /** The Voice Token */
273
- token: string;
274
- /** The Voice Server Endpoint */
275
- endpoint: string;
276
- /** The Voice SessionId */
277
- sessionId: string;
278
- /** Wether or not the player is connected */
279
- connected?: boolean;
280
- /** The Ping to the voice server */
281
- ping?: number;
282
- }
283
- export interface LavalinkPlayerVoiceOptions extends Omit<LavalinkPlayerVoice, 'connected' | 'ping'> {
284
- }
285
- export interface FailingAddress {
286
- /** The failing address */
287
- failingAddress: string;
288
- /** The timestamp when the address failed */
289
- failingTimestamp: number;
290
- /** The timestamp when the address failed as a pretty string */
291
- failingTime: string;
292
- }
293
- type RoutePlannerTypes = "RotatingIpRoutePlanner" | "NanoIpRoutePlanner" | "RotatingNanoIpRoutePlanner" | "BalancingIpRoutePlanner";
294
- export interface RoutePlanner {
295
- class?: RoutePlannerTypes;
296
- details?: {
297
- /** The ip block being used */
298
- ipBlock: {
299
- /** The type of the ip block */
300
- type: "Inet4Address" | "Inet6Address";
301
- /** The size of the ip block */
302
- size: string;
303
- };
304
- /** The failing addresses */
305
- failingAddresses: FailingAddress[];
306
- /** The number of rotations */
307
- rotateIndex?: string;
308
- /** The current offset in the block */
309
- ipIndex?: string;
310
- /** The current address being used */
311
- currentAddress?: string;
312
- /** The current offset in the ip block */
313
- currentAddressIndex?: string;
314
- /** The information in which /64 block ips are chosen. This number increases on each ban. */
315
- blockIndex?: string;
316
- };
317
- }
318
- export interface Session {
319
- /** Wether or not session is resuming or not */
320
- resuming: boolean;
321
- /** For how long a session is lasting while not connected */
322
- timeout: number;
323
- }
324
- export interface GuildShardPayload {
325
- /** The OP code */
326
- op: number;
327
- /** Data to send */
328
- d: {
329
- /** Guild id to apply voice settings */
330
- guild_id: string;
331
- /** channel to move/connect to, or null to leave it */
332
- channel_id: string | null;
333
- /** wether or not mute yourself */
334
- self_mute: boolean;
335
- /** wether or not deafen yourself */
336
- self_deaf: boolean;
337
- };
338
- }
339
- export interface PlayerUpdateInfo {
340
- /** guild id of the player */
341
- guildId: string;
342
- /** Player options to provide to lavalink */
343
- playerOptions: LavalinkPlayOptions;
344
- /** Whether or not replace the current track with the new one (true is recommended) */
345
- noReplace?: boolean;
346
- }
347
- export interface LavalinkPlayer {
348
- /** Guild Id of the player */
349
- guildId: string;
350
- /** IF playing a track, all of the track information */
351
- track?: LavalinkTrack;
352
- /** Lavalink volume (mind volumedecrementer) */
353
- volume: number;
354
- /** Wether it's paused or not */
355
- paused: boolean;
356
- /** Voice Endpoint data */
357
- voice: LavalinkPlayerVoice;
358
- /** All Audio Filters */
359
- filters: Partial<LavalinkFilterData>;
360
- /** Lavalink-Voice-State Variables */
361
- state: {
362
- /** Time since connection established */
363
- time: number;
364
- /** Position of the track */
365
- position: number;
366
- /** COnnected or not */
367
- connected: boolean;
368
- /** Ping to voice server */
369
- ping: number;
370
- };
371
- }
372
- export interface ChannelDeletePacket {
373
- /** Packet key for channel delete */
374
- t: "CHANNEL_DELETE";
375
- /** data which is sent and relevant */
376
- d: {
377
- /** guild id */
378
- guild_id: string;
379
- /** Channel id */
380
- id: string;
381
- };
382
- }
383
- export interface VoiceState {
384
- /** OP key from lavalink */
385
- op: "voiceUpdate";
386
- /** GuildId provided by lavalink */
387
- guildId: string;
388
- /** Event data */
389
- event: VoiceServer;
390
- /** Session Id of the voice connection */
391
- sessionId?: string;
392
- /** guild id of the voice channel */
393
- guild_id: string;
394
- /** user id from the voice connection */
395
- user_id: string;
396
- /** Session Id of the voice connection */
397
- session_id: string;
398
- /** Voice Channel Id */
399
- channel_id: string;
400
- }
401
- /** The Base64 decodes tring by lavalink */
402
- export type Base64 = string;
403
- export interface VoiceServer {
404
- /** Voice Token */
405
- token: string;
406
- /** Guild Id of the voice server connection */
407
- guild_id: string;
408
- /** Server Endpoint */
409
- endpoint: string;
410
- }
411
- export interface VoicePacket {
412
- /** Voice Packet Keys to send */
413
- t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
414
- /** Voice Packets to send */
415
- d: VoiceState | VoiceServer;
416
- }
417
- export interface NodeMessage extends NodeStats {
418
- /** The type of the event */
419
- type: PlayerEventType;
420
- /** what ops are applying to that event */
421
- op: "stats" | "playerUpdate" | "event";
422
- /** The specific guild id for that message */
423
- guildId: string;
424
- }
425
115
  export declare function queueTrackEnd(player: Player): Promise<Track>;
426
- /** Specific types to filter for lavasearch, will be filtered to correct types */
427
- export type LavaSearchType = "track" | "album" | "artist" | "playlist" | "text" | "tracks" | "albums" | "artists" | "playlists" | "texts";
428
- export interface LavaSearchFilteredResponse {
429
- /** The Information of a playlist provided by lavasearch */
430
- info: PlaylistInfo;
431
- /** additional plugin information */
432
- pluginInfo: PluginInfo;
433
- /** List of tracks */
434
- tracks: Track[];
435
- }
436
- export interface LavaSearchResponse {
437
- /** An array of tracks, only present if track is in types */
438
- tracks: Track[];
439
- /** An array of albums, only present if album is in types */
440
- albums: LavaSearchFilteredResponse[];
441
- /** An array of artists, only present if artist is in types */
442
- artists: LavaSearchFilteredResponse[];
443
- /** An array of playlists, only present if playlist is in types */
444
- playlists: LavaSearchFilteredResponse[];
445
- /** An array of text results, only present if text is in types */
446
- texts: {
447
- text: string;
448
- pluginInfo: PluginInfo;
449
- }[];
450
- /** Addition result data provided by plugins */
451
- pluginInfo: PluginInfo;
452
- }
453
- /** SearchQuery Object for raw lavalink requests */
454
- export type SearchQuery = {
455
- /** lavalink search Query / identifier string */
456
- query: string;
457
- /** Extra url query params to use, e.g. for flowertts */
458
- extraQueryUrlParams?: URLSearchParams;
459
- /** Source to append to the search query string */
460
- source?: SearchPlatform;
461
- } | /** Our just the search query / identifier string */ string;
462
- /** SearchQuery Object for Lavalink LavaSearch Plugin requests */
463
- export type LavaSearchQuery = {
464
- /** lavalink search Query / identifier string */
465
- query: string;
466
- /** Source to append to the search query string */
467
- source: LavaSrcSearchPlatformBase;
468
- /** The Types to filter the search to */
469
- types?: LavaSearchType[];
470
- };
471
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.2.2",
3
+ "version": "2.3.1",
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",
package/dist/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export * from "./structures/LavalinkManager";
2
- export * from "./structures/Filters";
3
- export * from "./structures/LavalinkManagerStatics";
4
- export * from "./structures/Node";
5
- export * from "./structures/NodeManager";
6
- export * from "./structures/Player";
7
- export * from "./structures/PlayerManager";
8
- export * from "./structures/Queue";
9
- export * from "./structures/Track";
10
- export * from "./structures/Utils";
package/dist/index.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./structures/LavalinkManager"), exports);
5
- tslib_1.__exportStar(require("./structures/Filters"), exports);
6
- tslib_1.__exportStar(require("./structures/LavalinkManagerStatics"), exports);
7
- tslib_1.__exportStar(require("./structures/Node"), exports);
8
- tslib_1.__exportStar(require("./structures/NodeManager"), exports);
9
- tslib_1.__exportStar(require("./structures/Player"), exports);
10
- tslib_1.__exportStar(require("./structures/PlayerManager"), exports);
11
- tslib_1.__exportStar(require("./structures/Queue"), exports);
12
- tslib_1.__exportStar(require("./structures/Track"), exports);
13
- tslib_1.__exportStar(require("./structures/Utils"), exports);
@@ -1,230 +0,0 @@
1
- import { Player } from "./Player";
2
- export type AudioOutputs = "mono" | "stereo" | "left" | "right";
3
- export interface FilterManager {
4
- player: Player;
5
- }
6
- export declare class FilterManager {
7
- equalizerBands: EQBand[];
8
- filterUpdatedState: number;
9
- filters: PlayerFilters;
10
- data: LavalinkFilterData;
11
- constructor(player: Player);
12
- applyPlayerFilters(): Promise<void>;
13
- /**
14
- * Checks if the filters are correctly stated (active / not-active)
15
- * @param oldFilterTimescale
16
- * @returns
17
- */
18
- checkFiltersState(oldFilterTimescale?: Partial<TimescaleFilter>): boolean;
19
- /**
20
- * Reset all Filters
21
- */
22
- resetFilters(): Promise<PlayerFilters>;
23
- /**
24
- * Set the AudioOutput Filter
25
- * @param type
26
- */
27
- setAudioOutput(type: AudioOutputs): Promise<AudioOutputs>;
28
- /**
29
- * Set custom filter.timescale#speed . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
30
- * @param speed
31
- * @returns
32
- */
33
- setSpeed(speed?: number): Promise<boolean>;
34
- /**
35
- * Set custom filter.timescale#pitch . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
36
- * @param speed
37
- * @returns
38
- */
39
- setPitch(pitch?: number): Promise<boolean>;
40
- /**
41
- * Set custom filter.timescale#rate . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
42
- * @param speed
43
- * @returns
44
- */
45
- setRate(rate?: number): Promise<boolean>;
46
- /**
47
- * Enabels / Disables the rotation effect, (Optional: provide your Own Data)
48
- * @param rotationHz
49
- * @returns
50
- */
51
- toggleRotation(rotationHz?: number): Promise<boolean>;
52
- /**
53
- * Enabels / Disables the Vibrato effect, (Optional: provide your Own Data)
54
- * @param frequency
55
- * @param depth
56
- * @returns
57
- */
58
- toggleVibrato(frequency?: number, depth?: number): Promise<boolean>;
59
- /**
60
- * Enabels / Disables the Tremolo effect, (Optional: provide your Own Data)
61
- * @param frequency
62
- * @param depth
63
- * @returns
64
- */
65
- toggleTremolo(frequency?: number, depth?: number): Promise<boolean>;
66
- /**
67
- * Enabels / Disables the LowPass effect, (Optional: provide your Own Data)
68
- * @param smoothing
69
- * @returns
70
- */
71
- toggleLowPass(smoothing?: number): Promise<boolean>;
72
- /**
73
- * Enabels / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
74
- * @param delay
75
- * @param decay
76
- * @returns
77
- */
78
- toggleEcho(delay?: number, decay?: number): Promise<boolean>;
79
- /**
80
- * Enabels / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
81
- * @param delay
82
- * @param decay
83
- * @returns
84
- */
85
- toggleReverb(delay?: number, decay?: number): Promise<boolean>;
86
- /**
87
- * Enables / Disabels a Nightcore-like filter Effect. Disables/Overwrides both: custom and Vaporwave Filter
88
- * @param speed
89
- * @param pitch
90
- * @param rate
91
- * @returns
92
- */
93
- toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<boolean>;
94
- /**
95
- * Enables / Disabels a Vaporwave-like filter Effect. Disables/Overwrides both: custom and nightcore Filter
96
- * @param speed
97
- * @param pitch
98
- * @param rate
99
- * @returns
100
- */
101
- toggleVaporwave(speed?: number, pitch?: number, rate?: number): Promise<boolean>;
102
- /**
103
- * Enable / Disables a Karaoke like Filter Effect
104
- * @param level
105
- * @param monoLevel
106
- * @param filterBand
107
- * @param filterWidth
108
- * @returns
109
- */
110
- toggleKaraoke(level?: number, monoLevel?: number, filterBand?: number, filterWidth?: number): Promise<boolean>;
111
- /** Function to find out if currently there is a custom timescamle etc. filter applied */
112
- isCustomFilterActive(): boolean;
113
- /**
114
- * Sets the players equalizer band on-top of the existing ones.
115
- * @param bands
116
- */
117
- setEQ(bands: EQBand | EQBand[]): Promise<this>;
118
- /** Clears the equalizer bands. */
119
- clearEQ(): Promise<this>;
120
- }
121
- export declare const validAudioOutputs: {
122
- mono: {
123
- leftToLeft: number;
124
- leftToRight: number;
125
- rightToLeft: number;
126
- rightToRight: number;
127
- };
128
- stereo: {
129
- leftToLeft: number;
130
- leftToRight: number;
131
- rightToLeft: number;
132
- rightToRight: number;
133
- };
134
- left: {
135
- leftToLeft: number;
136
- leftToRight: number;
137
- rightToLeft: number;
138
- rightToRight: number;
139
- };
140
- right: {
141
- leftToLeft: number;
142
- leftToRight: number;
143
- rightToLeft: number;
144
- rightToRight: number;
145
- };
146
- };
147
- export interface PlayerFilters {
148
- /** Sets nightcore to false, and vaporwave to false */
149
- custom: boolean;
150
- /** Sets custom to false, and vaporwave to false */
151
- nightcore: boolean;
152
- /** Sets custom to false, and nightcore to false */
153
- vaporwave: boolean;
154
- /** only with the custom lavalink filter plugin */
155
- echo: boolean;
156
- /** only with the custom lavalink filter plugin */
157
- reverb: boolean;
158
- rotation: boolean;
159
- karaoke: boolean;
160
- tremolo: boolean;
161
- vibrato: boolean;
162
- lowPass: boolean;
163
- /** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
164
- audioOutput: AudioOutputs;
165
- /** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
166
- volume: boolean;
167
- }
168
- export interface EQBand {
169
- band: number;
170
- gain: number;
171
- }
172
- export interface KaraokeFilter {
173
- level?: number;
174
- monoLevel?: number;
175
- filterBand?: number;
176
- filterWidth?: number;
177
- }
178
- export interface TimescaleFilter {
179
- speed?: number;
180
- pitch?: number;
181
- rate?: number;
182
- }
183
- export interface FreqFilter {
184
- frequency?: number;
185
- depth?: number;
186
- }
187
- export interface RotationFilter {
188
- rotationHz?: number;
189
- }
190
- export interface DistortionFilter {
191
- sinOffset?: number;
192
- sinScale?: number;
193
- cosOffset?: number;
194
- cosScale?: number;
195
- tanOffset?: number;
196
- tanScale?: number;
197
- offset?: number;
198
- scale?: number;
199
- }
200
- export interface ChannelMixFilter {
201
- leftToLeft?: number;
202
- leftToRight?: number;
203
- rightToLeft?: number;
204
- rightToRight?: number;
205
- }
206
- export interface LowPassFilter {
207
- smoothing?: number;
208
- }
209
- export interface EchoFilter {
210
- delay: number;
211
- decay: number;
212
- }
213
- export interface ReverbFilter {
214
- delay: number;
215
- decay: number;
216
- }
217
- export interface LavalinkFilterData {
218
- volume?: number;
219
- equalizer?: EQBand[];
220
- karaoke?: KaraokeFilter;
221
- timescale?: TimescaleFilter;
222
- tremolo?: FreqFilter;
223
- vibrato?: FreqFilter;
224
- rotation?: RotationFilter;
225
- distortion?: DistortionFilter;
226
- channelMix?: ChannelMixFilter;
227
- lowPass?: LowPassFilter;
228
- echo: EchoFilter;
229
- reverb: ReverbFilter;
230
- }