lavalink-client 2.3.6 → 2.4.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.
- package/README.md +56 -7
- package/dist/cjs/structures/Constants.d.ts +4 -0
- package/dist/cjs/structures/Constants.js +7 -2
- package/dist/cjs/structures/Filters.d.ts +24 -0
- package/dist/cjs/structures/Filters.js +34 -10
- package/dist/cjs/structures/LavalinkManager.d.ts +4 -5
- package/dist/cjs/structures/LavalinkManager.js +36 -14
- package/dist/cjs/structures/Node.d.ts +30 -16
- package/dist/cjs/structures/Node.js +165 -84
- package/dist/cjs/structures/NodeManager.d.ts +2 -2
- package/dist/cjs/structures/NodeManager.js +19 -19
- package/dist/cjs/structures/Player.d.ts +10 -3
- package/dist/cjs/structures/Player.js +12 -0
- package/dist/cjs/structures/Queue.d.ts +9 -10
- package/dist/cjs/structures/Queue.js +3 -3
- package/dist/cjs/structures/Types/Manager.d.ts +40 -0
- package/dist/cjs/structures/Types/Node.d.ts +0 -1
- package/dist/cjs/structures/Types/Player.d.ts +5 -1
- package/dist/cjs/structures/Types/Queue.d.ts +6 -6
- package/dist/cjs/structures/Types/Track.d.ts +3 -1
- package/dist/cjs/structures/Types/Utils.d.ts +17 -2
- package/dist/cjs/structures/Utils.js +3 -10
- package/dist/esm/structures/Constants.d.ts +4 -0
- package/dist/esm/structures/Constants.js +6 -1
- package/dist/esm/structures/Filters.d.ts +24 -0
- package/dist/esm/structures/Filters.js +34 -10
- package/dist/esm/structures/LavalinkManager.d.ts +4 -5
- package/dist/esm/structures/LavalinkManager.js +36 -14
- package/dist/esm/structures/Node.d.ts +30 -16
- package/dist/esm/structures/Node.js +165 -84
- package/dist/esm/structures/NodeManager.d.ts +2 -2
- package/dist/esm/structures/NodeManager.js +20 -20
- package/dist/esm/structures/Player.d.ts +10 -3
- package/dist/esm/structures/Player.js +12 -0
- package/dist/esm/structures/Queue.d.ts +9 -10
- package/dist/esm/structures/Queue.js +3 -3
- package/dist/esm/structures/Types/Manager.d.ts +40 -0
- package/dist/esm/structures/Types/Node.d.ts +0 -1
- package/dist/esm/structures/Types/Player.d.ts +5 -1
- package/dist/esm/structures/Types/Queue.d.ts +6 -6
- package/dist/esm/structures/Types/Track.d.ts +3 -1
- package/dist/esm/structures/Types/Utils.d.ts +17 -2
- package/dist/esm/structures/Utils.js +0 -7
- package/dist/types/structures/Constants.d.ts +4 -0
- package/dist/types/structures/Filters.d.ts +24 -0
- package/dist/types/structures/LavalinkManager.d.ts +4 -5
- package/dist/types/structures/Node.d.ts +30 -16
- package/dist/types/structures/NodeManager.d.ts +2 -2
- package/dist/types/structures/Player.d.ts +10 -3
- package/dist/types/structures/Queue.d.ts +9 -10
- package/dist/types/structures/Types/Manager.d.ts +40 -0
- package/dist/types/structures/Types/Node.d.ts +0 -1
- package/dist/types/structures/Types/Player.d.ts +5 -1
- package/dist/types/structures/Types/Queue.d.ts +6 -6
- package/dist/types/structures/Types/Track.d.ts +3 -1
- package/dist/types/structures/Types/Utils.d.ts +17 -2
- package/package.json +29 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Player } from "./Player";
|
|
2
|
-
import type { DestroyReasonsType } from "./Types/Player";
|
|
2
|
+
import type { DestroyReasonsType, DisconnectReasonsType } from "./Types/Player";
|
|
3
3
|
import type { Track } from "./Types/Track";
|
|
4
4
|
import type { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, LavaSearchResponse, PlayerUpdateInfo, RoutePlanner, SearchQuery, SearchResult, Session } from "./Types/Utils";
|
|
5
5
|
import type { NodeManager } from "./NodeManager";
|
|
@@ -13,6 +13,7 @@ export declare class LavalinkNode {
|
|
|
13
13
|
get heartBeatPing(): number;
|
|
14
14
|
private heartBeatInterval?;
|
|
15
15
|
private pingTimeout?;
|
|
16
|
+
isAlive: boolean;
|
|
16
17
|
/** The provided Options of the Node */
|
|
17
18
|
options: LavalinkNodeOptions;
|
|
18
19
|
/** The amount of rest calls the node has made. */
|
|
@@ -88,7 +89,8 @@ export declare class LavalinkNode {
|
|
|
88
89
|
* player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);
|
|
89
90
|
* ```
|
|
90
91
|
*/
|
|
91
|
-
request(endpoint: string, modify
|
|
92
|
+
request(endpoint: string, modify: ModifyRequest | undefined, parseAsText: true): Promise<string>;
|
|
93
|
+
request(endpoint: string, modify?: ModifyRequest, parseAsText?: false): Promise<any>;
|
|
92
94
|
/**
|
|
93
95
|
* Search something raw on the node, please note only add tracks to players of that node
|
|
94
96
|
* @param query SearchQuery Object
|
|
@@ -109,7 +111,7 @@ export declare class LavalinkNode {
|
|
|
109
111
|
* @param query LavaSearchQuery Object
|
|
110
112
|
* @param requestUser Request User for creating the player(s)
|
|
111
113
|
* @param throwOnEmpty Wether to throw on an empty result or not
|
|
112
|
-
* @returns LavaSearchresult
|
|
114
|
+
* @returns LavaSearchresult (SearchResult if link is provided)
|
|
113
115
|
*
|
|
114
116
|
* @example
|
|
115
117
|
* ```ts
|
|
@@ -117,7 +119,7 @@ export declare class LavalinkNode {
|
|
|
117
119
|
* player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);
|
|
118
120
|
* ```
|
|
119
121
|
*/
|
|
120
|
-
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<
|
|
122
|
+
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
|
|
121
123
|
/**
|
|
122
124
|
* Update the Player State on the Lavalink Server
|
|
123
125
|
* @param data data to send to lavalink and sync locally
|
|
@@ -141,7 +143,7 @@ export declare class LavalinkNode {
|
|
|
141
143
|
* player.node.destroyPlayer(player.guildId);
|
|
142
144
|
* ```
|
|
143
145
|
*/
|
|
144
|
-
destroyPlayer(guildId: any): Promise<
|
|
146
|
+
destroyPlayer(guildId: any): Promise<void>;
|
|
145
147
|
/**
|
|
146
148
|
* Connect to the Lavalink Node
|
|
147
149
|
* @param sessionId Provide the Session Id of the previous connection, to resume the node and it's player(s)
|
|
@@ -169,7 +171,7 @@ export declare class LavalinkNode {
|
|
|
169
171
|
get id(): string;
|
|
170
172
|
/**
|
|
171
173
|
* Destroys the Node-Connection (Websocket) and all player's of the node
|
|
172
|
-
* @param destroyReason
|
|
174
|
+
* @param destroyReason Destroy Reason to use when destroying the players
|
|
173
175
|
* @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
|
|
174
176
|
* @returns void
|
|
175
177
|
*
|
|
@@ -179,6 +181,19 @@ export declare class LavalinkNode {
|
|
|
179
181
|
* ```
|
|
180
182
|
*/
|
|
181
183
|
destroy(destroyReason?: DestroyReasonsType, deleteNode?: boolean): void;
|
|
184
|
+
/**
|
|
185
|
+
* Disconnects the Node-Connection (Websocket)
|
|
186
|
+
* @param disconnectReason Disconnect Reason to use when disconnecting Node
|
|
187
|
+
* @returns void
|
|
188
|
+
*
|
|
189
|
+
* Also the node will not get re-connected again.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* player.node.destroy("custom Player Destroy Reason", true);
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
disconnect(disconnectReason?: DisconnectReasonsType): void;
|
|
182
197
|
/**
|
|
183
198
|
* Returns if connected to the Node.
|
|
184
199
|
*
|
|
@@ -189,7 +204,6 @@ export declare class LavalinkNode {
|
|
|
189
204
|
* ```
|
|
190
205
|
*/
|
|
191
206
|
get connected(): boolean;
|
|
192
|
-
isAlive: boolean;
|
|
193
207
|
/**
|
|
194
208
|
* Returns the current ConnectionStatus
|
|
195
209
|
*
|
|
@@ -214,7 +228,7 @@ export declare class LavalinkNode {
|
|
|
214
228
|
* const playersOfLavalink = await node?.fetchAllPlayers();
|
|
215
229
|
* ```
|
|
216
230
|
*/
|
|
217
|
-
fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest>;
|
|
231
|
+
fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest | null>;
|
|
218
232
|
/**
|
|
219
233
|
* Gets specific Player Information
|
|
220
234
|
* @returns lavalink player object if player exists on lavalink
|
|
@@ -225,7 +239,7 @@ export declare class LavalinkNode {
|
|
|
225
239
|
* const playerInformation = await node?.fetchPlayer("guildId");
|
|
226
240
|
* ```
|
|
227
241
|
*/
|
|
228
|
-
fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest>;
|
|
242
|
+
fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest | null>;
|
|
229
243
|
/**
|
|
230
244
|
* Updates the session with and enables/disables resuming and timeout
|
|
231
245
|
* @param resuming Whether resuming is enabled for this session or not
|
|
@@ -238,7 +252,7 @@ export declare class LavalinkNode {
|
|
|
238
252
|
* await node?.updateSession(true, 180e3); // will enable resuming for 180seconds
|
|
239
253
|
* ```
|
|
240
254
|
*/
|
|
241
|
-
updateSession(resuming?: boolean, timeout?: number): Promise<InvalidLavalinkRestRequest |
|
|
255
|
+
updateSession(resuming?: boolean, timeout?: number): Promise<Session | InvalidLavalinkRestRequest | null>;
|
|
242
256
|
/**
|
|
243
257
|
* Decode Track or Tracks
|
|
244
258
|
*/
|
|
@@ -285,7 +299,7 @@ export declare class LavalinkNode {
|
|
|
285
299
|
* // const lyrics = await player.getLyrics(track, true);
|
|
286
300
|
* ```
|
|
287
301
|
*/
|
|
288
|
-
get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult>;
|
|
302
|
+
get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
|
|
289
303
|
/**
|
|
290
304
|
* Get the lyrics of the current playing track
|
|
291
305
|
*
|
|
@@ -299,7 +313,7 @@ export declare class LavalinkNode {
|
|
|
299
313
|
* // const lyrics = await player.getCurrentLyrics();
|
|
300
314
|
* ```
|
|
301
315
|
*/
|
|
302
|
-
getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult>;
|
|
316
|
+
getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
|
|
303
317
|
/**
|
|
304
318
|
* subscribe to lyrics updates for a guild
|
|
305
319
|
* @param guildId the guild id of the player
|
|
@@ -312,7 +326,7 @@ export declare class LavalinkNode {
|
|
|
312
326
|
* // const lyrics = await player.subscribeLyrics();
|
|
313
327
|
* ```
|
|
314
328
|
*/
|
|
315
|
-
subscribe: (guildId: string) => Promise<
|
|
329
|
+
subscribe: (guildId: string) => Promise<unknown>;
|
|
316
330
|
/**
|
|
317
331
|
* unsubscribe from lyrics updates for a guild
|
|
318
332
|
* @param guildId the guild id of the player
|
|
@@ -325,7 +339,7 @@ export declare class LavalinkNode {
|
|
|
325
339
|
* // const lyrics = await player.unsubscribeLyrics();
|
|
326
340
|
* ```
|
|
327
341
|
*/
|
|
328
|
-
unsubscribe: (guildId: string) => Promise<
|
|
342
|
+
unsubscribe: (guildId: string) => Promise<void>;
|
|
329
343
|
};
|
|
330
344
|
/**
|
|
331
345
|
* Request Lavalink statistics.
|
|
@@ -385,7 +399,7 @@ export declare class LavalinkNode {
|
|
|
385
399
|
* await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
|
|
386
400
|
* ```
|
|
387
401
|
*/
|
|
388
|
-
unmarkFailedAddress: (address: string) => Promise<
|
|
402
|
+
unmarkFailedAddress: (address: string) => Promise<unknown>;
|
|
389
403
|
/**
|
|
390
404
|
* Release all blacklisted IP addresses into pool of IPs
|
|
391
405
|
* @returns request data of the request
|
|
@@ -395,7 +409,7 @@ export declare class LavalinkNode {
|
|
|
395
409
|
* await player.node.routePlannerApi.unmarkAllFailedAddresses();
|
|
396
410
|
* ```
|
|
397
411
|
*/
|
|
398
|
-
unmarkAllFailedAddresses: () => Promise<
|
|
412
|
+
unmarkAllFailedAddresses: () => Promise<unknown>;
|
|
399
413
|
};
|
|
400
414
|
/** @private Utils for validating the */
|
|
401
415
|
private validate;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { EventEmitter } from "events";
|
|
3
2
|
import { LavalinkNode } from "./Node";
|
|
4
3
|
import { MiniMap } from "./Utils";
|
|
@@ -55,9 +54,10 @@ export declare class NodeManager extends EventEmitter {
|
|
|
55
54
|
/**
|
|
56
55
|
* Disconnects all Nodes from lavalink ws sockets
|
|
57
56
|
* @param deleteAllNodes if the nodes should also be deleted from nodeManager.nodes
|
|
57
|
+
* @param destroyPlayers if the players should be destroyed
|
|
58
58
|
* @returns amount of disconnected Nodes
|
|
59
59
|
*/
|
|
60
|
-
disconnectAll(deleteAllNodes?: boolean): Promise<number>;
|
|
60
|
+
disconnectAll(deleteAllNodes?: boolean, destroyPlayers?: boolean): Promise<number>;
|
|
61
61
|
/**
|
|
62
62
|
* Connects all not connected nodes
|
|
63
63
|
* @returns Amount of connected Nodes
|
|
@@ -52,6 +52,13 @@ export declare class Player {
|
|
|
52
52
|
connected: boolean | undefined;
|
|
53
53
|
/** Voice Server Data (from Lavalink) */
|
|
54
54
|
voice: LavalinkPlayerVoiceOptions;
|
|
55
|
+
voiceState: {
|
|
56
|
+
selfDeaf: boolean;
|
|
57
|
+
selfMute: boolean;
|
|
58
|
+
serverDeaf: boolean;
|
|
59
|
+
serverMute: boolean;
|
|
60
|
+
suppress: boolean;
|
|
61
|
+
};
|
|
55
62
|
/** Custom data for the player */
|
|
56
63
|
private readonly data;
|
|
57
64
|
/**
|
|
@@ -97,7 +104,7 @@ export declare class Player {
|
|
|
97
104
|
* @param throwOnEmpty If an error should be thrown if no track is found
|
|
98
105
|
* @returns The search result
|
|
99
106
|
*/
|
|
100
|
-
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").
|
|
107
|
+
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").LavaSearchResponse | import("./Types/Utils").SearchResult>;
|
|
101
108
|
/**
|
|
102
109
|
* Set the SponsorBlock
|
|
103
110
|
* @param segments The segments to set
|
|
@@ -196,7 +203,7 @@ export declare class Player {
|
|
|
196
203
|
* const lyrics = await player.subscribeLyrics();
|
|
197
204
|
* ```
|
|
198
205
|
*/
|
|
199
|
-
subscribeLyrics(): Promise<
|
|
206
|
+
subscribeLyrics(): Promise<unknown>;
|
|
200
207
|
/**
|
|
201
208
|
* Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
|
|
202
209
|
* @param guildId The guild id to unsubscribe from
|
|
@@ -206,7 +213,7 @@ export declare class Player {
|
|
|
206
213
|
* const lyrics = await player.unsubscribeLyrics();
|
|
207
214
|
* ```
|
|
208
215
|
*/
|
|
209
|
-
unsubscribeLyrics(guildId: string): Promise<
|
|
216
|
+
unsubscribeLyrics(guildId: string): Promise<void>;
|
|
210
217
|
/**
|
|
211
218
|
* Move the player on a different Audio-Node
|
|
212
219
|
* @param newNode New Node / New Node Id
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MiniMap } from "./Utils";
|
|
2
1
|
import type { Track, UnresolvedTrack } from "./Types/Track";
|
|
3
2
|
import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue";
|
|
4
3
|
export declare class QueueSaver {
|
|
@@ -24,14 +23,14 @@ export declare class QueueSaver {
|
|
|
24
23
|
* @param guildId The guild ID
|
|
25
24
|
* @returns The queue for the guild
|
|
26
25
|
*/
|
|
27
|
-
delete(guildId: string): Promise<
|
|
26
|
+
delete(guildId: string): Promise<boolean | void>;
|
|
28
27
|
/**
|
|
29
28
|
* Set the queue for a guild
|
|
30
29
|
* @param guildId The guild ID
|
|
31
30
|
* @param valueToStringify The queue to set
|
|
32
31
|
* @returns The queue for the guild
|
|
33
32
|
*/
|
|
34
|
-
set(guildId: string, valueToStringify: StoredQueue): Promise<
|
|
33
|
+
set(guildId: string, valueToStringify: StoredQueue): Promise<boolean | void>;
|
|
35
34
|
/**
|
|
36
35
|
* Sync the queue for a guild
|
|
37
36
|
* @param guildId The guild ID
|
|
@@ -47,32 +46,32 @@ export declare class DefaultQueueStore implements QueueStoreManager {
|
|
|
47
46
|
* @param guildId The guild ID
|
|
48
47
|
* @returns The queue for the guild
|
|
49
48
|
*/
|
|
50
|
-
get(guildId:
|
|
49
|
+
get(guildId: string): Promise<StoredQueue>;
|
|
51
50
|
/**
|
|
52
51
|
* Set the queue for a guild
|
|
53
52
|
* @param guildId The guild ID
|
|
54
53
|
* @param valueToStringify The queue to set
|
|
55
54
|
* @returns The queue for the guild
|
|
56
55
|
*/
|
|
57
|
-
set(guildId:
|
|
56
|
+
set(guildId: string, valueToStringify: any): Promise<boolean>;
|
|
58
57
|
/**
|
|
59
58
|
* Delete the queue for a guild
|
|
60
59
|
* @param guildId The guild ID
|
|
61
60
|
* @returns The queue for the guild
|
|
62
61
|
*/
|
|
63
|
-
delete(guildId:
|
|
62
|
+
delete(guildId: string): Promise<boolean>;
|
|
64
63
|
/**
|
|
65
64
|
* Stringify the queue for a guild
|
|
66
65
|
* @param value The queue to stringify
|
|
67
66
|
* @returns The stringified queue
|
|
68
67
|
*/
|
|
69
|
-
stringify(value:
|
|
68
|
+
stringify(value: StoredQueue): Promise<StoredQueue>;
|
|
70
69
|
/**
|
|
71
70
|
* Parse the queue for a guild
|
|
72
71
|
* @param value The queue to parse
|
|
73
72
|
* @returns The parsed queue
|
|
74
73
|
*/
|
|
75
|
-
parse(value:
|
|
74
|
+
parse(value: StoredQueue): Promise<StoredQueue>;
|
|
76
75
|
}
|
|
77
76
|
export declare class Queue {
|
|
78
77
|
readonly tracks: (Track | UnresolvedTrack)[];
|
|
@@ -100,13 +99,13 @@ export declare class Queue {
|
|
|
100
99
|
/**
|
|
101
100
|
* Save the current cached Queue on the database/server (overides the server)
|
|
102
101
|
*/
|
|
103
|
-
save: () => Promise<
|
|
102
|
+
save: () => Promise<boolean | void>;
|
|
104
103
|
/**
|
|
105
104
|
* Sync the current queue database/server with the cached one
|
|
106
105
|
* @returns {void}
|
|
107
106
|
*/
|
|
108
107
|
sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
|
|
109
|
-
destroy: () => Promise<
|
|
108
|
+
destroy: () => Promise<boolean | void>;
|
|
110
109
|
/**
|
|
111
110
|
* @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
|
|
112
111
|
*/
|
|
@@ -73,6 +73,46 @@ export interface LavalinkManagerEvents {
|
|
|
73
73
|
* @event Manager#playerUpdate
|
|
74
74
|
*/
|
|
75
75
|
"playerUpdate": (oldPlayerJson: PlayerJson, newPlayer: Player) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Emitted when the player's selfMuted or serverMuted state changed (true -> false | false -> true)
|
|
78
|
+
* @event Manager#playerMuteChange
|
|
79
|
+
*/
|
|
80
|
+
"playerMuteChange": (player: Player, selfMuted: boolean, serverMuted: boolean) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Emitted when the player's selfDeafed or serverDeafed state changed (true -> false | false -> true)
|
|
83
|
+
* @event Manager#playerDeafChange
|
|
84
|
+
*/
|
|
85
|
+
"playerDeafChange": (player: Player, selfDeafed: boolean, serverDeafed: boolean) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Emitted when the player's suppressed (true -> false | false -> true)
|
|
88
|
+
* @event Manager#playerSuppressChange
|
|
89
|
+
*/
|
|
90
|
+
"playerSuppressChange": (player: Player, suppress: boolean) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Emitted when the player's queue got empty, and the timeout started
|
|
93
|
+
* @event Manager#playerQueueEmptyStart
|
|
94
|
+
*/
|
|
95
|
+
"playerQueueEmptyStart": (player: Player, timeoutMs: number) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Emitted when the player's queue got empty, and the timeout finished leading to destroying the player
|
|
98
|
+
* @event Manager#playerQueueEmptyEnd
|
|
99
|
+
*/
|
|
100
|
+
"playerQueueEmptyEnd": (player: Player) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Emitted when the player's queue got empty, and the timeout got cancelled becuase a track got re-added to it.
|
|
103
|
+
* @event Manager#playerQueueEmptyEnd
|
|
104
|
+
*/
|
|
105
|
+
"playerQueueEmptyCancel": (player: Player) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Emitted, when a user joins the voice channel, while there is a player existing
|
|
108
|
+
* @event Manager#playerQueueEmptyStart
|
|
109
|
+
*/
|
|
110
|
+
"playerVoiceJoin": (player: Player, userId: string) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Emitted, when a user leaves the voice channel, while there is a player existing
|
|
113
|
+
* @event Manager#playerQueueEmptyEnd
|
|
114
|
+
*/
|
|
115
|
+
"playerVoiceLeave": (player: Player, userId: string) => void;
|
|
76
116
|
/**
|
|
77
117
|
* SPONSORBLOCK-PLUGIN EVENT
|
|
78
118
|
* Emitted when Segments are loaded
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { DestroyReasons } from "../Constants";
|
|
1
|
+
import type { DestroyReasons, DisconnectReasons } from "../Constants";
|
|
2
2
|
import type { LavalinkNode } from "../Node";
|
|
3
3
|
import type { EQBand, FilterData, LavalinkFilterData } from "./Filters";
|
|
4
|
+
import type { StoredQueue } from "./Queue";
|
|
4
5
|
import type { Track, UnresolvedTrack } from "./Track";
|
|
5
6
|
import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils";
|
|
6
7
|
export type DestroyReasonsType = keyof typeof DestroyReasons | string;
|
|
8
|
+
export type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
|
|
7
9
|
export interface PlayerJson {
|
|
8
10
|
/** Guild Id where the player was playing in */
|
|
9
11
|
guildId: string;
|
|
@@ -46,6 +48,8 @@ export interface PlayerJson {
|
|
|
46
48
|
nodeId?: string;
|
|
47
49
|
/** The SessionId of the node */
|
|
48
50
|
nodeSessionId?: string;
|
|
51
|
+
/** The stored queue */
|
|
52
|
+
queue?: StoredQueue;
|
|
49
53
|
}
|
|
50
54
|
export type RepeatMode = "queue" | "track" | "off";
|
|
51
55
|
export interface PlayerOptions {
|
|
@@ -4,17 +4,17 @@ export interface StoredQueue {
|
|
|
4
4
|
previous: Track[];
|
|
5
5
|
tracks: (Track | UnresolvedTrack)[];
|
|
6
6
|
}
|
|
7
|
-
export interface QueueStoreManager
|
|
7
|
+
export interface QueueStoreManager {
|
|
8
8
|
/** @async get a Value (MUST RETURN UNPARSED!) */
|
|
9
|
-
get: (guildId:
|
|
9
|
+
get: (guildId: string) => Promise<StoredQueue | string>;
|
|
10
10
|
/** @async Set a value inside a guildId (MUST BE UNPARSED) */
|
|
11
|
-
set: (guildId:
|
|
11
|
+
set: (guildId: string, value: StoredQueue | string) => Promise<void | boolean>;
|
|
12
12
|
/** @async Delete a Database Value based of it's guildId */
|
|
13
|
-
delete: (guildId:
|
|
13
|
+
delete: (guildId: string) => Promise<void | boolean>;
|
|
14
14
|
/** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
15
|
-
stringify: (value:
|
|
15
|
+
stringify: (value: StoredQueue | string) => Promise<StoredQueue | string>;
|
|
16
16
|
/** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
17
|
-
parse: (value:
|
|
17
|
+
parse: (value: StoredQueue | string) => Promise<Partial<StoredQueue>>;
|
|
18
18
|
}
|
|
19
19
|
export interface ManagerQueueOptions {
|
|
20
20
|
/** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
|
|
@@ -5,8 +5,10 @@ import type { Base64 } from "./Utils";
|
|
|
5
5
|
export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
|
|
6
6
|
/** Source Names provided by lava src plugin */
|
|
7
7
|
export type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
|
|
8
|
+
/** Source Names provided by jiosaavan plugin */
|
|
9
|
+
export type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
|
|
8
10
|
/** The SourceNames provided by lavalink */
|
|
9
|
-
export type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames;
|
|
11
|
+
export type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
|
|
10
12
|
export interface LavalinkTrackInfo {
|
|
11
13
|
/** The Identifier of the Track */
|
|
12
14
|
identifier: string;
|
|
@@ -236,8 +236,7 @@ export interface LavalinkPlayerVoice {
|
|
|
236
236
|
/** The Ping to the voice server */
|
|
237
237
|
ping?: number;
|
|
238
238
|
}
|
|
239
|
-
export
|
|
240
|
-
}
|
|
239
|
+
export type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
|
|
241
240
|
export interface FailingAddress {
|
|
242
241
|
/** The failing address */
|
|
243
242
|
failingAddress: string;
|
|
@@ -353,6 +352,22 @@ export interface VoiceState {
|
|
|
353
352
|
session_id: string;
|
|
354
353
|
/** Voice Channel Id */
|
|
355
354
|
channel_id: string;
|
|
355
|
+
/** Server Mute status */
|
|
356
|
+
mute: boolean;
|
|
357
|
+
/** Server Deaf status */
|
|
358
|
+
deaf: boolean;
|
|
359
|
+
/** Self Deaf status */
|
|
360
|
+
self_deaf: boolean;
|
|
361
|
+
/** Self Mute status */
|
|
362
|
+
self_mute: boolean;
|
|
363
|
+
/** Self Video (Camera) status */
|
|
364
|
+
self_video: boolean;
|
|
365
|
+
/** Self Stream status */
|
|
366
|
+
self_stream: boolean;
|
|
367
|
+
/** Wether the user requests to speak (stage channel) */
|
|
368
|
+
request_to_speak_timestamp: boolean;
|
|
369
|
+
/** Self suppressed status (stage channel) */
|
|
370
|
+
suppress: boolean;
|
|
356
371
|
}
|
|
357
372
|
/** The Base64 decodes tring by lavalink */
|
|
358
373
|
export type Base64 = string;
|
package/package.json
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lavalink-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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",
|
|
7
7
|
"types": "dist/types/index.d.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "npm run
|
|
10
|
-
|
|
11
|
-
"build:
|
|
12
|
-
"build:
|
|
13
|
-
|
|
9
|
+
"build": "npm run tool:clean && npm run build:all && npm run tool:fixbuild",
|
|
10
|
+
|
|
11
|
+
"build:bun": "bun run tool:clean && bun run build:all:bun && bun run tool:fixbuild",
|
|
12
|
+
"build:all:bun": "bun run build:cjs && bun run build:esm && bun run build:types",
|
|
13
|
+
|
|
14
|
+
"build:all": "npm run build:cjs && npm run build:esm && npm run build:types",
|
|
15
|
+
"build:cjs": "tsc -p tools/config/tsconfig.cjs.json && tsc-alias -p tools/config/tsconfig.cjs.json",
|
|
16
|
+
"build:esm": "tsc -p tools/config/tsconfig.esm.json && tsc-alias -p tools/config/tsconfig.esm.json",
|
|
17
|
+
"build:types": "tsc -p tools/config/tsconfig.types.json && tsc-alias -p tools/config/tsconfig.types.json",
|
|
18
|
+
|
|
19
|
+
"tool:clean": "node tools/cleanup.js",
|
|
20
|
+
"tool:fixbuild": "node tools/fixup.js",
|
|
21
|
+
|
|
14
22
|
"lint": "eslint .",
|
|
15
23
|
"lint:fix": "npm run lint -- --fix",
|
|
24
|
+
|
|
16
25
|
"test": "node -v",
|
|
17
|
-
|
|
26
|
+
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"prepare": "npm run build"
|
|
18
29
|
},
|
|
19
30
|
"exports": {
|
|
20
31
|
"require": "./dist/cjs/index.js",
|
|
@@ -51,21 +62,21 @@
|
|
|
51
62
|
"bugs": {
|
|
52
63
|
"url": "https://github.com/tomato6966/lavalink-client/issues"
|
|
53
64
|
},
|
|
54
|
-
"homepage": "https://
|
|
65
|
+
"homepage": "https://tomato6966.github.io/lavalink-client/",
|
|
55
66
|
"devDependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"eslint": "^8.
|
|
67
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
68
|
+
"@eslint/js": "^9.11.0",
|
|
69
|
+
"@types/node": "^22.5.5",
|
|
70
|
+
"@types/ws": "^8.5.12",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
|
72
|
+
"@typescript-eslint/parser": "^8.6.0",
|
|
73
|
+
"eslint": "^9.11.0",
|
|
61
74
|
"tsc-alias": "^1.8.10",
|
|
62
|
-
"
|
|
63
|
-
"typedoc-theme-hierarchy": "^4.1.2",
|
|
64
|
-
"typescript": "^5.1.6"
|
|
75
|
+
"typescript": "^5.6.2"
|
|
65
76
|
},
|
|
66
77
|
"dependencies": {
|
|
67
|
-
"tslib": "^2.
|
|
68
|
-
"ws": "^8.
|
|
78
|
+
"tslib": "^2.7.0",
|
|
79
|
+
"ws": "^8.18.0"
|
|
69
80
|
},
|
|
70
81
|
"engines": {
|
|
71
82
|
"node": ">=18.0.0",
|