lavalink-client 2.5.6 → 2.5.8
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 +9 -2
- package/dist/index.d.mts +3036 -0
- package/dist/index.d.ts +3036 -0
- package/dist/index.js +4965 -0
- package/dist/index.mjs +4904 -0
- package/package.json +22 -25
- package/dist/cjs/index.d.ts +0 -16
- package/dist/cjs/index.js +0 -19
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/structures/Constants.d.ts +0 -90
- package/dist/cjs/structures/Constants.js +0 -296
- package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +0 -3
- package/dist/cjs/structures/CustomSearches/BandCampSearch.js +0 -39
- package/dist/cjs/structures/Filters.d.ts +0 -169
- package/dist/cjs/structures/Filters.js +0 -700
- package/dist/cjs/structures/LavalinkManager.d.ts +0 -232
- package/dist/cjs/structures/LavalinkManager.js +0 -621
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +0 -15
- package/dist/cjs/structures/LavalinkManagerStatics.js +0 -149
- package/dist/cjs/structures/Node.d.ts +0 -523
- package/dist/cjs/structures/Node.js +0 -1605
- package/dist/cjs/structures/NodeManager.d.ts +0 -100
- package/dist/cjs/structures/NodeManager.js +0 -224
- package/dist/cjs/structures/Player.d.ts +0 -223
- package/dist/cjs/structures/Player.js +0 -807
- package/dist/cjs/structures/Queue.d.ts +0 -186
- package/dist/cjs/structures/Queue.js +0 -390
- package/dist/cjs/structures/Types/Filters.d.ts +0 -190
- package/dist/cjs/structures/Types/Filters.js +0 -2
- package/dist/cjs/structures/Types/Manager.d.ts +0 -271
- package/dist/cjs/structures/Types/Manager.js +0 -2
- package/dist/cjs/structures/Types/Node.d.ts +0 -238
- package/dist/cjs/structures/Types/Node.js +0 -2
- package/dist/cjs/structures/Types/Player.d.ts +0 -114
- package/dist/cjs/structures/Types/Player.js +0 -2
- package/dist/cjs/structures/Types/Queue.d.ts +0 -34
- package/dist/cjs/structures/Types/Queue.js +0 -2
- package/dist/cjs/structures/Types/Track.d.ts +0 -134
- package/dist/cjs/structures/Types/Track.js +0 -2
- package/dist/cjs/structures/Types/Utils.d.ts +0 -440
- package/dist/cjs/structures/Types/Utils.js +0 -2
- package/dist/cjs/structures/Utils.d.ts +0 -116
- package/dist/cjs/structures/Utils.js +0 -567
- package/dist/esm/index.d.ts +0 -16
- package/dist/esm/index.js +0 -16
- package/dist/esm/package.json +0 -3
- package/dist/esm/structures/Constants.d.ts +0 -90
- package/dist/esm/structures/Constants.js +0 -293
- package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +0 -3
- package/dist/esm/structures/CustomSearches/BandCampSearch.js +0 -35
- package/dist/esm/structures/Filters.d.ts +0 -169
- package/dist/esm/structures/Filters.js +0 -696
- package/dist/esm/structures/LavalinkManager.d.ts +0 -232
- package/dist/esm/structures/LavalinkManager.js +0 -617
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +0 -15
- package/dist/esm/structures/LavalinkManagerStatics.js +0 -146
- package/dist/esm/structures/Node.d.ts +0 -523
- package/dist/esm/structures/Node.js +0 -1600
- package/dist/esm/structures/NodeManager.d.ts +0 -100
- package/dist/esm/structures/NodeManager.js +0 -220
- package/dist/esm/structures/Player.d.ts +0 -223
- package/dist/esm/structures/Player.js +0 -803
- package/dist/esm/structures/Queue.d.ts +0 -186
- package/dist/esm/structures/Queue.js +0 -384
- package/dist/esm/structures/Types/Filters.d.ts +0 -190
- package/dist/esm/structures/Types/Filters.js +0 -1
- package/dist/esm/structures/Types/Manager.d.ts +0 -271
- package/dist/esm/structures/Types/Manager.js +0 -1
- package/dist/esm/structures/Types/Node.d.ts +0 -238
- package/dist/esm/structures/Types/Node.js +0 -1
- package/dist/esm/structures/Types/Player.d.ts +0 -114
- package/dist/esm/structures/Types/Player.js +0 -1
- package/dist/esm/structures/Types/Queue.d.ts +0 -34
- package/dist/esm/structures/Types/Queue.js +0 -1
- package/dist/esm/structures/Types/Track.d.ts +0 -134
- package/dist/esm/structures/Types/Track.js +0 -1
- package/dist/esm/structures/Types/Utils.d.ts +0 -440
- package/dist/esm/structures/Types/Utils.js +0 -1
- package/dist/esm/structures/Utils.d.ts +0 -116
- package/dist/esm/structures/Utils.js +0 -559
- package/dist/types/index.d.ts +0 -16
- package/dist/types/structures/Constants.d.ts +0 -90
- package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +0 -3
- package/dist/types/structures/Filters.d.ts +0 -169
- package/dist/types/structures/LavalinkManager.d.ts +0 -232
- package/dist/types/structures/LavalinkManagerStatics.d.ts +0 -15
- package/dist/types/structures/Node.d.ts +0 -523
- package/dist/types/structures/NodeManager.d.ts +0 -100
- package/dist/types/structures/Player.d.ts +0 -223
- package/dist/types/structures/Queue.d.ts +0 -186
- package/dist/types/structures/Types/Filters.d.ts +0 -190
- package/dist/types/structures/Types/Manager.d.ts +0 -271
- package/dist/types/structures/Types/Node.d.ts +0 -238
- package/dist/types/structures/Types/Player.d.ts +0 -114
- package/dist/types/structures/Types/Queue.d.ts +0 -34
- package/dist/types/structures/Types/Track.d.ts +0 -134
- package/dist/types/structures/Types/Utils.d.ts +0 -440
- package/dist/types/structures/Utils.d.ts +0 -116
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import type { DebugEvents } from "../Constants";
|
|
2
|
-
import type { Player } from "../Player";
|
|
3
|
-
import type { LavalinkNodeOptions } from "./Node";
|
|
4
|
-
import type { DestroyReasonsType, PlayerJson } from "./Player";
|
|
5
|
-
import type { ManagerQueueOptions } from "./Queue";
|
|
6
|
-
import type { Track, UnresolvedTrack } from "./Track";
|
|
7
|
-
import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent, LyricsFoundEvent, LyricsNotFoundEvent, LyricsLineEvent } from "./Utils";
|
|
8
|
-
/**
|
|
9
|
-
* The events from the lavalink Manager
|
|
10
|
-
*/
|
|
11
|
-
export interface LavalinkManagerEvents {
|
|
12
|
-
/**
|
|
13
|
-
* Emitted when a Track started playing.
|
|
14
|
-
* @event Manager#trackStart
|
|
15
|
-
*/
|
|
16
|
-
"trackStart": (player: Player, track: Track | null, payload: TrackStartEvent) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Emitted when a Track finished.
|
|
19
|
-
* @event Manager#trackEnd
|
|
20
|
-
*/
|
|
21
|
-
"trackEnd": (player: Player, track: Track | null, payload: TrackEndEvent) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Emitted when a Track got stuck while playing.
|
|
24
|
-
* @event Manager#trackStuck
|
|
25
|
-
*/
|
|
26
|
-
"trackStuck": (player: Player, track: Track | null, payload: TrackStuckEvent) => void;
|
|
27
|
-
/**
|
|
28
|
-
* Emitted when a Track errored.
|
|
29
|
-
* @event Manager#trackError
|
|
30
|
-
*/
|
|
31
|
-
"trackError": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Emitted when the Playing finished and no more tracks in the queue.
|
|
34
|
-
* @event Manager#queueEnd
|
|
35
|
-
*/
|
|
36
|
-
"queueEnd": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Emitted when a Player is created.
|
|
39
|
-
* @event Manager#playerCreate
|
|
40
|
-
*/
|
|
41
|
-
"playerCreate": (player: Player) => void;
|
|
42
|
-
/**
|
|
43
|
-
* Emitted when a Player is moved within the channel.
|
|
44
|
-
* @event Manager#playerMove
|
|
45
|
-
*/
|
|
46
|
-
"playerMove": (player: Player, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Emitted when a Player is disconnected from a channel.
|
|
49
|
-
* @event Manager#playerDisconnect
|
|
50
|
-
*/
|
|
51
|
-
"playerDisconnect": (player: Player, voiceChannelId: string) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Emitted when a Node-Socket got closed for a specific Player.
|
|
54
|
-
* Usually emits when the audio websocket to discord is closed, This can happen for various reasons (normal and abnormal), e.g. when using an expired voice server update. 4xxx codes are usually bad.
|
|
55
|
-
*
|
|
56
|
-
* So this is just information, normally lavalink should handle disconnections
|
|
57
|
-
*
|
|
58
|
-
* Discord Docs:
|
|
59
|
-
* @link https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
|
|
60
|
-
*
|
|
61
|
-
* Lavalink Docs:
|
|
62
|
-
* @link https://lavalink.dev/api/websocket.html#websocketclosedevent
|
|
63
|
-
* @event Manager#playerSocketClosed
|
|
64
|
-
*/
|
|
65
|
-
"playerSocketClosed": (player: Player, payload: WebSocketClosedEvent) => void;
|
|
66
|
-
/**
|
|
67
|
-
* Emitted when a Player get's destroyed
|
|
68
|
-
* @event Manager#playerDestroy
|
|
69
|
-
*/
|
|
70
|
-
"playerDestroy": (player: Player, destroyReason?: DestroyReasonsType) => void;
|
|
71
|
-
/**
|
|
72
|
-
* Always emits when the player (on lavalink side) got updated
|
|
73
|
-
* @event Manager#playerUpdate
|
|
74
|
-
*/
|
|
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;
|
|
116
|
-
/**
|
|
117
|
-
* SPONSORBLOCK-PLUGIN EVENT
|
|
118
|
-
* Emitted when Segments are loaded
|
|
119
|
-
* @link https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
|
|
120
|
-
* @event Manager#trackError
|
|
121
|
-
*/
|
|
122
|
-
"SegmentsLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
|
|
123
|
-
/**
|
|
124
|
-
* SPONSORBLOCK-PLUGIN EVENT
|
|
125
|
-
* Emitted when a specific Segment was skipped
|
|
126
|
-
* @link https://github.com/topi314/Sponsorblock-Plugin#segmentskipped
|
|
127
|
-
* @event Manager#trackError
|
|
128
|
-
*/
|
|
129
|
-
"SegmentSkipped": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
|
|
130
|
-
/**
|
|
131
|
-
* SPONSORBLOCK-PLUGIN EVENT
|
|
132
|
-
* Emitted when a specific Chapter starts playing
|
|
133
|
-
* @link https://github.com/topi314/Sponsorblock-Plugin#chapterstarted
|
|
134
|
-
* @event Manager#trackError
|
|
135
|
-
*/
|
|
136
|
-
"ChapterStarted": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
|
|
137
|
-
/**
|
|
138
|
-
* SPONSORBLOCK-PLUGIN EVENT
|
|
139
|
-
* Emitted when Chapters are loaded
|
|
140
|
-
* @link https://github.com/topi314/Sponsorblock-Plugin#chaptersloaded
|
|
141
|
-
* @event Manager#trackError
|
|
142
|
-
*/
|
|
143
|
-
"ChaptersLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
|
|
144
|
-
/**
|
|
145
|
-
* Lavalink-Client Debug Event
|
|
146
|
-
* Emitted for several erros, and logs within lavalink-client, if managerOptions.advancedOptions.enableDebugEvents is true
|
|
147
|
-
* Useful for debugging the lavalink-client
|
|
148
|
-
*
|
|
149
|
-
* @event Manager#debug
|
|
150
|
-
*/
|
|
151
|
-
"debug": (eventKey: DebugEvents, eventData: {
|
|
152
|
-
message: string;
|
|
153
|
-
state: "log" | "warn" | "error";
|
|
154
|
-
error?: Error | string;
|
|
155
|
-
functionLayer: string;
|
|
156
|
-
}) => void;
|
|
157
|
-
/**
|
|
158
|
-
* Emitted when a Lyrics line is received
|
|
159
|
-
* @link https://github.com/topi314/LavaLyrics
|
|
160
|
-
* @event Manager#LyricsLine
|
|
161
|
-
*/
|
|
162
|
-
"LyricsLine": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
|
|
163
|
-
/**
|
|
164
|
-
* Emitted when a Lyrics is found
|
|
165
|
-
* @link https://github.com/topi314/LavaLyrics
|
|
166
|
-
* @event Manager#LyricsFound
|
|
167
|
-
*/
|
|
168
|
-
"LyricsFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
|
|
169
|
-
/**
|
|
170
|
-
* Emitted when a Lyrics is not found
|
|
171
|
-
* @link https://github.com/topi314/LavaLyrics
|
|
172
|
-
* @event Manager#LyricsNotFound
|
|
173
|
-
*/
|
|
174
|
-
"LyricsNotFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
|
|
175
|
-
"playerResumed": (player: Player, track: Track | UnresolvedTrack | null) => void;
|
|
176
|
-
"playerPaused": (player: Player, track: Track | UnresolvedTrack | null) => void;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* The Bot client Options needed for the manager
|
|
180
|
-
*/
|
|
181
|
-
export interface BotClientOptions {
|
|
182
|
-
/** Bot Client Id */
|
|
183
|
-
id: string;
|
|
184
|
-
/** Bot Client Username */
|
|
185
|
-
username?: string;
|
|
186
|
-
/** So users can pass entire objects / classes */
|
|
187
|
-
[x: string | number | symbol]: unknown;
|
|
188
|
-
}
|
|
189
|
-
/** Sub Manager Options, for player specific things */
|
|
190
|
-
export interface ManagerPlayerOptions {
|
|
191
|
-
/** If the Lavalink Volume should be decremented by x number */
|
|
192
|
-
volumeDecrementer?: number;
|
|
193
|
-
/** How often it should update the the player Position */
|
|
194
|
-
clientBasedPositionUpdateInterval?: number;
|
|
195
|
-
/** What should be used as a searchPlatform, if no source was provided during the query */
|
|
196
|
-
defaultSearchPlatform?: SearchPlatform;
|
|
197
|
-
/** Applies the volume via a filter, not via the lavalink volume transformer */
|
|
198
|
-
applyVolumeAsFilter?: boolean;
|
|
199
|
-
/** Transforms the saved data of a requested user */
|
|
200
|
-
requesterTransformer?: (requester: unknown) => unknown;
|
|
201
|
-
/** What lavalink-client should do when the player reconnects */
|
|
202
|
-
onDisconnect?: {
|
|
203
|
-
/** Try to reconnect? -> If fails -> Destroy */
|
|
204
|
-
autoReconnect?: boolean;
|
|
205
|
-
/** Only try to reconnect if there are tracks in the queue */
|
|
206
|
-
autoReconnectOnlyWithTracks?: boolean;
|
|
207
|
-
/** Instantly destroy player (overrides autoReconnect) | Don't provide == disable feature*/
|
|
208
|
-
destroyPlayer?: boolean;
|
|
209
|
-
};
|
|
210
|
-
/** Minimum time to play the song before autoPlayFunction is executed (prevents error spamming) Set to 0 to disable it @default 10000 */
|
|
211
|
-
minAutoPlayMs?: number;
|
|
212
|
-
/** Allows you to declare how many tracks are allowed to error/stuck within a time-frame before player is destroyed @default "{threshold: 35000, maxAmount: 3 }" */
|
|
213
|
-
maxErrorsPerTime?: {
|
|
214
|
-
/** The threshold time to count errors (recommended is 35s) */
|
|
215
|
-
threshold: number;
|
|
216
|
-
/** The max amount of errors within the threshold time which are allowed before destroying the player (when errors > maxAmount -> player.destroy()) */
|
|
217
|
-
maxAmount: number;
|
|
218
|
-
};
|
|
219
|
-
onEmptyQueue?: {
|
|
220
|
-
/** Get's executed onEmptyQueue -> You can do any track queue previous transformations, if you add a track to the queue -> it will play it, if not queueEnd will execute! */
|
|
221
|
-
autoPlayFunction?: (player: Player, lastPlayedTrack: Track) => Promise<void>;
|
|
222
|
-
destroyAfterMs?: number;
|
|
223
|
-
};
|
|
224
|
-
useUnresolvedData?: boolean;
|
|
225
|
-
}
|
|
226
|
-
/** Manager Options used to create the manager */
|
|
227
|
-
export interface ManagerOptions {
|
|
228
|
-
/** The Node Options, for all Nodes! (on init) */
|
|
229
|
-
nodes: LavalinkNodeOptions[];
|
|
230
|
-
/** @async The Function to send the voice connection changes from Lavalink to Discord */
|
|
231
|
-
sendToShard: (guildId: string, payload: GuildShardPayload) => void;
|
|
232
|
-
/** The Bot Client's Data for Authorization */
|
|
233
|
-
client?: BotClientOptions;
|
|
234
|
-
/** QueueOptions for all Queues */
|
|
235
|
-
queueOptions?: ManagerQueueOptions;
|
|
236
|
-
/** PlayerOptions for all Players */
|
|
237
|
-
playerOptions?: ManagerPlayerOptions;
|
|
238
|
-
/** If it should skip to the next Track on TrackEnd / TrackError etc. events */
|
|
239
|
-
autoSkip?: boolean;
|
|
240
|
-
/** If it should skip to the next Track if track.resolve errors while trying to play a track. */
|
|
241
|
-
autoSkipOnResolveError?: boolean;
|
|
242
|
-
/** If it should emit only new (unique) songs and not when a looping track (or similar) is plaid, default false */
|
|
243
|
-
emitNewSongsOnly?: boolean;
|
|
244
|
-
/** Only allow link requests with links either matching some of that regExp or including some of that string */
|
|
245
|
-
linksWhitelist?: (RegExp | string)[];
|
|
246
|
-
/** Never allow link requests with links either matching some of that regExp or including some of that string (doesn't even allow if it's whitelisted) */
|
|
247
|
-
linksBlacklist?: (RegExp | string)[];
|
|
248
|
-
/** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
|
|
249
|
-
linksAllowed?: boolean;
|
|
250
|
-
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
251
|
-
advancedOptions?: {
|
|
252
|
-
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
253
|
-
maxFilterFixDuration?: number;
|
|
254
|
-
/** Enable Debug event */
|
|
255
|
-
enableDebugEvents?: boolean;
|
|
256
|
-
/** optional */
|
|
257
|
-
debugOptions?: {
|
|
258
|
-
/** For logging custom searches */
|
|
259
|
-
logCustomSearches?: boolean;
|
|
260
|
-
/** logs for debugging the "no-Audio" playing error */
|
|
261
|
-
noAudio?: boolean;
|
|
262
|
-
/** For Logging the Destroy function */
|
|
263
|
-
playerDestroy?: {
|
|
264
|
-
/** To show the debug reason at all times. */
|
|
265
|
-
debugLog?: boolean;
|
|
266
|
-
/** If you get 'Error: Use Player#destroy("reason") not LavalinkManager#deletePlayer() to stop the Player' put it on true */
|
|
267
|
-
dontThrowError?: boolean;
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
}
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import type internal from "stream";
|
|
2
|
-
import type { LavalinkNode } from "../Node";
|
|
3
|
-
import type { DestroyReasonsType } from "./Player";
|
|
4
|
-
import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils";
|
|
5
|
-
import type { PluginInfo } from "./Track";
|
|
6
|
-
/** Ability to manipulate fetch requests */
|
|
7
|
-
export type ModifyRequest = (options: RequestInit & {
|
|
8
|
-
path: string;
|
|
9
|
-
extraQueryUrlParams?: URLSearchParams;
|
|
10
|
-
}) => void;
|
|
11
|
-
export type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
|
|
12
|
-
/**
|
|
13
|
-
* Node Options for creating a lavalink node
|
|
14
|
-
*/
|
|
15
|
-
export interface LavalinkNodeOptions {
|
|
16
|
-
/** The Lavalink Server-Ip / Domain-URL */
|
|
17
|
-
host: string;
|
|
18
|
-
/** The Lavalink Connection Port */
|
|
19
|
-
port: number;
|
|
20
|
-
/** The Lavalink Password / Authorization-Key */
|
|
21
|
-
authorization: string;
|
|
22
|
-
/** Does the Server use ssl (https) */
|
|
23
|
-
secure?: boolean;
|
|
24
|
-
/** RESUME THE PLAYER? by providing a sessionid on the node-creation */
|
|
25
|
-
sessionId?: string;
|
|
26
|
-
/** Add a Custom ID to the node, for later use */
|
|
27
|
-
id?: string;
|
|
28
|
-
/** Voice Regions of this Node */
|
|
29
|
-
regions?: string[];
|
|
30
|
-
/** The retryAmount for the node. */
|
|
31
|
-
retryAmount?: number;
|
|
32
|
-
/** The retryDelay for the node. */
|
|
33
|
-
retryDelay?: number;
|
|
34
|
-
/** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
|
|
35
|
-
requestSignalTimeoutMS?: number;
|
|
36
|
-
/** Close on error */
|
|
37
|
-
closeOnError?: boolean;
|
|
38
|
-
/** Heartbeat interval , set to <= 0 to disable heartbeat system */
|
|
39
|
-
heartBeatInterval?: 30000;
|
|
40
|
-
/** Recommended, to check wether the client is still connected or not on the stats endpoint */
|
|
41
|
-
enablePingOnStatsCheck?: boolean;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Memory Stats object from lavalink
|
|
45
|
-
*/
|
|
46
|
-
export interface MemoryStats {
|
|
47
|
-
/** The free memory of the allocated amount. */
|
|
48
|
-
free: number;
|
|
49
|
-
/** The used memory of the allocated amount. */
|
|
50
|
-
used: number;
|
|
51
|
-
/** The total allocated memory. */
|
|
52
|
-
allocated: number;
|
|
53
|
-
/** The reservable memory. */
|
|
54
|
-
reservable: number;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* CPU Stats object from lavalink
|
|
58
|
-
*/
|
|
59
|
-
export interface CPUStats {
|
|
60
|
-
/** The core amount the host machine has. */
|
|
61
|
-
cores: number;
|
|
62
|
-
/** The system load. */
|
|
63
|
-
systemLoad: number;
|
|
64
|
-
/** The lavalink load. */
|
|
65
|
-
lavalinkLoad: number;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* FrameStats Object from lavalink
|
|
69
|
-
*/
|
|
70
|
-
export interface FrameStats {
|
|
71
|
-
/** The amount of sent frames. */
|
|
72
|
-
sent?: number;
|
|
73
|
-
/** The amount of nulled frames. */
|
|
74
|
-
nulled?: number;
|
|
75
|
-
/** The amount of deficit frames. */
|
|
76
|
-
deficit?: number;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* BaseNodeStats object from Lavalink
|
|
80
|
-
*/
|
|
81
|
-
export interface BaseNodeStats {
|
|
82
|
-
/** The amount of players on the node. */
|
|
83
|
-
players: number;
|
|
84
|
-
/** The amount of playing players on the node. */
|
|
85
|
-
playingPlayers: number;
|
|
86
|
-
/** The uptime for the node. */
|
|
87
|
-
uptime: number;
|
|
88
|
-
/** The memory stats for the node. */
|
|
89
|
-
memory: MemoryStats;
|
|
90
|
-
/** The cpu stats for the node. */
|
|
91
|
-
cpu: CPUStats;
|
|
92
|
-
/** The frame stats for the node. */
|
|
93
|
-
frameStats: FrameStats;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Interface for nodeStats from lavalink
|
|
97
|
-
*/
|
|
98
|
-
export interface NodeStats extends BaseNodeStats {
|
|
99
|
-
/** The frame stats for the node. */
|
|
100
|
-
frameStats: FrameStats;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Entire lavalink information object from lavalink
|
|
104
|
-
*/
|
|
105
|
-
export interface LavalinkInfo {
|
|
106
|
-
/** The version of this Lavalink server */
|
|
107
|
-
version: VersionObject;
|
|
108
|
-
/** The millisecond unix timestamp when this Lavalink jar was built */
|
|
109
|
-
buildTime: number;
|
|
110
|
-
/** The git information of this Lavalink server */
|
|
111
|
-
git: GitObject;
|
|
112
|
-
/** The JVM version this Lavalink server runs on */
|
|
113
|
-
jvm: string;
|
|
114
|
-
/** The Lavaplayer version being used by this server */
|
|
115
|
-
lavaplayer: string;
|
|
116
|
-
/** The enabled source managers for this server */
|
|
117
|
-
sourceManagers: string[];
|
|
118
|
-
/** The enabled filters for this server */
|
|
119
|
-
filters: string[];
|
|
120
|
-
/** The enabled plugins for this server */
|
|
121
|
-
plugins: PluginObject[];
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Lavalink's version object from lavalink
|
|
125
|
-
*/
|
|
126
|
-
export interface VersionObject {
|
|
127
|
-
/** The full version string of this Lavalink server */
|
|
128
|
-
semver: string;
|
|
129
|
-
/** The major version of this Lavalink server */
|
|
130
|
-
major: number;
|
|
131
|
-
/** The minor version of this Lavalink server */
|
|
132
|
-
minor: number;
|
|
133
|
-
/** The patch version of this Lavalink server */
|
|
134
|
-
patch: internal;
|
|
135
|
-
/** The pre-release version according to semver as a . separated list of identifiers */
|
|
136
|
-
preRelease?: string;
|
|
137
|
-
/** The build metadata according to semver as a . separated list of identifiers */
|
|
138
|
-
build?: string;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Git information object from lavalink
|
|
142
|
-
*/
|
|
143
|
-
export interface GitObject {
|
|
144
|
-
/** The branch this Lavalink server was built on */
|
|
145
|
-
branch: string;
|
|
146
|
-
/** The commit this Lavalink server was built on */
|
|
147
|
-
commit: string;
|
|
148
|
-
/** The millisecond unix timestamp for when the commit was created */
|
|
149
|
-
commitTime: string;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Lavalink's plugins object from lavalink's plugin
|
|
153
|
-
*/
|
|
154
|
-
export interface PluginObject {
|
|
155
|
-
/** The name of the plugin */
|
|
156
|
-
name: string;
|
|
157
|
-
/** The version of the plugin */
|
|
158
|
-
version: string;
|
|
159
|
-
}
|
|
160
|
-
export interface LyricsResult {
|
|
161
|
-
/**The name of the source */
|
|
162
|
-
sourceName: string;
|
|
163
|
-
/**The name of the provider */
|
|
164
|
-
provider: string;
|
|
165
|
-
/**The result text */
|
|
166
|
-
text: string | null;
|
|
167
|
-
/**The lyrics lines */
|
|
168
|
-
lines: LyricsLine[];
|
|
169
|
-
/**Information about the plugin */
|
|
170
|
-
plugin: PluginInfo;
|
|
171
|
-
}
|
|
172
|
-
export interface LyricsLine {
|
|
173
|
-
/**The millisecond timestamp */
|
|
174
|
-
timestamp: number;
|
|
175
|
-
/**The line duration in milliseconds */
|
|
176
|
-
duration: number | null;
|
|
177
|
-
/**The line text */
|
|
178
|
-
line: string;
|
|
179
|
-
/**Information about the plugin */
|
|
180
|
-
plugin: PluginInfo;
|
|
181
|
-
}
|
|
182
|
-
export type LavalinkNodeIdentifier = string;
|
|
183
|
-
export interface NodeManagerEvents {
|
|
184
|
-
/**
|
|
185
|
-
* Emitted when a Node is created.
|
|
186
|
-
* @event Manager.nodeManager#create
|
|
187
|
-
*/
|
|
188
|
-
"create": (node: LavalinkNode) => void;
|
|
189
|
-
/**
|
|
190
|
-
* Emitted when a Node is destroyed.
|
|
191
|
-
* @event Manager.nodeManager#destroy
|
|
192
|
-
*/
|
|
193
|
-
"destroy": (node: LavalinkNode, destroyReason?: DestroyReasonsType) => void;
|
|
194
|
-
/**
|
|
195
|
-
* Emitted when a Node is connected.
|
|
196
|
-
* @event Manager.nodeManager#connect
|
|
197
|
-
*/
|
|
198
|
-
"connect": (node: LavalinkNode) => void;
|
|
199
|
-
/**
|
|
200
|
-
* Emitted when a Node is reconnecting.
|
|
201
|
-
* @event Manager.nodeManager#reconnecting
|
|
202
|
-
*/
|
|
203
|
-
"reconnecting": (node: LavalinkNode) => void;
|
|
204
|
-
/**
|
|
205
|
-
* Emitted When a node starts to reconnect (if you have a reconnection delay, the reconnecting event will be emitted after the retryDelay.)
|
|
206
|
-
* Useful to check wether the internal node reconnect system works or not
|
|
207
|
-
* @event Manager.nodeManager#reconnectinprogress
|
|
208
|
-
*/
|
|
209
|
-
"reconnectinprogress": (node: LavalinkNode) => void;
|
|
210
|
-
/**
|
|
211
|
-
* Emitted when a Node is disconnects.
|
|
212
|
-
* @event Manager.nodeManager#disconnect
|
|
213
|
-
*/
|
|
214
|
-
"disconnect": (node: LavalinkNode, reason: {
|
|
215
|
-
code?: number;
|
|
216
|
-
reason?: string;
|
|
217
|
-
}) => void;
|
|
218
|
-
/**
|
|
219
|
-
* Emitted when a Node is error.
|
|
220
|
-
* @event Manager.nodeManager#error
|
|
221
|
-
*/
|
|
222
|
-
"error": (node: LavalinkNode, error: Error, payload?: unknown) => void;
|
|
223
|
-
/**
|
|
224
|
-
* Emits every single Node event.
|
|
225
|
-
* @event Manager.nodeManager#raw
|
|
226
|
-
*/
|
|
227
|
-
"raw": (node: LavalinkNode, payload: unknown) => void;
|
|
228
|
-
/**
|
|
229
|
-
* Emits when the node connects resumed. You then need to create all players within this event for your usecase.
|
|
230
|
-
* 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
|
|
231
|
-
* @event Manager.nodeManager#nodeResumed
|
|
232
|
-
*/
|
|
233
|
-
"resumed": (node: LavalinkNode, payload: {
|
|
234
|
-
resumed: true;
|
|
235
|
-
sessionId: string;
|
|
236
|
-
op: "ready";
|
|
237
|
-
}, players: LavalinkPlayer[] | InvalidLavalinkRestRequest) => void;
|
|
238
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type { DestroyReasons, DisconnectReasons } from "../Constants";
|
|
2
|
-
import type { LavalinkNode } from "../Node";
|
|
3
|
-
import type { EQBand, FilterData, LavalinkFilterData } from "./Filters";
|
|
4
|
-
import type { StoredQueue } from "./Queue";
|
|
5
|
-
import type { Track, UnresolvedTrack } from "./Track";
|
|
6
|
-
import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils";
|
|
7
|
-
export type DestroyReasonsType = keyof typeof DestroyReasons | string;
|
|
8
|
-
export type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
|
|
9
|
-
export interface PlayerJson {
|
|
10
|
-
/** Guild Id where the player was playing in */
|
|
11
|
-
guildId: string;
|
|
12
|
-
/** Options provided to the player */
|
|
13
|
-
options: PlayerOptions;
|
|
14
|
-
/** Voice Channel Id the player was playing in */
|
|
15
|
-
voiceChannelId: string;
|
|
16
|
-
/** Text Channel Id the player was synced to */
|
|
17
|
-
textChannelId?: string;
|
|
18
|
-
/** Position the player was at */
|
|
19
|
-
position: number;
|
|
20
|
-
/** Lavalink's position the player was at */
|
|
21
|
-
lastPosition: number;
|
|
22
|
-
/** Last time the position was sent from lavalink */
|
|
23
|
-
lastPositionChange: number;
|
|
24
|
-
/** Volume in % from the player (without volumeDecrementer) */
|
|
25
|
-
volume: number;
|
|
26
|
-
/** Real Volume used in lavalink (with the volumeDecrementer) */
|
|
27
|
-
lavalinkVolume: number;
|
|
28
|
-
/** The repeatmode from the player */
|
|
29
|
-
repeatMode: RepeatMode;
|
|
30
|
-
/** Pause state */
|
|
31
|
-
paused: boolean;
|
|
32
|
-
/** Wether the player was playing or not */
|
|
33
|
-
playing: boolean;
|
|
34
|
-
/** When the player was created */
|
|
35
|
-
createdTimeStamp?: number;
|
|
36
|
-
/** All current used fitlers Data */
|
|
37
|
-
filters: FilterData;
|
|
38
|
-
/** The player's ping object */
|
|
39
|
-
ping: {
|
|
40
|
-
/** Ping to the voice websocket server */
|
|
41
|
-
ws: number;
|
|
42
|
-
/** Avg. calc. Ping to the lavalink server */
|
|
43
|
-
lavalink: number;
|
|
44
|
-
};
|
|
45
|
-
/** Equalizer Bands used in lavalink */
|
|
46
|
-
equalizer: EQBand[];
|
|
47
|
-
/** The Id of the last used node */
|
|
48
|
-
nodeId?: string;
|
|
49
|
-
/** The SessionId of the node */
|
|
50
|
-
nodeSessionId?: string;
|
|
51
|
-
/** The stored queue */
|
|
52
|
-
queue?: StoredQueue;
|
|
53
|
-
}
|
|
54
|
-
export type RepeatMode = "queue" | "track" | "off";
|
|
55
|
-
export interface PlayerOptions {
|
|
56
|
-
/** Guild id of the player */
|
|
57
|
-
guildId: string;
|
|
58
|
-
/** The Voice Channel Id */
|
|
59
|
-
voiceChannelId: string;
|
|
60
|
-
/** The Text Channel Id of the Player */
|
|
61
|
-
textChannelId?: string;
|
|
62
|
-
/** instantly change volume with the one play request */
|
|
63
|
-
volume?: number;
|
|
64
|
-
/** VC Region for node selections */
|
|
65
|
-
vcRegion?: string;
|
|
66
|
-
/** if it should join deafened */
|
|
67
|
-
selfDeaf?: boolean;
|
|
68
|
-
/** If it should join muted */
|
|
69
|
-
selfMute?: boolean;
|
|
70
|
-
/** If it should use a specific lavalink node */
|
|
71
|
-
node?: LavalinkNode | string;
|
|
72
|
-
/** If when applying filters, it should use the insta apply filters fix */
|
|
73
|
-
instaUpdateFiltersFix?: boolean;
|
|
74
|
-
/** If a volume should be applied via filters instead of lavalink-volume */
|
|
75
|
-
applyVolumeAsFilter?: boolean;
|
|
76
|
-
/** Custom Data for the player get/set datastorage */
|
|
77
|
-
customData?: anyObject;
|
|
78
|
-
}
|
|
79
|
-
export type anyObject = {
|
|
80
|
-
[key: string | number]: string | number | null | anyObject;
|
|
81
|
-
};
|
|
82
|
-
export interface BasePlayOptions {
|
|
83
|
-
/** The position to start the track. */
|
|
84
|
-
position?: number;
|
|
85
|
-
/** The position to end the track. */
|
|
86
|
-
endTime?: number;
|
|
87
|
-
/** If to start "paused" */
|
|
88
|
-
paused?: boolean;
|
|
89
|
-
/** The Volume to start with */
|
|
90
|
-
volume?: number;
|
|
91
|
-
/** The Lavalink Filters to use | only with the new REST API */
|
|
92
|
-
filters?: Partial<LavalinkFilterData>;
|
|
93
|
-
/** Voice Update for Lavalink */
|
|
94
|
-
voice?: LavalinkPlayerVoiceOptions;
|
|
95
|
-
}
|
|
96
|
-
export interface LavalinkPlayOptions extends BasePlayOptions {
|
|
97
|
-
/** Which Track to play | don't provide, if it should pick from the Queue */
|
|
98
|
-
track?: {
|
|
99
|
-
/** The track encoded base64 string to use instead of the one from the queue system */
|
|
100
|
-
encoded?: Base64 | null;
|
|
101
|
-
/** The identifier of the track to use */
|
|
102
|
-
identifier?: string;
|
|
103
|
-
/** Custom User Data for the track to provide, will then be on the userData object from the track */
|
|
104
|
-
userData?: anyObject;
|
|
105
|
-
/** The Track requester for when u provide encodedTrack / identifer */
|
|
106
|
-
requester?: unknown;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
export interface PlayOptions extends LavalinkPlayOptions {
|
|
110
|
-
/** Whether to not replace the track if a play payload is sent. */
|
|
111
|
-
noReplace?: boolean;
|
|
112
|
-
/** Adds track on queue and skips to it */
|
|
113
|
-
clientTrack?: Track | UnresolvedTrack;
|
|
114
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Track, UnresolvedTrack } from "./Track";
|
|
2
|
-
export interface StoredQueue {
|
|
3
|
-
current: Track | null;
|
|
4
|
-
previous: Track[];
|
|
5
|
-
tracks: (Track | UnresolvedTrack)[];
|
|
6
|
-
}
|
|
7
|
-
export interface QueueStoreManager {
|
|
8
|
-
/** @async get a Value (MUST RETURN UNPARSED!) */
|
|
9
|
-
get: (guildId: string) => Promise<StoredQueue | string>;
|
|
10
|
-
/** @async Set a value inside a guildId (MUST BE UNPARSED) */
|
|
11
|
-
set: (guildId: string, value: StoredQueue | string) => Promise<void | boolean>;
|
|
12
|
-
/** @async Delete a Database Value based of it's guildId */
|
|
13
|
-
delete: (guildId: string) => Promise<void | boolean>;
|
|
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: StoredQueue | string) => Promise<StoredQueue | string>;
|
|
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: StoredQueue | string) => Promise<Partial<StoredQueue>>;
|
|
18
|
-
}
|
|
19
|
-
export interface ManagerQueueOptions {
|
|
20
|
-
/** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
|
|
21
|
-
maxPreviousTracks?: number;
|
|
22
|
-
/** Custom Queue Store option */
|
|
23
|
-
queueStore?: QueueStoreManager;
|
|
24
|
-
/** Custom Queue Watcher class */
|
|
25
|
-
queueChangesWatcher?: QueueChangesWatcher;
|
|
26
|
-
}
|
|
27
|
-
export interface QueueChangesWatcher {
|
|
28
|
-
/** get a Value (MUST RETURN UNPARSED!) */
|
|
29
|
-
tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
|
|
30
|
-
/** Set a value inside a guildId (MUST BE UNPARSED) */
|
|
31
|
-
tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number | number[], oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
|
|
32
|
-
/** Set a value inside a guildId (MUST BE UNPARSED) */
|
|
33
|
-
shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
|
|
34
|
-
}
|