lavalink-client 1.2.5 → 2.0.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.
@@ -1,7 +1,7 @@
1
1
  import { LavalinkFilterData } from "./Filters";
2
2
  import { LavalinkManager } from "./LavalinkManager";
3
3
  import { LavalinkNode, LavalinkNodeOptions, NodeStats } from "./Node";
4
- import { Player, PlayOptions } from "./Player";
4
+ import { LavalinkPlayOptions, Player } from "./Player";
5
5
  import { LavalinkTrack, PluginInfo, Track, UnresolvedQuery, UnresolvedTrack } from "./Track";
6
6
  export declare const TrackSymbol: unique symbol;
7
7
  export declare const UnresolvedTrackSymbol: unique symbol;
@@ -247,17 +247,29 @@ export type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING
247
247
  export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType;
248
248
  export type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
249
249
  export interface InvalidLavalinkRestRequest {
250
+ /** Rest Request Data for when it was made */
250
251
  timestamp: number;
252
+ /** Status of the request */
251
253
  status: number;
254
+ /** Specific Errro which was sent */
252
255
  error: string;
256
+ /** Specific Message which was created */
253
257
  message?: string;
258
+ /** The specific error trace from the request */
259
+ trace?: unknown;
260
+ /** Path of where it's from */
254
261
  path: string;
255
262
  }
256
263
  export interface LavalinkPlayerVoice {
264
+ /** The Voice Token */
257
265
  token: string;
266
+ /** The Voice Server Endpoint */
258
267
  endpoint: string;
268
+ /** The Voice SessionId */
259
269
  sessionId: string;
270
+ /** Wether or not the player is connected */
260
271
  connected?: boolean;
272
+ /** The Ping to the voice server */
261
273
  ping?: number;
262
274
  }
263
275
  export interface LavalinkPlayerVoiceOptions extends Omit<LavalinkPlayerVoice, 'connected' | 'ping'> {
@@ -296,84 +308,121 @@ export interface RoutePlanner {
296
308
  };
297
309
  }
298
310
  export interface Session {
311
+ /** Wether or not session is resuming or not */
299
312
  resuming: boolean;
313
+ /** For how long a session is lasting while not connected */
300
314
  timeout: number;
301
315
  }
302
316
  export interface GuildShardPayload {
303
317
  /** The OP code */
304
318
  op: number;
319
+ /** Data to send */
305
320
  d: {
321
+ /** Guild id to apply voice settings */
306
322
  guild_id: string;
323
+ /** channel to move/connect to, or null to leave it */
307
324
  channel_id: string | null;
325
+ /** wether or not mute yourself */
308
326
  self_mute: boolean;
327
+ /** wether or not deafen yourself */
309
328
  self_deaf: boolean;
310
329
  };
311
330
  }
312
331
  export interface PlayerUpdateInfo {
332
+ /** guild id of the player */
313
333
  guildId: string;
314
- playerOptions: PlayOptions;
334
+ /** Player options to provide to lavalink */
335
+ playerOptions: LavalinkPlayOptions;
336
+ /** Whether or not replace the current track with the new one (true is recommended) */
315
337
  noReplace?: boolean;
316
338
  }
317
339
  export interface LavalinkPlayer {
340
+ /** Guild Id of the player */
318
341
  guildId: string;
319
- track?: {
320
- encoded?: string;
321
- info: {
322
- identifier: string;
323
- title: string;
324
- author: string;
325
- length: number;
326
- artworkUrl: string | null;
327
- uri: string;
328
- sourceName: string;
329
- isSeekable: boolean;
330
- isStream: boolean;
331
- isrc: string | null;
332
- position?: number;
333
- };
334
- };
342
+ /** IF playing a track, all of the track information */
343
+ track?: LavalinkTrack;
344
+ /** Lavalink volume (mind volumedecrementer) */
335
345
  volume: number;
346
+ /** Wether it's paused or not */
336
347
  paused: boolean;
348
+ /** Voice Endpoint data */
337
349
  voice: LavalinkPlayerVoice;
350
+ /** All Audio Filters */
338
351
  filters: Partial<LavalinkFilterData>;
352
+ /** Lavalink-Voice-State Variables */
353
+ state: {
354
+ /** Time since connection established */
355
+ time: number;
356
+ /** Position of the track */
357
+ position: number;
358
+ /** COnnected or not */
359
+ connected: boolean;
360
+ /** Ping to voice server */
361
+ ping: number;
362
+ };
339
363
  }
340
364
  export interface ChannelDeletePacket {
365
+ /** Packet key for channel delete */
341
366
  t: "CHANNEL_DELETE";
367
+ /** data which is sent and relevant */
342
368
  d: {
369
+ /** guild id */
343
370
  guild_id: string;
371
+ /** Channel id */
344
372
  id: string;
345
373
  };
346
374
  }
347
375
  export interface VoiceState {
376
+ /** OP key from lavalink */
348
377
  op: "voiceUpdate";
378
+ /** GuildId provided by lavalink */
349
379
  guildId: string;
380
+ /** Event data */
350
381
  event: VoiceServer;
382
+ /** Session Id of the voice connection */
351
383
  sessionId?: string;
384
+ /** guild id of the voice channel */
352
385
  guild_id: string;
386
+ /** user id from the voice connection */
353
387
  user_id: string;
388
+ /** Session Id of the voice connection */
354
389
  session_id: string;
390
+ /** Voice Channel Id */
355
391
  channel_id: string;
356
392
  }
393
+ /** The Base64 decodes tring by lavalink */
357
394
  export type Base64 = string;
358
395
  export interface VoiceServer {
396
+ /** Voice Token */
359
397
  token: string;
398
+ /** Guild Id of the voice server connection */
360
399
  guild_id: string;
400
+ /** Server Endpoint */
361
401
  endpoint: string;
362
402
  }
363
403
  export interface VoicePacket {
404
+ /** Voice Packet Keys to send */
364
405
  t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
406
+ /** Voice Packets to send */
365
407
  d: VoiceState | VoiceServer;
366
408
  }
367
409
  export interface NodeMessage extends NodeStats {
410
+ /** The type of the event */
368
411
  type: PlayerEventType;
412
+ /** what ops are applying to that event */
369
413
  op: "stats" | "playerUpdate" | "event";
414
+ /** The specific guild id for that message */
370
415
  guildId: string;
371
416
  }
372
417
  export declare function queueTrackEnd(player: Player): Promise<Track>;
418
+ /** Specific types to filter for lavasearch, will be filtered to correct types */
373
419
  export type LavaSearchType = "track" | "album" | "artist" | "playlist" | "text" | "tracks" | "albums" | "artists" | "playlists" | "texts";
374
420
  export interface LavaSearchFilteredResponse {
421
+ /** The Information of a playlist provided by lavasearch */
375
422
  info: PlaylistInfo;
423
+ /** additional plugin information */
376
424
  pluginInfo: PluginInfo;
425
+ /** List of tracks */
377
426
  tracks: Track[];
378
427
  }
379
428
  export interface LavaSearchResponse {
@@ -393,13 +442,20 @@ export interface LavaSearchResponse {
393
442
  /** Addition result data provided by plugins */
394
443
  pluginInfo: PluginInfo;
395
444
  }
445
+ /** SearchQuery Object for raw lavalink requests */
396
446
  export type SearchQuery = {
447
+ /** lavalink search Query / identifier string */
397
448
  query: string;
449
+ /** Source to append to the search query string */
398
450
  source?: SearchPlatform;
399
- } | string;
451
+ } | /** Our just the search query / identifier string */ string;
452
+ /** SearchQuery Object for Lavalink LavaSearch Plugin requests */
400
453
  export type LavaSearchQuery = {
454
+ /** lavalink search Query / identifier string */
401
455
  query: string;
456
+ /** Source to append to the search query string */
402
457
  source: LavaSrcSearchPlatformBase;
458
+ /** The Types to filter the search to */
403
459
  types?: LavaSearchType[];
404
460
  };
405
461
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "1.2.5",
3
+ "version": "2.0.0",
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",