lavalink-client 1.2.6 → 2.0.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.
@@ -1,4 +1,4 @@
1
- import { Player } from "./Player";
1
+ import { anyObject, Player } from "./Player";
2
2
  import { Base64 } from "./Utils";
3
3
  /** Sourcenames provided by lavalink server */
4
4
  export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
@@ -89,6 +89,8 @@ export interface LavalinkTrack {
89
89
  info: LavalinkTrackInfo;
90
90
  /** Plugin Information from Lavalink */
91
91
  pluginInfo: Partial<PluginInfo>;
92
+ /** The userData Object from when you provide to the lavalink request */
93
+ userData?: anyObject;
92
94
  }
93
95
  export interface Track {
94
96
  /** The Base 64 encoded String */
@@ -99,6 +101,8 @@ export interface Track {
99
101
  pluginInfo: Partial<PluginInfo>;
100
102
  /** The Track's Requester */
101
103
  requester?: unknown;
104
+ /** The userData Object from when you provide to the lavalink request */
105
+ userData?: anyObject;
102
106
  }
103
107
  export interface UnresolvedTrackInfo extends Partial<TrackInfo> {
104
108
  /** Required */
@@ -117,6 +121,8 @@ export interface UnresolvedTrack {
117
121
  info: UnresolvedTrackInfo;
118
122
  /** Plugin Information from Lavalink */
119
123
  pluginInfo: Partial<PluginInfo>;
124
+ /** The userData Object from when you provide to the lavalink request */
125
+ userData?: anyObject;
120
126
  /** The Track's Requester */
121
127
  requester?: unknown;
122
128
  }
@@ -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 {};
@@ -56,6 +56,8 @@ export interface ManagerOptions {
56
56
  playerOptions?: ManagerPlayerOptions;
57
57
  /** If it should skip to the next Track on TrackEnd / TrackError etc. events */
58
58
  autoSkip?: boolean;
59
+ /** If it should skip to the next Track if track.resolve errors while trying to play a track. */
60
+ autoSkipOnResolveError?: boolean;
59
61
  /** If it should emit only new (unique) songs and not when a looping track (or similar) is plaid, default false */
60
62
  emitNewSongsOnly?: boolean;
61
63
  /** Only allow link requests with links either matching some of that regExp or including some of that string */
@@ -78,29 +78,49 @@ export interface NodeStats extends BaseNodeStats {
78
78
  frameStats: FrameStats;
79
79
  }
80
80
  export interface LavalinkInfo {
81
+ /** The version of this Lavalink server */
81
82
  version: VersionObject;
83
+ /** The millisecond unix timestamp when this Lavalink jar was built */
82
84
  buildTime: number;
85
+ /** The git information of this Lavalink server */
83
86
  git: GitObject;
87
+ /** The JVM version this Lavalink server runs on */
84
88
  jvm: string;
89
+ /** The Lavaplayer version being used by this server */
85
90
  lavaplayer: string;
91
+ /** The enabled source managers for this server */
86
92
  sourceManagers: string[];
93
+ /** The enabled filters for this server */
87
94
  filters: string[];
95
+ /** The enabled plugins for this server */
88
96
  plugins: PluginObject[];
89
97
  }
90
98
  export interface VersionObject {
99
+ /** The full version string of this Lavalink server */
91
100
  semver: string;
101
+ /** The major version of this Lavalink server */
92
102
  major: number;
103
+ /** The minor version of this Lavalink server */
93
104
  minor: number;
105
+ /** The patch version of this Lavalink server */
94
106
  patch: internal;
107
+ /** The pre-release version according to semver as a . separated list of identifiers */
95
108
  preRelease?: string;
109
+ /** The build metadata according to semver as a . separated list of identifiers */
110
+ build?: string;
96
111
  }
97
112
  export interface GitObject {
113
+ /** The branch this Lavalink server was built on */
98
114
  branch: string;
115
+ /** The commit this Lavalink server was built on */
99
116
  commit: string;
117
+ /** The millisecond unix timestamp for when the commit was created */
100
118
  commitTime: string;
101
119
  }
102
120
  export interface PluginObject {
121
+ /** The name of the plugin */
103
122
  name: string;
123
+ /** The version of the plugin */
104
124
  version: string;
105
125
  }
106
126
  export declare class LavalinkNode {
@@ -110,6 +130,11 @@ export declare class LavalinkNode {
110
130
  calls: number;
111
131
  stats: NodeStats;
112
132
  sessionId?: string | null;
133
+ /** Wether the node resuming is enabled or not */
134
+ resuming: {
135
+ enabled: boolean;
136
+ timeout: number | null;
137
+ };
113
138
  /** Actual Lavalink Information of the Node */
114
139
  info: LavalinkInfo | null;
115
140
  /** The Node Manager of this Node */
@@ -126,10 +151,16 @@ export declare class LavalinkNode {
126
151
  private version;
127
152
  /**
128
153
  * Create a new Node
129
- * @param options
130
- * @param manager
154
+ * @param options Lavalink Node Options
155
+ * @param manager Node Manager
131
156
  */
132
157
  constructor(options: LavalinkNodeOptions, manager: NodeManager);
158
+ /**
159
+ * Raw Request util function
160
+ * @param endpoint endpoint string
161
+ * @param modify modify the request
162
+ * @returns
163
+ */
133
164
  private rawRequest;
134
165
  /**
135
166
  * Makes an API call to the Node
@@ -138,6 +169,12 @@ export declare class LavalinkNode {
138
169
  * @returns The returned data
139
170
  */
140
171
  request(endpoint: string, modify?: ModifyRequest, parseAsText?: boolean): Promise<unknown>;
172
+ /**
173
+ * Search something raw on the node, please note only add tracks to players of that node
174
+ * @param query SearchQuery Object
175
+ * @param requestUser Request User for creating the player(s)
176
+ * @returns Searchresult
177
+ */
141
178
  search(query: SearchQuery, requestUser: unknown): Promise<SearchResult>;
142
179
  lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult | LavaSearchResponse>;
143
180
  /**
@@ -180,7 +217,7 @@ export declare class LavalinkNode {
180
217
  * @param resuming Whether resuming is enabled for this session or not
181
218
  * @param timeout The timeout in seconds (default is 60s)
182
219
  */
183
- updateSession(resuming?: boolean, timeout?: number): Promise<Session>;
220
+ updateSession(resuming?: boolean, timeout?: number): Promise<InvalidLavalinkRestRequest | Session>;
184
221
  /**
185
222
  * Decode Track or Tracks
186
223
  */
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from "stream";
3
- import { LavalinkNode, LavalinkNodeOptions } from "./Node";
4
3
  import { LavalinkManager } from "./LavalinkManager";
5
- import { MiniMap } from "./Utils";
4
+ import { LavalinkNode, LavalinkNodeOptions } from "./Node";
6
5
  import { DestroyReasonsType } from "./Player";
6
+ import { LavalinkPlayer, MiniMap } from "./Utils";
7
7
  type LavalinkNodeIdentifier = string;
8
8
  interface NodeManagerEvents {
9
9
  /**
@@ -44,6 +44,16 @@ interface NodeManagerEvents {
44
44
  * @event Manager.nodeManager#raw
45
45
  */
46
46
  "raw": (node: LavalinkNode, payload: unknown) => void;
47
+ /**
48
+ * Emits when the node connects resumed. You then need to create all players within this event for your usecase.
49
+ * Aka for that you need to be able to save player data like vc channel + text channel in a db and then sync it again
50
+ * @event Manager.nodeManager#nodeResumed
51
+ */
52
+ "resumed": (node: LavalinkNode, paylaod: {
53
+ resumed: true;
54
+ sessionId: string;
55
+ op: "ready";
56
+ }, players: LavalinkPlayer[]) => void;
47
57
  }
48
58
  export declare interface NodeManager {
49
59
  on<U extends keyof NodeManagerEvents>(event: U, listener: NodeManagerEvents[U]): this;
@@ -3,7 +3,7 @@ import { LavalinkManager } from "./LavalinkManager";
3
3
  import { LavalinkNode, SponsorBlockSegment } from "./Node";
4
4
  import { Queue } from "./Queue";
5
5
  import { Track, UnresolvedTrack } from "./Track";
6
- import { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Utils";
6
+ import { Base64, LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Utils";
7
7
  type PlayerDestroyReasons = "QueueEmpty" | "NodeDestroy" | "NodeDeleted" | "LavalinkNoVoice" | "NodeReconnectFail" | "PlayerReconnectFail" | "Disconnected" | "ChannelDeleted" | "ReconnectAllNodes" | "DisconnectAllNodes";
8
8
  export type DestroyReasonsType = PlayerDestroyReasons | string;
9
9
  export declare const DestroyReasons: Record<PlayerDestroyReasons, PlayerDestroyReasons>;
@@ -51,27 +51,42 @@ export interface PlayerOptions {
51
51
  /** If a volume should be applied via filters instead of lavalink-volume */
52
52
  applyVolumeAsFilter?: boolean;
53
53
  }
54
- export interface PlayOptions {
55
- /** Which Track to play | don't provide, if it should pick from the Queue */
56
- track?: Track | UnresolvedTrack;
57
- /** Encoded Track to use, instead of the queue system... */
58
- encodedTrack?: string | null;
59
- /** Encoded Track to use&search, instead of the queue system (yt only)... */
60
- identifier?: string;
54
+ export type anyObject = {
55
+ [key: string | number]: string | number | null | anyObject;
56
+ };
57
+ export interface BasePlayOptions {
61
58
  /** The position to start the track. */
62
59
  position?: number;
63
60
  /** The position to end the track. */
64
61
  endTime?: number;
65
- /** Whether to not replace the track if a play payload is sent. */
66
- noReplace?: boolean;
67
62
  /** If to start "paused" */
68
63
  paused?: boolean;
69
64
  /** The Volume to start with */
70
65
  volume?: number;
71
66
  /** The Lavalink Filters to use | only with the new REST API */
72
67
  filters?: Partial<LavalinkFilterData>;
68
+ /** Voice Update for Lavalink */
73
69
  voice?: LavalinkPlayerVoiceOptions;
74
70
  }
71
+ export interface LavalinkPlayOptions extends BasePlayOptions {
72
+ /** Which Track to play | don't provide, if it should pick from the Queue */
73
+ track?: {
74
+ /** The track encoded base64 string to use instead of the one from the queue system */
75
+ encoded?: Base64 | null;
76
+ /** The identifier of the track to use */
77
+ identifier?: string;
78
+ /** Custom User Data for the track to provide, will then be on the userData object from the track */
79
+ userData?: anyObject;
80
+ /** The Track requester for when u provide encodedTrack / identifer */
81
+ requester?: unknown;
82
+ };
83
+ }
84
+ export interface PlayOptions extends LavalinkPlayOptions {
85
+ /** Whether to not replace the track if a play payload is sent. */
86
+ noReplace?: boolean;
87
+ /** Which Track to play | don't provide, if it should pick from the Queue */
88
+ clientTrack?: Track | UnresolvedTrack;
89
+ }
75
90
  export interface Player {
76
91
  filterManager: FilterManager;
77
92
  LavalinkManager: LavalinkManager;
@@ -1,4 +1,4 @@
1
- import { Player } from "./Player";
1
+ import { anyObject, Player } from "./Player";
2
2
  import { Base64 } from "./Utils";
3
3
  /** Sourcenames provided by lavalink server */
4
4
  export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
@@ -89,6 +89,8 @@ export interface LavalinkTrack {
89
89
  info: LavalinkTrackInfo;
90
90
  /** Plugin Information from Lavalink */
91
91
  pluginInfo: Partial<PluginInfo>;
92
+ /** The userData Object from when you provide to the lavalink request */
93
+ userData?: anyObject;
92
94
  }
93
95
  export interface Track {
94
96
  /** The Base 64 encoded String */
@@ -99,6 +101,8 @@ export interface Track {
99
101
  pluginInfo: Partial<PluginInfo>;
100
102
  /** The Track's Requester */
101
103
  requester?: unknown;
104
+ /** The userData Object from when you provide to the lavalink request */
105
+ userData?: anyObject;
102
106
  }
103
107
  export interface UnresolvedTrackInfo extends Partial<TrackInfo> {
104
108
  /** Required */
@@ -117,6 +121,8 @@ export interface UnresolvedTrack {
117
121
  info: UnresolvedTrackInfo;
118
122
  /** Plugin Information from Lavalink */
119
123
  pluginInfo: Partial<PluginInfo>;
124
+ /** The userData Object from when you provide to the lavalink request */
125
+ userData?: anyObject;
120
126
  /** The Track's Requester */
121
127
  requester?: unknown;
122
128
  }
@@ -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.6",
3
+ "version": "2.0.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",