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
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3036 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import internal from 'stream';
|
|
3
|
+
|
|
4
|
+
/** The Audio Outputs type */
|
|
5
|
+
type AudioOutputs = "mono" | "stereo" | "left" | "right";
|
|
6
|
+
/** The "active" / "disabled" Player Filters */
|
|
7
|
+
interface PlayerFilters {
|
|
8
|
+
/** Sets nightcore to false, and vaporwave to false */
|
|
9
|
+
custom: boolean;
|
|
10
|
+
/** Sets custom to false, and vaporwave to false */
|
|
11
|
+
nightcore: boolean;
|
|
12
|
+
/** Sets custom to false, and nightcore to false */
|
|
13
|
+
vaporwave: boolean;
|
|
14
|
+
/** If rotation filter is enabled / not */
|
|
15
|
+
rotation: boolean;
|
|
16
|
+
/** if karaoke filter is enabled / not */
|
|
17
|
+
karaoke: boolean;
|
|
18
|
+
/** if tremolo filter is enabled / not */
|
|
19
|
+
tremolo: boolean;
|
|
20
|
+
/** if vibrato filter is enabled / not */
|
|
21
|
+
vibrato: boolean;
|
|
22
|
+
lowPass: boolean;
|
|
23
|
+
/** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
|
|
24
|
+
audioOutput: AudioOutputs;
|
|
25
|
+
/** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
|
|
26
|
+
volume: boolean;
|
|
27
|
+
/** Filters for the Lavalink Filter Plugin */
|
|
28
|
+
lavalinkFilterPlugin: {
|
|
29
|
+
/** if echo filter is enabled / not */
|
|
30
|
+
echo: boolean;
|
|
31
|
+
/** if reverb filter is enabled / not */
|
|
32
|
+
reverb: boolean;
|
|
33
|
+
};
|
|
34
|
+
lavalinkLavaDspxPlugin: {
|
|
35
|
+
/** if lowPass filter is enabled / not */
|
|
36
|
+
lowPass: boolean;
|
|
37
|
+
/** if highPass filter is enabled / not */
|
|
38
|
+
highPass: boolean;
|
|
39
|
+
/** if normalization filter is enabled / not */
|
|
40
|
+
normalization: boolean;
|
|
41
|
+
/** if echo filter is enabled / not */
|
|
42
|
+
echo: boolean;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* There are 15 bands (0-14) that can be changed.
|
|
47
|
+
* "gain" is the multiplier for the given band.
|
|
48
|
+
* The default value is 0.
|
|
49
|
+
* Valid values range from -0.25 to 1.0, where -0.25 means the given band is completely muted, and 0.25 means it is doubled.
|
|
50
|
+
* Modifying the gain could also change the volume of the output.
|
|
51
|
+
*/
|
|
52
|
+
interface EQBand {
|
|
53
|
+
/** On what band position (0-14) it should work */
|
|
54
|
+
band: IntegerNumber | number;
|
|
55
|
+
/** The gain (-0.25 to 1.0) */
|
|
56
|
+
gain: FloatNumber | number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Uses equalization to eliminate part of a band, usually targeting vocals.
|
|
60
|
+
*/
|
|
61
|
+
interface KaraokeFilter {
|
|
62
|
+
/** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
63
|
+
level?: number;
|
|
64
|
+
/** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
65
|
+
monoLevel?: number;
|
|
66
|
+
/** The filter band (in Hz) */
|
|
67
|
+
filterBand?: number;
|
|
68
|
+
/** The filter width */
|
|
69
|
+
filterWidth?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Changes the speed, pitch, and rate
|
|
73
|
+
*/
|
|
74
|
+
interface TimescaleFilter {
|
|
75
|
+
/** The playback speed 0.0 ≤ x */
|
|
76
|
+
speed?: number;
|
|
77
|
+
/** The pitch 0.0 ≤ x */
|
|
78
|
+
pitch?: number;
|
|
79
|
+
/** The rate 0.0 ≤ x */
|
|
80
|
+
rate?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Uses amplification to create a shuddering effect, where the volume quickly oscillates.
|
|
84
|
+
* Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
|
|
85
|
+
*/
|
|
86
|
+
interface TremoloFilter {
|
|
87
|
+
/** The frequency 0.0 < x */
|
|
88
|
+
frequency?: number;
|
|
89
|
+
/** The tremolo depth 0.0 < x ≤ 1.0 */
|
|
90
|
+
depth?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
|
|
94
|
+
*/
|
|
95
|
+
interface VibratoFilter {
|
|
96
|
+
/** The frequency 0.0 < x ≤ 14.0 */
|
|
97
|
+
frequency?: number;
|
|
98
|
+
/** The vibrato depth 0.0 < x ≤ 1.0 */
|
|
99
|
+
depth?: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
|
|
103
|
+
* It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
|
|
104
|
+
*/
|
|
105
|
+
interface RotationFilter {
|
|
106
|
+
/** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
|
|
107
|
+
rotationHz?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Distortion effect. It can generate some pretty unique audio effects.
|
|
111
|
+
*/
|
|
112
|
+
interface DistortionFilter {
|
|
113
|
+
sinOffset?: number;
|
|
114
|
+
sinScale?: number;
|
|
115
|
+
cosOffset?: number;
|
|
116
|
+
cosScale?: number;
|
|
117
|
+
tanOffset?: number;
|
|
118
|
+
tanScale?: number;
|
|
119
|
+
offset?: number;
|
|
120
|
+
scale?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
|
|
124
|
+
* With the defaults, both channels are kept independent of each other.
|
|
125
|
+
* Setting all factors to 0.5 means both channels get the same audio.
|
|
126
|
+
*/
|
|
127
|
+
interface ChannelMixFilter {
|
|
128
|
+
/** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
129
|
+
leftToLeft?: number;
|
|
130
|
+
/** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
131
|
+
leftToRight?: number;
|
|
132
|
+
/** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
133
|
+
rightToLeft?: number;
|
|
134
|
+
/** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
135
|
+
rightToRight?: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
|
|
139
|
+
* Any smoothing values equal to or less than 1.0 will disable the filter.
|
|
140
|
+
*/
|
|
141
|
+
interface LowPassFilter {
|
|
142
|
+
/** The smoothing factor (1.0 < x) */
|
|
143
|
+
smoothing?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Filter Data stored in the Client and partially sent to Lavalink
|
|
147
|
+
*/
|
|
148
|
+
interface FilterData {
|
|
149
|
+
volume?: number;
|
|
150
|
+
karaoke?: KaraokeFilter;
|
|
151
|
+
timescale?: TimescaleFilter;
|
|
152
|
+
tremolo?: TremoloFilter;
|
|
153
|
+
vibrato?: VibratoFilter;
|
|
154
|
+
rotation?: RotationFilter;
|
|
155
|
+
distortion?: DistortionFilter;
|
|
156
|
+
channelMix?: ChannelMixFilter;
|
|
157
|
+
lowPass?: LowPassFilter;
|
|
158
|
+
pluginFilters?: {
|
|
159
|
+
"lavalink-filter-plugin"?: {
|
|
160
|
+
"echo"?: {
|
|
161
|
+
delay?: number;
|
|
162
|
+
decay?: number;
|
|
163
|
+
};
|
|
164
|
+
"reverb"?: {
|
|
165
|
+
delays?: number[];
|
|
166
|
+
gains?: number[];
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
"high-pass"?: {
|
|
170
|
+
cutoffFrequency?: number;
|
|
171
|
+
boostFactor?: number;
|
|
172
|
+
};
|
|
173
|
+
"low-pass"?: {
|
|
174
|
+
cutoffFrequency?: number;
|
|
175
|
+
boostFactor?: number;
|
|
176
|
+
};
|
|
177
|
+
normalization?: {
|
|
178
|
+
maxAmplitude?: number;
|
|
179
|
+
adaptive?: boolean;
|
|
180
|
+
};
|
|
181
|
+
echo?: {
|
|
182
|
+
echoLength?: number;
|
|
183
|
+
decay?: number;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Actual Filter Data sent to Lavalink
|
|
189
|
+
*/
|
|
190
|
+
interface LavalinkFilterData extends FilterData {
|
|
191
|
+
equalizer?: EQBand[];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
declare enum DebugEvents {
|
|
195
|
+
SetSponsorBlock = "SetSponsorBlock",
|
|
196
|
+
DeleteSponsorBlock = "DeleteSponsorBlock",
|
|
197
|
+
TrackEndReplaced = "TrackEndReplaced",
|
|
198
|
+
AutoplayExecution = "AutoplayExecution",
|
|
199
|
+
AutoplayNoSongsAdded = "AutoplayNoSongsAdded",
|
|
200
|
+
AutoplayThresholdSpamLimiter = "AutoplayThresholdSpamLimiter",
|
|
201
|
+
TriggerQueueEmptyInterval = "TriggerQueueEmptyInterval",
|
|
202
|
+
QueueEnded = "QueueEnded",
|
|
203
|
+
TrackStartNewSongsOnly = "TrackStartNewSongsOnly",
|
|
204
|
+
TrackStartNoTrack = "TrackStartNoTrack",
|
|
205
|
+
ResumingFetchingError = "ResumingFetchingError",
|
|
206
|
+
PlayerUpdateNoPlayer = "PlayerUpdateNoPlayer",
|
|
207
|
+
PlayerUpdateFilterFixApply = "PlayerUpdateFilterFixApply",
|
|
208
|
+
PlayerUpdateSuccess = "PlayerUpdateSuccess",
|
|
209
|
+
HeartBeatTriggered = "HeartBeatTriggered",
|
|
210
|
+
NoSocketOnDestroy = "NoSocketOnDestroy",
|
|
211
|
+
SocketTerminateHeartBeatTimeout = "SocketTerminateHeartBeatTimeout",
|
|
212
|
+
TryingConnectWhileConnected = "TryingConnectWhileConnected",
|
|
213
|
+
LavaSearchNothingFound = "LavaSearchNothingFound",
|
|
214
|
+
SearchNothingFound = "SearchNothingFound",
|
|
215
|
+
ValidatingBlacklistLinks = "ValidatingBlacklistLinks",
|
|
216
|
+
ValidatingWhitelistLinks = "ValidatingWhitelistLinks",
|
|
217
|
+
TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
|
|
218
|
+
TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime",
|
|
219
|
+
PlayerDestroyingSomewhereElse = "PlayerDestroyingSomewhereElse",
|
|
220
|
+
PlayerCreateNodeNotFound = "PlayerCreateNodeNotFound",
|
|
221
|
+
PlayerPlayQueueEmptyTimeoutClear = "PlayerPlayQueueEmptyTimeoutClear",
|
|
222
|
+
PlayerPlayWithTrackReplace = "PlayerPlayWithTrackReplace",
|
|
223
|
+
PlayerPlayUnresolvedTrack = "PlayerPlayUnresolvedTrack",
|
|
224
|
+
PlayerPlayUnresolvedTrackFailed = "PlayerPlayUnresolvedTrackFailed",
|
|
225
|
+
PlayerVolumeAsFilter = "PlayerVolumeAsFilter",
|
|
226
|
+
BandcampSearchLokalEngine = "BandcampSearchLokalEngine",
|
|
227
|
+
PlayerChangeNode = "PlayerChangeNode",
|
|
228
|
+
BuildTrackError = "BuildTrackError",
|
|
229
|
+
TransformRequesterFunctionFailed = "TransformRequesterFunctionFailed",
|
|
230
|
+
GetClosestTrackFailed = "GetClosestTrackFailed",
|
|
231
|
+
PlayerDeleteInsteadOfDestroy = "PlayerDeleteInsteadOfDestroy",
|
|
232
|
+
FailedToConnectToNodes = "FailedToConnectToNodes",
|
|
233
|
+
NoAudioDebug = "NoAudioDebug",
|
|
234
|
+
PlayerAutoReconnect = "PlayerAutoReconnect"
|
|
235
|
+
}
|
|
236
|
+
declare enum DestroyReasons {
|
|
237
|
+
QueueEmpty = "QueueEmpty",
|
|
238
|
+
NodeDestroy = "NodeDestroy",
|
|
239
|
+
NodeDeleted = "NodeDeleted",
|
|
240
|
+
LavalinkNoVoice = "LavalinkNoVoice",
|
|
241
|
+
NodeReconnectFail = "NodeReconnectFail",
|
|
242
|
+
Disconnected = "Disconnected",
|
|
243
|
+
PlayerReconnectFail = "PlayerReconnectFail",
|
|
244
|
+
PlayerChangeNodeFail = "PlayerChangeNodeFail",
|
|
245
|
+
PlayerChangeNodeFailNoEligibleNode = "PlayerChangeNodeFailNoEligibleNode",
|
|
246
|
+
ChannelDeleted = "ChannelDeleted",
|
|
247
|
+
DisconnectAllNodes = "DisconnectAllNodes",
|
|
248
|
+
ReconnectAllNodes = "ReconnectAllNodes",
|
|
249
|
+
TrackErrorMaxTracksErroredPerTime = "TrackErrorMaxTracksErroredPerTime",
|
|
250
|
+
TrackStuckMaxTracksErroredPerTime = "TrackStuckMaxTracksErroredPerTime"
|
|
251
|
+
}
|
|
252
|
+
declare enum DisconnectReasons {
|
|
253
|
+
Disconnected = "Disconnected",
|
|
254
|
+
DisconnectAllNodes = "DisconnectAllNodes"
|
|
255
|
+
}
|
|
256
|
+
declare const validSponsorBlocks: string[];
|
|
257
|
+
/** The audio Outputs Data map declaration */
|
|
258
|
+
declare const audioOutputsData: Record<AudioOutputs, ChannelMixFilter>;
|
|
259
|
+
declare const EQList: {
|
|
260
|
+
/** A Bassboost Equalizer, so high it distorts the audio */
|
|
261
|
+
BassboostEarrape: EQBand[];
|
|
262
|
+
/** A High and decent Bassboost Equalizer */
|
|
263
|
+
BassboostHigh: EQBand[];
|
|
264
|
+
/** A decent Bassboost Equalizer */
|
|
265
|
+
BassboostMedium: EQBand[];
|
|
266
|
+
/** A slight Bassboost Equalizer */
|
|
267
|
+
BassboostLow: EQBand[];
|
|
268
|
+
/** Makes the Music slightly "better" */
|
|
269
|
+
BetterMusic: EQBand[];
|
|
270
|
+
/** Makes the Music sound like rock music / sound rock music better */
|
|
271
|
+
Rock: EQBand[];
|
|
272
|
+
/** Makes the Music sound like Classic music / sound Classic music better */
|
|
273
|
+
Classic: EQBand[];
|
|
274
|
+
/** Makes the Music sound like Pop music / sound Pop music better */
|
|
275
|
+
Pop: EQBand[];
|
|
276
|
+
/** Makes the Music sound like Electronic music / sound Electronic music better */
|
|
277
|
+
Electronic: EQBand[];
|
|
278
|
+
/** Boosts all Bands slightly for louder and fuller sound */
|
|
279
|
+
FullSound: EQBand[];
|
|
280
|
+
/** Boosts basses + lower highs for a pro gaming sound */
|
|
281
|
+
Gaming: EQBand[];
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* The FilterManager for each player
|
|
286
|
+
*/
|
|
287
|
+
declare class FilterManager {
|
|
288
|
+
/** The Equalizer bands currently applied to the Lavalink Server */
|
|
289
|
+
equalizerBands: EQBand[];
|
|
290
|
+
/** Private Util for the instaFix Filters option */
|
|
291
|
+
filterUpdatedState: boolean;
|
|
292
|
+
/** All "Active" / "disabled" Player Filters */
|
|
293
|
+
filters: PlayerFilters;
|
|
294
|
+
/** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
|
|
295
|
+
data: FilterData;
|
|
296
|
+
/** The Player assigned to this Filter Manager */
|
|
297
|
+
player: Player;
|
|
298
|
+
/** The Constructor for the FilterManager */
|
|
299
|
+
constructor(player: Player);
|
|
300
|
+
/**
|
|
301
|
+
* Apply Player filters for lavalink filter sending data, if the filter is enabled / not
|
|
302
|
+
*/
|
|
303
|
+
applyPlayerFilters(): Promise<void>;
|
|
304
|
+
/**
|
|
305
|
+
* Checks if the filters are correctly stated (active / not-active)
|
|
306
|
+
* @param oldFilterTimescale
|
|
307
|
+
* @returns
|
|
308
|
+
*/
|
|
309
|
+
checkFiltersState(oldFilterTimescale?: Partial<TimescaleFilter>): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Reset all Filters
|
|
312
|
+
*/
|
|
313
|
+
resetFilters(): Promise<PlayerFilters>;
|
|
314
|
+
/**
|
|
315
|
+
* Set the Filter Volume
|
|
316
|
+
* @param volume
|
|
317
|
+
* @returns
|
|
318
|
+
*/
|
|
319
|
+
setVolume(volume: number): Promise<boolean>;
|
|
320
|
+
/**
|
|
321
|
+
* Set the AudioOutput Filter
|
|
322
|
+
* @param type
|
|
323
|
+
* @returns
|
|
324
|
+
*/
|
|
325
|
+
setAudioOutput(type: AudioOutputs): Promise<AudioOutputs>;
|
|
326
|
+
/**
|
|
327
|
+
* Set custom filter.timescale#speed . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
|
|
328
|
+
* @param speed
|
|
329
|
+
* @returns
|
|
330
|
+
*/
|
|
331
|
+
setSpeed(speed?: number): Promise<boolean>;
|
|
332
|
+
/**
|
|
333
|
+
* Set custom filter.timescale#pitch . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
|
|
334
|
+
* @param speed
|
|
335
|
+
* @returns
|
|
336
|
+
*/
|
|
337
|
+
setPitch(pitch?: number): Promise<boolean>;
|
|
338
|
+
/**
|
|
339
|
+
* Set custom filter.timescale#rate . This method disabled both: nightcore & vaporwave. use 1 to reset it to normal
|
|
340
|
+
* @param speed
|
|
341
|
+
* @returns
|
|
342
|
+
*/
|
|
343
|
+
setRate(rate?: number): Promise<boolean>;
|
|
344
|
+
/**
|
|
345
|
+
* Enables / Disables the rotation effect, (Optional: provide your Own Data)
|
|
346
|
+
* @param rotationHz
|
|
347
|
+
* @returns
|
|
348
|
+
*/
|
|
349
|
+
toggleRotation(rotationHz?: number): Promise<boolean>;
|
|
350
|
+
/**
|
|
351
|
+
* Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
|
|
352
|
+
* @param frequency
|
|
353
|
+
* @param depth
|
|
354
|
+
* @returns
|
|
355
|
+
*/
|
|
356
|
+
toggleVibrato(frequency?: number, depth?: number): Promise<boolean>;
|
|
357
|
+
/**
|
|
358
|
+
* Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
|
|
359
|
+
* @param frequency
|
|
360
|
+
* @param depth
|
|
361
|
+
* @returns
|
|
362
|
+
*/
|
|
363
|
+
toggleTremolo(frequency?: number, depth?: number): Promise<boolean>;
|
|
364
|
+
/**
|
|
365
|
+
* Enables / Disables the LowPass effect, (Optional: provide your Own Data)
|
|
366
|
+
* @param smoothing
|
|
367
|
+
* @returns
|
|
368
|
+
*/
|
|
369
|
+
toggleLowPass(smoothing?: number): Promise<boolean>;
|
|
370
|
+
lavalinkLavaDspxPlugin: {
|
|
371
|
+
/**
|
|
372
|
+
* Enables / Disables the LowPass effect, (Optional: provide your Own Data)
|
|
373
|
+
* @param boostFactor
|
|
374
|
+
* @param cutoffFrequency
|
|
375
|
+
* @returns
|
|
376
|
+
*/
|
|
377
|
+
toggleLowPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<boolean>;
|
|
378
|
+
/**
|
|
379
|
+
* Enables / Disables the HighPass effect, (Optional: provide your Own Data)
|
|
380
|
+
* @param boostFactor
|
|
381
|
+
* @param cutoffFrequency
|
|
382
|
+
* @returns
|
|
383
|
+
*/
|
|
384
|
+
toggleHighPass: (boostFactor?: number, cutoffFrequency?: number) => Promise<boolean>;
|
|
385
|
+
/**
|
|
386
|
+
* Enables / Disables the Normalization effect.
|
|
387
|
+
* @param {number} [maxAmplitude=0.75] - The maximum amplitude of the audio.
|
|
388
|
+
* @param {boolean} [adaptive=true] - Whether to use adaptive normalization or not.
|
|
389
|
+
* @returns {Promise<boolean>} - The state of the filter after execution.
|
|
390
|
+
*/
|
|
391
|
+
toggleNormalization: (maxAmplitude?: number, adaptive?: boolean) => Promise<boolean>;
|
|
392
|
+
/**
|
|
393
|
+
* Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
|
|
394
|
+
* @param {number} [decay=0.5] - The decay of the echo effect.
|
|
395
|
+
* @param {number} [echoLength=0.5] - The length of the echo effect.
|
|
396
|
+
* @returns {Promise<boolean>} - The state of the filter after execution.
|
|
397
|
+
*/
|
|
398
|
+
toggleEcho: (decay?: number, echoLength?: number) => Promise<boolean>;
|
|
399
|
+
};
|
|
400
|
+
lavalinkFilterPlugin: {
|
|
401
|
+
/**
|
|
402
|
+
* Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
|
|
403
|
+
* @param delay
|
|
404
|
+
* @param decay
|
|
405
|
+
* @returns
|
|
406
|
+
*/
|
|
407
|
+
toggleEcho: (delay?: number, decay?: number) => Promise<boolean>;
|
|
408
|
+
/**
|
|
409
|
+
* Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
|
|
410
|
+
* @param delays
|
|
411
|
+
* @param gains
|
|
412
|
+
* @returns
|
|
413
|
+
*/
|
|
414
|
+
toggleReverb: (delays?: number[], gains?: number[]) => Promise<boolean>;
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
|
|
418
|
+
* @param speed
|
|
419
|
+
* @param pitch
|
|
420
|
+
* @param rate
|
|
421
|
+
* @returns
|
|
422
|
+
*/
|
|
423
|
+
toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<boolean>;
|
|
424
|
+
/**
|
|
425
|
+
* Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
|
|
426
|
+
* @param speed
|
|
427
|
+
* @param pitch
|
|
428
|
+
* @param rate
|
|
429
|
+
* @returns
|
|
430
|
+
*/
|
|
431
|
+
toggleVaporwave(speed?: number, pitch?: number, rate?: number): Promise<boolean>;
|
|
432
|
+
/**
|
|
433
|
+
* Enable / Disables a Karaoke like Filter Effect
|
|
434
|
+
* @param level
|
|
435
|
+
* @param monoLevel
|
|
436
|
+
* @param filterBand
|
|
437
|
+
* @param filterWidth
|
|
438
|
+
* @returns
|
|
439
|
+
*/
|
|
440
|
+
toggleKaraoke(level?: number, monoLevel?: number, filterBand?: number, filterWidth?: number): Promise<boolean>;
|
|
441
|
+
/** Function to find out if currently there is a custom timescamle etc. filter applied */
|
|
442
|
+
isCustomFilterActive(): boolean;
|
|
443
|
+
/**
|
|
444
|
+
* Sets the players equalizer band on-top of the existing ones.
|
|
445
|
+
* @param bands
|
|
446
|
+
*/
|
|
447
|
+
setEQ(bands: EQBand | EQBand[]): Promise<this>;
|
|
448
|
+
/** Clears the equalizer bands. */
|
|
449
|
+
clearEQ(): Promise<this>;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare class QueueSaver {
|
|
453
|
+
/**
|
|
454
|
+
* The queue store manager
|
|
455
|
+
*/
|
|
456
|
+
private _;
|
|
457
|
+
/**
|
|
458
|
+
* The options for the queue saver
|
|
459
|
+
*/
|
|
460
|
+
options: {
|
|
461
|
+
maxPreviousTracks: number;
|
|
462
|
+
};
|
|
463
|
+
constructor(options: ManagerQueueOptions);
|
|
464
|
+
/**
|
|
465
|
+
* Get the queue for a guild
|
|
466
|
+
* @param guildId The guild ID
|
|
467
|
+
* @returns The queue for the guild
|
|
468
|
+
*/
|
|
469
|
+
get(guildId: string): Promise<Partial<StoredQueue>>;
|
|
470
|
+
/**
|
|
471
|
+
* Delete the queue for a guild
|
|
472
|
+
* @param guildId The guild ID
|
|
473
|
+
* @returns The queue for the guild
|
|
474
|
+
*/
|
|
475
|
+
delete(guildId: string): Promise<boolean | void>;
|
|
476
|
+
/**
|
|
477
|
+
* Set the queue for a guild
|
|
478
|
+
* @param guildId The guild ID
|
|
479
|
+
* @param valueToStringify The queue to set
|
|
480
|
+
* @returns The queue for the guild
|
|
481
|
+
*/
|
|
482
|
+
set(guildId: string, valueToStringify: StoredQueue): Promise<boolean | void>;
|
|
483
|
+
/**
|
|
484
|
+
* Sync the queue for a guild
|
|
485
|
+
* @param guildId The guild ID
|
|
486
|
+
* @returns The queue for the guild
|
|
487
|
+
*/
|
|
488
|
+
sync(guildId: string): Promise<Partial<StoredQueue>>;
|
|
489
|
+
}
|
|
490
|
+
declare class DefaultQueueStore implements QueueStoreManager {
|
|
491
|
+
private data;
|
|
492
|
+
constructor();
|
|
493
|
+
/**
|
|
494
|
+
* Get the queue for a guild
|
|
495
|
+
* @param guildId The guild ID
|
|
496
|
+
* @returns The queue for the guild
|
|
497
|
+
*/
|
|
498
|
+
get(guildId: string): StoredQueue;
|
|
499
|
+
/**
|
|
500
|
+
* Set the queue for a guild
|
|
501
|
+
* @param guildId The guild ID
|
|
502
|
+
* @param valueToStringify The queue to set
|
|
503
|
+
* @returns The queue for the guild
|
|
504
|
+
*/
|
|
505
|
+
set(guildId: string, valueToStringify: any): boolean;
|
|
506
|
+
/**
|
|
507
|
+
* Delete the queue for a guild
|
|
508
|
+
* @param guildId The guild ID
|
|
509
|
+
* @returns The queue for the guild
|
|
510
|
+
*/
|
|
511
|
+
delete(guildId: string): boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Stringify the queue for a guild
|
|
514
|
+
* @param value The queue to stringify
|
|
515
|
+
* @returns The stringified queue
|
|
516
|
+
*/
|
|
517
|
+
stringify(value: StoredQueue | string): StoredQueue | string;
|
|
518
|
+
/**
|
|
519
|
+
* Parse the queue for a guild
|
|
520
|
+
* @param value The queue to parse
|
|
521
|
+
* @returns The parsed queue
|
|
522
|
+
*/
|
|
523
|
+
parse(value: StoredQueue | string): Partial<StoredQueue>;
|
|
524
|
+
}
|
|
525
|
+
declare class Queue {
|
|
526
|
+
readonly tracks: (Track | UnresolvedTrack)[];
|
|
527
|
+
readonly previous: Track[];
|
|
528
|
+
current: Track | null;
|
|
529
|
+
options: {
|
|
530
|
+
maxPreviousTracks: number;
|
|
531
|
+
};
|
|
532
|
+
private readonly guildId;
|
|
533
|
+
private readonly QueueSaver;
|
|
534
|
+
private managerUtils;
|
|
535
|
+
private queueChanges;
|
|
536
|
+
/**
|
|
537
|
+
* Create a new Queue
|
|
538
|
+
* @param guildId The guild ID
|
|
539
|
+
* @param data The data to initialize the queue with
|
|
540
|
+
* @param QueueSaver The queue saver to use
|
|
541
|
+
* @param queueOptions
|
|
542
|
+
*/
|
|
543
|
+
constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
|
|
544
|
+
/**
|
|
545
|
+
* Utils for a Queue
|
|
546
|
+
*/
|
|
547
|
+
utils: {
|
|
548
|
+
/**
|
|
549
|
+
* Save the current cached Queue on the database/server (overides the server)
|
|
550
|
+
*/
|
|
551
|
+
save: () => Promise<boolean | void>;
|
|
552
|
+
/**
|
|
553
|
+
* Sync the current queue database/server with the cached one
|
|
554
|
+
* @returns {void}
|
|
555
|
+
*/
|
|
556
|
+
sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
|
|
557
|
+
destroy: () => Promise<boolean | void>;
|
|
558
|
+
/**
|
|
559
|
+
* @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
|
|
560
|
+
*/
|
|
561
|
+
toJSON: () => StoredQueue;
|
|
562
|
+
/**
|
|
563
|
+
* Get the Total Duration of the Queue-Songs summed up
|
|
564
|
+
* @returns {number}
|
|
565
|
+
*/
|
|
566
|
+
totalDuration: () => number;
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* Shuffles the current Queue, then saves it
|
|
570
|
+
* @returns Amount of Tracks in the Queue
|
|
571
|
+
*/
|
|
572
|
+
shuffle(): Promise<number>;
|
|
573
|
+
/**
|
|
574
|
+
* Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks
|
|
575
|
+
* @param {Track | Track[]} TrackOrTracks
|
|
576
|
+
* @param {number} index At what position to add the Track
|
|
577
|
+
* @returns {number} Queue-Size (for the next Tracks)
|
|
578
|
+
*/
|
|
579
|
+
add(TrackOrTracks: Track | UnresolvedTrack | (Track | UnresolvedTrack)[], index?: number): any;
|
|
580
|
+
/**
|
|
581
|
+
* Splice the tracks in the Queue
|
|
582
|
+
* @param {number} index Where to remove the Track
|
|
583
|
+
* @param {number} amount How many Tracks to remove?
|
|
584
|
+
* @param {Track | Track[]} TrackOrTracks Want to Add more Tracks?
|
|
585
|
+
* @returns {Track} Spliced Track
|
|
586
|
+
*/
|
|
587
|
+
splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
|
|
588
|
+
/**
|
|
589
|
+
* Remove stuff from the queue.tracks array
|
|
590
|
+
* - single Track | UnresolvedTrack
|
|
591
|
+
* - multiple Track | UnresovedTrack
|
|
592
|
+
* - at the index or multiple indexes
|
|
593
|
+
* @param removeQueryTrack
|
|
594
|
+
* @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```js
|
|
598
|
+
* // remove single track
|
|
599
|
+
*
|
|
600
|
+
* const track = player.queue.tracks[4];
|
|
601
|
+
* await player.queue.remove(track);
|
|
602
|
+
*
|
|
603
|
+
* // if you already have the index you can straight up pass it too
|
|
604
|
+
* await player.queue.remove(4);
|
|
605
|
+
*
|
|
606
|
+
*
|
|
607
|
+
* // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
|
|
608
|
+
* await player.queue.remove(player.queue.tracks.slice(4, 10)) // get's the tracks from 4 - 10, which then get's found in the remove function to be removed
|
|
609
|
+
*
|
|
610
|
+
* // I still highly suggest to use .splice!
|
|
611
|
+
*
|
|
612
|
+
* await player.queue.splice(4, 10); // removes at index 4, 10 tracks
|
|
613
|
+
*
|
|
614
|
+
* await player.queue.splice(1, 1); // removes at index 1, 1 track
|
|
615
|
+
*
|
|
616
|
+
* await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
|
|
617
|
+
* ```
|
|
618
|
+
*/
|
|
619
|
+
remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
|
|
620
|
+
removed: (Track | UnresolvedTrack)[];
|
|
621
|
+
} | null>;
|
|
622
|
+
/**
|
|
623
|
+
* Shifts the previous array, to return the last previous track & thus remove it from the previous queue
|
|
624
|
+
* @returns
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* ```js
|
|
628
|
+
* // example on how to play the previous track again
|
|
629
|
+
* const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
|
|
630
|
+
* if(!previous) return console.error("No previous track found");
|
|
631
|
+
* await player.play({ clientTrack: previous }); // play it again
|
|
632
|
+
* ```
|
|
633
|
+
*/
|
|
634
|
+
shiftPrevious(): Promise<Track>;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
declare class Player {
|
|
638
|
+
/** Filter Manager per player */
|
|
639
|
+
filterManager: FilterManager;
|
|
640
|
+
/** circular reference to the lavalink Manager from the Player for easier use */
|
|
641
|
+
LavalinkManager: LavalinkManager;
|
|
642
|
+
/** Player options currently used, mutation doesn't affect player's state */
|
|
643
|
+
options: PlayerOptions;
|
|
644
|
+
/** The lavalink node assigned the the player, don't change it manually */
|
|
645
|
+
node: LavalinkNode;
|
|
646
|
+
/** The queue from the player */
|
|
647
|
+
queue: Queue;
|
|
648
|
+
/** The Guild Id of the Player */
|
|
649
|
+
guildId: string;
|
|
650
|
+
/** The Voice Channel Id of the Player */
|
|
651
|
+
voiceChannelId: string | null;
|
|
652
|
+
/** The Text Channel Id of the Player */
|
|
653
|
+
textChannelId: string | null;
|
|
654
|
+
/** States if the Bot is supposed to be outputting audio */
|
|
655
|
+
playing: boolean;
|
|
656
|
+
/** States if the Bot is paused or not */
|
|
657
|
+
paused: boolean;
|
|
658
|
+
/** Repeat Mode of the Player */
|
|
659
|
+
repeatMode: RepeatMode;
|
|
660
|
+
/** Player's ping */
|
|
661
|
+
ping: {
|
|
662
|
+
lavalink: number;
|
|
663
|
+
ws: number;
|
|
664
|
+
};
|
|
665
|
+
/** The Display Volume */
|
|
666
|
+
volume: number;
|
|
667
|
+
/** The Volume Lavalink actually is outputting */
|
|
668
|
+
lavalinkVolume: number;
|
|
669
|
+
/** The current Positin of the player (Calculated) */
|
|
670
|
+
get position(): number;
|
|
671
|
+
/** The timestamp when the last position change update happened */
|
|
672
|
+
lastPositionChange: number;
|
|
673
|
+
/** The current Positin of the player (from Lavalink) */
|
|
674
|
+
lastPosition: number;
|
|
675
|
+
lastSavedPosition: number;
|
|
676
|
+
/** When the player was created [Timestamp in Ms] (from lavalink) */
|
|
677
|
+
createdTimeStamp: number;
|
|
678
|
+
/** The Player Connection's State (from Lavalink) */
|
|
679
|
+
connected: boolean | undefined;
|
|
680
|
+
/** Voice Server Data (from Lavalink) */
|
|
681
|
+
voice: LavalinkPlayerVoiceOptions;
|
|
682
|
+
voiceState: {
|
|
683
|
+
selfDeaf: boolean;
|
|
684
|
+
selfMute: boolean;
|
|
685
|
+
serverDeaf: boolean;
|
|
686
|
+
serverMute: boolean;
|
|
687
|
+
suppress: boolean;
|
|
688
|
+
};
|
|
689
|
+
/** Custom data for the player */
|
|
690
|
+
private readonly data;
|
|
691
|
+
/**
|
|
692
|
+
* Create a new Player
|
|
693
|
+
* @param options
|
|
694
|
+
* @param LavalinkManager
|
|
695
|
+
*/
|
|
696
|
+
constructor(options: PlayerOptions, LavalinkManager: LavalinkManager, dontEmitPlayerCreateEvent?: boolean);
|
|
697
|
+
/**
|
|
698
|
+
* Set custom data.
|
|
699
|
+
* @param key
|
|
700
|
+
* @param value
|
|
701
|
+
*/
|
|
702
|
+
set(key: string, value: unknown): this;
|
|
703
|
+
/**
|
|
704
|
+
* Get custom data.
|
|
705
|
+
* @param key
|
|
706
|
+
*/
|
|
707
|
+
get<T>(key: string): T;
|
|
708
|
+
/**
|
|
709
|
+
* CLears all the custom data.
|
|
710
|
+
*/
|
|
711
|
+
clearData(): this;
|
|
712
|
+
/**
|
|
713
|
+
* Get all custom Data
|
|
714
|
+
*/
|
|
715
|
+
getAllData(): Record<string, unknown>;
|
|
716
|
+
/**
|
|
717
|
+
* Play the next track from the queue / a specific track, with playoptions for Lavalink
|
|
718
|
+
* @param options
|
|
719
|
+
*/
|
|
720
|
+
play(options?: Partial<PlayOptions>): any;
|
|
721
|
+
/**
|
|
722
|
+
* Set the Volume for the Player
|
|
723
|
+
* @param volume The Volume in percent
|
|
724
|
+
* @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
|
|
725
|
+
*/
|
|
726
|
+
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
|
|
727
|
+
/**
|
|
728
|
+
* Search for a track
|
|
729
|
+
* @param query The query to search for
|
|
730
|
+
* @param requestUser The user that requested the track
|
|
731
|
+
* @param throwOnEmpty If an error should be thrown if no track is found
|
|
732
|
+
* @returns The search result
|
|
733
|
+
*/
|
|
734
|
+
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
|
|
735
|
+
/**
|
|
736
|
+
* Set the SponsorBlock
|
|
737
|
+
* @param segments The segments to set
|
|
738
|
+
*/
|
|
739
|
+
setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
|
|
740
|
+
/**
|
|
741
|
+
* Get the SponsorBlock
|
|
742
|
+
*/
|
|
743
|
+
getSponsorBlock(): Promise<SponsorBlockSegment[]>;
|
|
744
|
+
/**
|
|
745
|
+
* Delete the SponsorBlock
|
|
746
|
+
*/
|
|
747
|
+
deleteSponsorBlock(): Promise<void>;
|
|
748
|
+
/**
|
|
749
|
+
*
|
|
750
|
+
* @param query Query for your data
|
|
751
|
+
* @param requestUser
|
|
752
|
+
*/
|
|
753
|
+
search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<UnresolvedSearchResult | SearchResult>;
|
|
754
|
+
/**
|
|
755
|
+
* Pause the player
|
|
756
|
+
*/
|
|
757
|
+
pause(): Promise<this>;
|
|
758
|
+
/**
|
|
759
|
+
* Resume the Player
|
|
760
|
+
*/
|
|
761
|
+
resume(): Promise<this>;
|
|
762
|
+
/**
|
|
763
|
+
* Seek to a specific Position
|
|
764
|
+
* @param position
|
|
765
|
+
*/
|
|
766
|
+
seek(position: number): Promise<this>;
|
|
767
|
+
/**
|
|
768
|
+
* Set the Repeatmode of the Player
|
|
769
|
+
* @param repeatMode
|
|
770
|
+
*/
|
|
771
|
+
setRepeatMode(repeatMode: RepeatMode): Promise<this>;
|
|
772
|
+
/**
|
|
773
|
+
* Skip the current song, or a specific amount of songs
|
|
774
|
+
* @param amount provide the index of the next track to skip to
|
|
775
|
+
*/
|
|
776
|
+
skip(skipTo?: number, throwError?: boolean): Promise<this>;
|
|
777
|
+
/**
|
|
778
|
+
* Clears the queue and stops playing. Does not destroy the Player and not leave the channel
|
|
779
|
+
* @returns
|
|
780
|
+
*/
|
|
781
|
+
stopPlaying(clearQueue?: boolean, executeAutoplay?: boolean): Promise<this>;
|
|
782
|
+
/**
|
|
783
|
+
* Connects the Player to the Voice Channel
|
|
784
|
+
* @returns
|
|
785
|
+
*/
|
|
786
|
+
connect(): Promise<this>;
|
|
787
|
+
changeVoiceState(data: {
|
|
788
|
+
voiceChannelId?: string;
|
|
789
|
+
selfDeaf?: boolean;
|
|
790
|
+
selfMute?: boolean;
|
|
791
|
+
}): Promise<this>;
|
|
792
|
+
/**
|
|
793
|
+
* Disconnects the Player from the Voice Channel, but keeps the player in the cache
|
|
794
|
+
* @param force If false it throws an error, if player thinks it's already disconnected
|
|
795
|
+
* @returns
|
|
796
|
+
*/
|
|
797
|
+
disconnect(force?: boolean): Promise<this>;
|
|
798
|
+
/**
|
|
799
|
+
* Destroy the player and disconnect from the voice channel
|
|
800
|
+
*/
|
|
801
|
+
destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
|
|
802
|
+
/**
|
|
803
|
+
* Get the current lyrics of the track currently playing on the guild
|
|
804
|
+
* @param guildId The guild id to get the current lyrics for
|
|
805
|
+
* @param skipTrackSource If true, it will not try to get the lyrics from the track source
|
|
806
|
+
* @returns The current lyrics
|
|
807
|
+
* @example
|
|
808
|
+
* ```ts
|
|
809
|
+
* const lyrics = await player.getCurrentLyrics();
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
812
|
+
getCurrentLyrics(skipTrackSource?: boolean): Promise<LyricsResult>;
|
|
813
|
+
/**
|
|
814
|
+
* Get the lyrics of a specific track
|
|
815
|
+
* @param track The track to get the lyrics for
|
|
816
|
+
* @param skipTrackSource If true, it will not try to get the lyrics from the track source
|
|
817
|
+
* @returns The lyrics of the track
|
|
818
|
+
* @example
|
|
819
|
+
* ```ts
|
|
820
|
+
* const lyrics = await player.getLyrics(player.queue.tracks[0], true);
|
|
821
|
+
* ```
|
|
822
|
+
*/
|
|
823
|
+
getLyrics(track: Track, skipTrackSource?: boolean): Promise<LyricsResult>;
|
|
824
|
+
/**
|
|
825
|
+
* Subscribe to the lyrics event on a specific guild to active live lyrics events
|
|
826
|
+
* @returns The unsubscribe function
|
|
827
|
+
* @example
|
|
828
|
+
* ```ts
|
|
829
|
+
* const lyrics = await player.subscribeLyrics();
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
832
|
+
subscribeLyrics(): Promise<unknown>;
|
|
833
|
+
/**
|
|
834
|
+
* Unsubscribe from the lyrics event on a specific guild to disable live lyrics events
|
|
835
|
+
* @returns The unsubscribe function
|
|
836
|
+
* @example
|
|
837
|
+
* ```ts
|
|
838
|
+
* const lyrics = await player.unsubscribeLyrics();
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
unsubscribeLyrics(): Promise<void>;
|
|
842
|
+
/**
|
|
843
|
+
* Move the player on a different Audio-Node
|
|
844
|
+
* @param newNode New Node / New Node Id
|
|
845
|
+
* @param checkSources If it should check if the sources are supported by the new node @default true
|
|
846
|
+
* @return The new Node Id
|
|
847
|
+
* @example
|
|
848
|
+
* ```ts
|
|
849
|
+
* const changeNode = await player.changeNode(newNode, true);
|
|
850
|
+
* ```
|
|
851
|
+
*/
|
|
852
|
+
changeNode(newNode: LavalinkNode | string, checkSources?: boolean): Promise<string>;
|
|
853
|
+
/** Converts the Player including Queue to a Json state */
|
|
854
|
+
toJSON(): PlayerJson;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/** Sourcenames provided by lavalink server */
|
|
858
|
+
type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
|
|
859
|
+
/** Source Names provided by lava src plugin */
|
|
860
|
+
type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts" | "vkmusic" | "tidal" | "qobuz";
|
|
861
|
+
/** Source Names provided by jiosaavan plugin */
|
|
862
|
+
type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
|
|
863
|
+
/** The SourceNames provided by lavalink */
|
|
864
|
+
type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
|
|
865
|
+
interface LavalinkTrackInfo {
|
|
866
|
+
/** The Identifier of the Track */
|
|
867
|
+
identifier: string;
|
|
868
|
+
/** The Track Title / Name */
|
|
869
|
+
title: string;
|
|
870
|
+
/** The Name of the Author */
|
|
871
|
+
author: string;
|
|
872
|
+
/** The duration of the Track */
|
|
873
|
+
length: number;
|
|
874
|
+
/** The URL of the artwork if available */
|
|
875
|
+
artworkUrl: string | null;
|
|
876
|
+
/** The URL (aka Link) of the Track called URI */
|
|
877
|
+
uri: string;
|
|
878
|
+
/** The Source name of the Track, e.g. soundcloud, youtube, spotify */
|
|
879
|
+
sourceName: SourceNames;
|
|
880
|
+
/** Wether the audio is seekable */
|
|
881
|
+
isSeekable: boolean;
|
|
882
|
+
/** Wether the audio is of a live stream */
|
|
883
|
+
isStream: boolean;
|
|
884
|
+
/** If isrc code is available, it's provided */
|
|
885
|
+
isrc: string | null;
|
|
886
|
+
}
|
|
887
|
+
interface TrackInfo {
|
|
888
|
+
/** The Identifier of the Track */
|
|
889
|
+
identifier: string;
|
|
890
|
+
/** The Track Title / Name */
|
|
891
|
+
title: string;
|
|
892
|
+
/** The Name of the Author */
|
|
893
|
+
author: string;
|
|
894
|
+
/** The duration of the Track */
|
|
895
|
+
duration: number;
|
|
896
|
+
/** The URL of the artwork if available */
|
|
897
|
+
artworkUrl: string | null;
|
|
898
|
+
/** The URL (aka Link) of the Track called URI */
|
|
899
|
+
uri: string;
|
|
900
|
+
/** The Source name of the Track, e.g. soundcloud, youtube, spotify */
|
|
901
|
+
sourceName: SourceNames;
|
|
902
|
+
/** Wether the audio is seekable */
|
|
903
|
+
isSeekable: boolean;
|
|
904
|
+
/** Wether the audio is of a live stream */
|
|
905
|
+
isStream: boolean;
|
|
906
|
+
/** If isrc code is available, it's provided */
|
|
907
|
+
isrc: string | null;
|
|
908
|
+
}
|
|
909
|
+
interface PluginInfo {
|
|
910
|
+
/** The Type provided by a plugin */
|
|
911
|
+
type?: "album" | "playlist" | "artist" | "recommendations" | string;
|
|
912
|
+
/** The Identifier provided by a plugin */
|
|
913
|
+
albumName?: string;
|
|
914
|
+
/** The url of the album */
|
|
915
|
+
albumUrl?: string;
|
|
916
|
+
/** The url of the album art */
|
|
917
|
+
albumArtUrl?: string;
|
|
918
|
+
/** The url of the artist */
|
|
919
|
+
artistUrl?: string;
|
|
920
|
+
/** The url of the artist artwork */
|
|
921
|
+
artistArtworkUrl?: string;
|
|
922
|
+
/** The url of the preview */
|
|
923
|
+
previewUrl?: string;
|
|
924
|
+
/** Whether the track is a preview */
|
|
925
|
+
isPreview?: boolean;
|
|
926
|
+
/** The total number of tracks in the playlist */
|
|
927
|
+
totalTracks?: number;
|
|
928
|
+
/** The Identifier provided by a plugin */
|
|
929
|
+
identifier?: string;
|
|
930
|
+
/** The ArtworkUrl provided by a plugin */
|
|
931
|
+
artworkUrl?: string;
|
|
932
|
+
/** The Author Information provided by a plugin */
|
|
933
|
+
author?: string;
|
|
934
|
+
/** The Url provided by a Plugin */
|
|
935
|
+
url?: string;
|
|
936
|
+
/** The Url provided by a Plugin */
|
|
937
|
+
uri?: string;
|
|
938
|
+
/** You can put specific track information here, to transform the tracks... */
|
|
939
|
+
clientData?: {
|
|
940
|
+
previousTrack?: boolean;
|
|
941
|
+
[key: string]: any;
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
interface LavalinkTrack {
|
|
945
|
+
/** The Base 64 encoded String */
|
|
946
|
+
encoded?: Base64;
|
|
947
|
+
/** Track Information */
|
|
948
|
+
info: LavalinkTrackInfo;
|
|
949
|
+
/** Plugin Information from Lavalink */
|
|
950
|
+
pluginInfo: Partial<PluginInfo>;
|
|
951
|
+
/** The userData Object from when you provide to the lavalink request */
|
|
952
|
+
userData?: anyObject;
|
|
953
|
+
}
|
|
954
|
+
interface Track {
|
|
955
|
+
/** The Base 64 encoded String */
|
|
956
|
+
encoded?: Base64;
|
|
957
|
+
/** Track Information */
|
|
958
|
+
info: TrackInfo;
|
|
959
|
+
/** Plugin Information from Lavalink */
|
|
960
|
+
pluginInfo: Partial<PluginInfo>;
|
|
961
|
+
/** The Track's Requester */
|
|
962
|
+
requester?: unknown;
|
|
963
|
+
/** The userData Object from when you provide to the lavalink request */
|
|
964
|
+
userData?: anyObject;
|
|
965
|
+
}
|
|
966
|
+
interface UnresolvedTrackInfo extends Partial<TrackInfo> {
|
|
967
|
+
/** Required */
|
|
968
|
+
title: string;
|
|
969
|
+
}
|
|
970
|
+
interface UnresolvedQuery extends UnresolvedTrackInfo {
|
|
971
|
+
/** The base64 of the unresolved track to "encode" */
|
|
972
|
+
encoded?: Base64;
|
|
973
|
+
}
|
|
974
|
+
interface UnresolvedTrack {
|
|
975
|
+
/** Required */
|
|
976
|
+
resolve: (player: Player) => Promise<void>;
|
|
977
|
+
/** The Base 64 encoded String */
|
|
978
|
+
encoded?: Base64;
|
|
979
|
+
/** Track Information */
|
|
980
|
+
info: UnresolvedTrackInfo;
|
|
981
|
+
/** Plugin Information from Lavalink */
|
|
982
|
+
pluginInfo: Partial<PluginInfo>;
|
|
983
|
+
/** The userData Object from when you provide to the lavalink request */
|
|
984
|
+
userData?: anyObject;
|
|
985
|
+
/** The Track's Requester */
|
|
986
|
+
requester?: unknown;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
interface StoredQueue {
|
|
990
|
+
current: Track | null;
|
|
991
|
+
previous: Track[];
|
|
992
|
+
tracks: (Track | UnresolvedTrack)[];
|
|
993
|
+
}
|
|
994
|
+
interface QueueStoreManager {
|
|
995
|
+
/** @async get a Value (MUST RETURN UNPARSED!) */
|
|
996
|
+
get: (guildId: string) => Awaitable<StoredQueue | string>;
|
|
997
|
+
/** @async Set a value inside a guildId (MUST BE UNPARSED) */
|
|
998
|
+
set: (guildId: string, value: StoredQueue | string) => Awaitable<void | boolean>;
|
|
999
|
+
/** @async Delete a Database Value based of it's guildId */
|
|
1000
|
+
delete: (guildId: string) => Awaitable<void | boolean>;
|
|
1001
|
+
/** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
1002
|
+
stringify: (value: StoredQueue | string) => Awaitable<StoredQueue | string>;
|
|
1003
|
+
/** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
1004
|
+
parse: (value: StoredQueue | string) => Awaitable<Partial<StoredQueue>>;
|
|
1005
|
+
}
|
|
1006
|
+
interface ManagerQueueOptions {
|
|
1007
|
+
/** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
|
|
1008
|
+
maxPreviousTracks?: number;
|
|
1009
|
+
/** Custom Queue Store option */
|
|
1010
|
+
queueStore?: QueueStoreManager;
|
|
1011
|
+
/** Custom Queue Watcher class */
|
|
1012
|
+
queueChangesWatcher?: QueueChangesWatcher;
|
|
1013
|
+
}
|
|
1014
|
+
interface QueueChangesWatcher {
|
|
1015
|
+
/** get a Value (MUST RETURN UNPARSED!) */
|
|
1016
|
+
tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
|
|
1017
|
+
/** Set a value inside a guildId (MUST BE UNPARSED) */
|
|
1018
|
+
tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number | number[], oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
|
|
1019
|
+
/** Set a value inside a guildId (MUST BE UNPARSED) */
|
|
1020
|
+
shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => void;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
type DestroyReasonsType = keyof typeof DestroyReasons | string;
|
|
1024
|
+
type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
|
|
1025
|
+
interface PlayerJson {
|
|
1026
|
+
/** Guild Id where the player was playing in */
|
|
1027
|
+
guildId: string;
|
|
1028
|
+
/** Options provided to the player */
|
|
1029
|
+
options: PlayerOptions;
|
|
1030
|
+
/** Voice Channel Id the player was playing in */
|
|
1031
|
+
voiceChannelId: string;
|
|
1032
|
+
/** Text Channel Id the player was synced to */
|
|
1033
|
+
textChannelId?: string;
|
|
1034
|
+
/** Position the player was at */
|
|
1035
|
+
position: number;
|
|
1036
|
+
/** Lavalink's position the player was at */
|
|
1037
|
+
lastPosition: number;
|
|
1038
|
+
/** Last time the position was sent from lavalink */
|
|
1039
|
+
lastPositionChange: number;
|
|
1040
|
+
/** Volume in % from the player (without volumeDecrementer) */
|
|
1041
|
+
volume: number;
|
|
1042
|
+
/** Real Volume used in lavalink (with the volumeDecrementer) */
|
|
1043
|
+
lavalinkVolume: number;
|
|
1044
|
+
/** The repeatmode from the player */
|
|
1045
|
+
repeatMode: RepeatMode;
|
|
1046
|
+
/** Pause state */
|
|
1047
|
+
paused: boolean;
|
|
1048
|
+
/** Wether the player was playing or not */
|
|
1049
|
+
playing: boolean;
|
|
1050
|
+
/** When the player was created */
|
|
1051
|
+
createdTimeStamp?: number;
|
|
1052
|
+
/** All current used fitlers Data */
|
|
1053
|
+
filters: FilterData;
|
|
1054
|
+
/** The player's ping object */
|
|
1055
|
+
ping: {
|
|
1056
|
+
/** Ping to the voice websocket server */
|
|
1057
|
+
ws: number;
|
|
1058
|
+
/** Avg. calc. Ping to the lavalink server */
|
|
1059
|
+
lavalink: number;
|
|
1060
|
+
};
|
|
1061
|
+
/** Equalizer Bands used in lavalink */
|
|
1062
|
+
equalizer: EQBand[];
|
|
1063
|
+
/** The Id of the last used node */
|
|
1064
|
+
nodeId?: string;
|
|
1065
|
+
/** The SessionId of the node */
|
|
1066
|
+
nodeSessionId?: string;
|
|
1067
|
+
/** The stored queue */
|
|
1068
|
+
queue?: StoredQueue;
|
|
1069
|
+
}
|
|
1070
|
+
type RepeatMode = "queue" | "track" | "off";
|
|
1071
|
+
interface PlayerOptions {
|
|
1072
|
+
/** Guild id of the player */
|
|
1073
|
+
guildId: string;
|
|
1074
|
+
/** The Voice Channel Id */
|
|
1075
|
+
voiceChannelId: string;
|
|
1076
|
+
/** The Text Channel Id of the Player */
|
|
1077
|
+
textChannelId?: string;
|
|
1078
|
+
/** instantly change volume with the one play request */
|
|
1079
|
+
volume?: number;
|
|
1080
|
+
/** VC Region for node selections */
|
|
1081
|
+
vcRegion?: string;
|
|
1082
|
+
/** if it should join deafened */
|
|
1083
|
+
selfDeaf?: boolean;
|
|
1084
|
+
/** If it should join muted */
|
|
1085
|
+
selfMute?: boolean;
|
|
1086
|
+
/** If it should use a specific lavalink node */
|
|
1087
|
+
node?: LavalinkNode | string;
|
|
1088
|
+
/** If when applying filters, it should use the insta apply filters fix */
|
|
1089
|
+
instaUpdateFiltersFix?: boolean;
|
|
1090
|
+
/** If a volume should be applied via filters instead of lavalink-volume */
|
|
1091
|
+
applyVolumeAsFilter?: boolean;
|
|
1092
|
+
/** Custom Data for the player get/set datastorage */
|
|
1093
|
+
customData?: anyObject;
|
|
1094
|
+
}
|
|
1095
|
+
type anyObject = {
|
|
1096
|
+
[key: string | number]: string | number | null | anyObject;
|
|
1097
|
+
};
|
|
1098
|
+
interface BasePlayOptions {
|
|
1099
|
+
/** The position to start the track. */
|
|
1100
|
+
position?: number;
|
|
1101
|
+
/** The position to end the track. */
|
|
1102
|
+
endTime?: number;
|
|
1103
|
+
/** If to start "paused" */
|
|
1104
|
+
paused?: boolean;
|
|
1105
|
+
/** The Volume to start with */
|
|
1106
|
+
volume?: number;
|
|
1107
|
+
/** The Lavalink Filters to use | only with the new REST API */
|
|
1108
|
+
filters?: Partial<LavalinkFilterData>;
|
|
1109
|
+
/** Voice Update for Lavalink */
|
|
1110
|
+
voice?: LavalinkPlayerVoiceOptions;
|
|
1111
|
+
}
|
|
1112
|
+
interface LavalinkPlayOptions extends BasePlayOptions {
|
|
1113
|
+
/** Which Track to play | don't provide, if it should pick from the Queue */
|
|
1114
|
+
track?: {
|
|
1115
|
+
/** The track encoded base64 string to use instead of the one from the queue system */
|
|
1116
|
+
encoded?: Base64 | null;
|
|
1117
|
+
/** The identifier of the track to use */
|
|
1118
|
+
identifier?: string;
|
|
1119
|
+
/** Custom User Data for the track to provide, will then be on the userData object from the track */
|
|
1120
|
+
userData?: anyObject;
|
|
1121
|
+
/** The Track requester for when u provide encodedTrack / identifer */
|
|
1122
|
+
requester?: unknown;
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
interface PlayOptions extends LavalinkPlayOptions {
|
|
1126
|
+
/** Whether to not replace the track if a play payload is sent. */
|
|
1127
|
+
noReplace?: boolean;
|
|
1128
|
+
/** Adds track on queue and skips to it */
|
|
1129
|
+
clientTrack?: Track | UnresolvedTrack;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/** Ability to manipulate fetch requests */
|
|
1133
|
+
type ModifyRequest = (options: RequestInit & {
|
|
1134
|
+
path: string;
|
|
1135
|
+
extraQueryUrlParams?: URLSearchParams;
|
|
1136
|
+
}) => void;
|
|
1137
|
+
type SponsorBlockSegment = "sponsor" | "selfpromo" | "interaction" | "intro" | "outro" | "preview" | "music_offtopic" | "filler";
|
|
1138
|
+
/**
|
|
1139
|
+
* Node Options for creating a lavalink node
|
|
1140
|
+
*/
|
|
1141
|
+
interface LavalinkNodeOptions {
|
|
1142
|
+
/** The Lavalink Server-Ip / Domain-URL */
|
|
1143
|
+
host: string;
|
|
1144
|
+
/** The Lavalink Connection Port */
|
|
1145
|
+
port: number;
|
|
1146
|
+
/** The Lavalink Password / Authorization-Key */
|
|
1147
|
+
authorization: string;
|
|
1148
|
+
/** Does the Server use ssl (https) */
|
|
1149
|
+
secure?: boolean;
|
|
1150
|
+
/** RESUME THE PLAYER? by providing a sessionid on the node-creation */
|
|
1151
|
+
sessionId?: string;
|
|
1152
|
+
/** Add a Custom ID to the node, for later use */
|
|
1153
|
+
id?: string;
|
|
1154
|
+
/** Voice Regions of this Node */
|
|
1155
|
+
regions?: string[];
|
|
1156
|
+
/** The retryAmount for the node. */
|
|
1157
|
+
retryAmount?: number;
|
|
1158
|
+
/** The retryDelay for the node. */
|
|
1159
|
+
retryDelay?: number;
|
|
1160
|
+
/** signal for cancelling requests - default: AbortSignal.timeout(options.requestSignalTimeoutMS || 10000) - put <= 0 to disable */
|
|
1161
|
+
requestSignalTimeoutMS?: number;
|
|
1162
|
+
/** Close on error */
|
|
1163
|
+
closeOnError?: boolean;
|
|
1164
|
+
/** Heartbeat interval , set to <= 0 to disable heartbeat system */
|
|
1165
|
+
heartBeatInterval?: 30000;
|
|
1166
|
+
/** Recommended, to check wether the client is still connected or not on the stats endpoint */
|
|
1167
|
+
enablePingOnStatsCheck?: boolean;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Memory Stats object from lavalink
|
|
1171
|
+
*/
|
|
1172
|
+
interface MemoryStats {
|
|
1173
|
+
/** The free memory of the allocated amount. */
|
|
1174
|
+
free: number;
|
|
1175
|
+
/** The used memory of the allocated amount. */
|
|
1176
|
+
used: number;
|
|
1177
|
+
/** The total allocated memory. */
|
|
1178
|
+
allocated: number;
|
|
1179
|
+
/** The reservable memory. */
|
|
1180
|
+
reservable: number;
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* CPU Stats object from lavalink
|
|
1184
|
+
*/
|
|
1185
|
+
interface CPUStats {
|
|
1186
|
+
/** The core amount the host machine has. */
|
|
1187
|
+
cores: number;
|
|
1188
|
+
/** The system load. */
|
|
1189
|
+
systemLoad: number;
|
|
1190
|
+
/** The lavalink load. */
|
|
1191
|
+
lavalinkLoad: number;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* FrameStats Object from lavalink
|
|
1195
|
+
*/
|
|
1196
|
+
interface FrameStats {
|
|
1197
|
+
/** The amount of sent frames. */
|
|
1198
|
+
sent?: number;
|
|
1199
|
+
/** The amount of nulled frames. */
|
|
1200
|
+
nulled?: number;
|
|
1201
|
+
/** The amount of deficit frames. */
|
|
1202
|
+
deficit?: number;
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* BaseNodeStats object from Lavalink
|
|
1206
|
+
*/
|
|
1207
|
+
interface BaseNodeStats {
|
|
1208
|
+
/** The amount of players on the node. */
|
|
1209
|
+
players: number;
|
|
1210
|
+
/** The amount of playing players on the node. */
|
|
1211
|
+
playingPlayers: number;
|
|
1212
|
+
/** The uptime for the node. */
|
|
1213
|
+
uptime: number;
|
|
1214
|
+
/** The memory stats for the node. */
|
|
1215
|
+
memory: MemoryStats;
|
|
1216
|
+
/** The cpu stats for the node. */
|
|
1217
|
+
cpu: CPUStats;
|
|
1218
|
+
/** The frame stats for the node. */
|
|
1219
|
+
frameStats: FrameStats;
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Interface for nodeStats from lavalink
|
|
1223
|
+
*/
|
|
1224
|
+
interface NodeStats extends BaseNodeStats {
|
|
1225
|
+
/** The frame stats for the node. */
|
|
1226
|
+
frameStats: FrameStats;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Entire lavalink information object from lavalink
|
|
1230
|
+
*/
|
|
1231
|
+
interface LavalinkInfo {
|
|
1232
|
+
/** The version of this Lavalink server */
|
|
1233
|
+
version: VersionObject;
|
|
1234
|
+
/** The millisecond unix timestamp when this Lavalink jar was built */
|
|
1235
|
+
buildTime: number;
|
|
1236
|
+
/** The git information of this Lavalink server */
|
|
1237
|
+
git: GitObject;
|
|
1238
|
+
/** The JVM version this Lavalink server runs on */
|
|
1239
|
+
jvm: string;
|
|
1240
|
+
/** The Lavaplayer version being used by this server */
|
|
1241
|
+
lavaplayer: string;
|
|
1242
|
+
/** The enabled source managers for this server */
|
|
1243
|
+
sourceManagers: string[];
|
|
1244
|
+
/** The enabled filters for this server */
|
|
1245
|
+
filters: string[];
|
|
1246
|
+
/** The enabled plugins for this server */
|
|
1247
|
+
plugins: PluginObject[];
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Lavalink's version object from lavalink
|
|
1251
|
+
*/
|
|
1252
|
+
interface VersionObject {
|
|
1253
|
+
/** The full version string of this Lavalink server */
|
|
1254
|
+
semver: string;
|
|
1255
|
+
/** The major version of this Lavalink server */
|
|
1256
|
+
major: number;
|
|
1257
|
+
/** The minor version of this Lavalink server */
|
|
1258
|
+
minor: number;
|
|
1259
|
+
/** The patch version of this Lavalink server */
|
|
1260
|
+
patch: internal;
|
|
1261
|
+
/** The pre-release version according to semver as a . separated list of identifiers */
|
|
1262
|
+
preRelease?: string;
|
|
1263
|
+
/** The build metadata according to semver as a . separated list of identifiers */
|
|
1264
|
+
build?: string;
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Git information object from lavalink
|
|
1268
|
+
*/
|
|
1269
|
+
interface GitObject {
|
|
1270
|
+
/** The branch this Lavalink server was built on */
|
|
1271
|
+
branch: string;
|
|
1272
|
+
/** The commit this Lavalink server was built on */
|
|
1273
|
+
commit: string;
|
|
1274
|
+
/** The millisecond unix timestamp for when the commit was created */
|
|
1275
|
+
commitTime: string;
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Lavalink's plugins object from lavalink's plugin
|
|
1279
|
+
*/
|
|
1280
|
+
interface PluginObject {
|
|
1281
|
+
/** The name of the plugin */
|
|
1282
|
+
name: string;
|
|
1283
|
+
/** The version of the plugin */
|
|
1284
|
+
version: string;
|
|
1285
|
+
}
|
|
1286
|
+
interface LyricsResult {
|
|
1287
|
+
/**The name of the source */
|
|
1288
|
+
sourceName: string;
|
|
1289
|
+
/**The name of the provider */
|
|
1290
|
+
provider: string;
|
|
1291
|
+
/**The result text */
|
|
1292
|
+
text: string | null;
|
|
1293
|
+
/**The lyrics lines */
|
|
1294
|
+
lines: LyricsLine[];
|
|
1295
|
+
/**Information about the plugin */
|
|
1296
|
+
plugin: PluginInfo;
|
|
1297
|
+
}
|
|
1298
|
+
interface LyricsLine {
|
|
1299
|
+
/**The millisecond timestamp */
|
|
1300
|
+
timestamp: number;
|
|
1301
|
+
/**The line duration in milliseconds */
|
|
1302
|
+
duration: number | null;
|
|
1303
|
+
/**The line text */
|
|
1304
|
+
line: string;
|
|
1305
|
+
/**Information about the plugin */
|
|
1306
|
+
plugin: PluginInfo;
|
|
1307
|
+
}
|
|
1308
|
+
type LavalinkNodeIdentifier = string;
|
|
1309
|
+
interface NodeManagerEvents {
|
|
1310
|
+
/**
|
|
1311
|
+
* Emitted when a Node is created.
|
|
1312
|
+
* @event Manager.nodeManager#create
|
|
1313
|
+
*/
|
|
1314
|
+
"create": (node: LavalinkNode) => void;
|
|
1315
|
+
/**
|
|
1316
|
+
* Emitted when a Node is destroyed.
|
|
1317
|
+
* @event Manager.nodeManager#destroy
|
|
1318
|
+
*/
|
|
1319
|
+
"destroy": (node: LavalinkNode, destroyReason?: DestroyReasonsType) => void;
|
|
1320
|
+
/**
|
|
1321
|
+
* Emitted when a Node is connected.
|
|
1322
|
+
* @event Manager.nodeManager#connect
|
|
1323
|
+
*/
|
|
1324
|
+
"connect": (node: LavalinkNode) => void;
|
|
1325
|
+
/**
|
|
1326
|
+
* Emitted when a Node is reconnecting.
|
|
1327
|
+
* @event Manager.nodeManager#reconnecting
|
|
1328
|
+
*/
|
|
1329
|
+
"reconnecting": (node: LavalinkNode) => void;
|
|
1330
|
+
/**
|
|
1331
|
+
* Emitted When a node starts to reconnect (if you have a reconnection delay, the reconnecting event will be emitted after the retryDelay.)
|
|
1332
|
+
* Useful to check wether the internal node reconnect system works or not
|
|
1333
|
+
* @event Manager.nodeManager#reconnectinprogress
|
|
1334
|
+
*/
|
|
1335
|
+
"reconnectinprogress": (node: LavalinkNode) => void;
|
|
1336
|
+
/**
|
|
1337
|
+
* Emitted when a Node is disconnects.
|
|
1338
|
+
* @event Manager.nodeManager#disconnect
|
|
1339
|
+
*/
|
|
1340
|
+
"disconnect": (node: LavalinkNode, reason: {
|
|
1341
|
+
code?: number;
|
|
1342
|
+
reason?: string;
|
|
1343
|
+
}) => void;
|
|
1344
|
+
/**
|
|
1345
|
+
* Emitted when a Node is error.
|
|
1346
|
+
* @event Manager.nodeManager#error
|
|
1347
|
+
*/
|
|
1348
|
+
"error": (node: LavalinkNode, error: Error, payload?: unknown) => void;
|
|
1349
|
+
/**
|
|
1350
|
+
* Emits every single Node event.
|
|
1351
|
+
* @event Manager.nodeManager#raw
|
|
1352
|
+
*/
|
|
1353
|
+
"raw": (node: LavalinkNode, payload: unknown) => void;
|
|
1354
|
+
/**
|
|
1355
|
+
* Emits when the node connects resumed. You then need to create all players within this event for your usecase.
|
|
1356
|
+
* 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
|
|
1357
|
+
* @event Manager.nodeManager#nodeResumed
|
|
1358
|
+
*/
|
|
1359
|
+
"resumed": (node: LavalinkNode, payload: {
|
|
1360
|
+
resumed: true;
|
|
1361
|
+
sessionId: string;
|
|
1362
|
+
op: "ready";
|
|
1363
|
+
}, players: LavalinkPlayer[] | InvalidLavalinkRestRequest) => void;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
declare const TrackSymbol: unique symbol;
|
|
1367
|
+
declare const UnresolvedTrackSymbol: unique symbol;
|
|
1368
|
+
declare const QueueSymbol: unique symbol;
|
|
1369
|
+
declare const NodeSymbol: unique symbol;
|
|
1370
|
+
/**
|
|
1371
|
+
* Parses Node Connection Url: "lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>"
|
|
1372
|
+
* @param connectionUrl
|
|
1373
|
+
* @returns
|
|
1374
|
+
*/
|
|
1375
|
+
declare function parseLavalinkConnUrl(connectionUrl: string): {
|
|
1376
|
+
authorization: string;
|
|
1377
|
+
id: string;
|
|
1378
|
+
host: string;
|
|
1379
|
+
port: number;
|
|
1380
|
+
};
|
|
1381
|
+
declare class ManagerUtils {
|
|
1382
|
+
LavalinkManager: LavalinkManager | undefined;
|
|
1383
|
+
constructor(LavalinkManager?: LavalinkManager);
|
|
1384
|
+
buildPluginInfo(data: any, clientData?: any): any;
|
|
1385
|
+
buildTrack(data: LavalinkTrack | Track, requester: unknown): Track;
|
|
1386
|
+
/**
|
|
1387
|
+
* Builds a UnresolvedTrack to be resolved before being played .
|
|
1388
|
+
* @param query
|
|
1389
|
+
* @param requester
|
|
1390
|
+
*/
|
|
1391
|
+
buildUnresolvedTrack(query: UnresolvedQuery | UnresolvedTrack, requester: unknown): UnresolvedTrack;
|
|
1392
|
+
/**
|
|
1393
|
+
* Validate if a data is equal to a node
|
|
1394
|
+
* @param data
|
|
1395
|
+
*/
|
|
1396
|
+
isNode(data: LavalinkNode): boolean;
|
|
1397
|
+
getTransformedRequester(requester: unknown): unknown;
|
|
1398
|
+
/**
|
|
1399
|
+
* Validate if a data is equal to node options
|
|
1400
|
+
* @param data
|
|
1401
|
+
*/
|
|
1402
|
+
isNodeOptions(data: LavalinkNodeOptions): boolean;
|
|
1403
|
+
/**
|
|
1404
|
+
* Validate if a data is equal to a track
|
|
1405
|
+
* @param data the Track to validate
|
|
1406
|
+
* @returns
|
|
1407
|
+
*/
|
|
1408
|
+
isTrack(data: Track | UnresolvedTrack): data is Track;
|
|
1409
|
+
/**
|
|
1410
|
+
* Checks if the provided argument is a valid UnresolvedTrack.
|
|
1411
|
+
* @param track
|
|
1412
|
+
*/
|
|
1413
|
+
isUnresolvedTrack(data: UnresolvedTrack | Track): data is UnresolvedTrack;
|
|
1414
|
+
/**
|
|
1415
|
+
* Checks if the provided argument is a valid UnresolvedTrack.
|
|
1416
|
+
* @param track
|
|
1417
|
+
*/
|
|
1418
|
+
isUnresolvedTrackQuery(data: UnresolvedQuery): boolean;
|
|
1419
|
+
getClosestTrack(data: UnresolvedTrack, player: Player): Promise<Track | undefined>;
|
|
1420
|
+
validateQueryString(node: LavalinkNode, queryString: string, sourceString?: LavalinkSearchPlatform): void;
|
|
1421
|
+
transformQuery(query: SearchQuery): {
|
|
1422
|
+
query: string;
|
|
1423
|
+
extraQueryUrlParams: URLSearchParams;
|
|
1424
|
+
source: any;
|
|
1425
|
+
};
|
|
1426
|
+
transformLavaSearchQuery(query: LavaSearchQuery): {
|
|
1427
|
+
query: string;
|
|
1428
|
+
types: string[];
|
|
1429
|
+
source: any;
|
|
1430
|
+
};
|
|
1431
|
+
validateSourceString(node: LavalinkNode, sourceString: SearchPlatform): void;
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself
|
|
1435
|
+
*
|
|
1436
|
+
* @internal
|
|
1437
|
+
*/
|
|
1438
|
+
interface MiniMap<K, V> extends Map<K, V> {
|
|
1439
|
+
constructor: MiniMapConstructor;
|
|
1440
|
+
}
|
|
1441
|
+
declare class MiniMap<K, V> extends Map<K, V> {
|
|
1442
|
+
constructor(data?: [K, V][]);
|
|
1443
|
+
/**
|
|
1444
|
+
* Identical to
|
|
1445
|
+
* [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
|
|
1446
|
+
* but returns a MiniMap instead of an Array.
|
|
1447
|
+
*
|
|
1448
|
+
* @param fn The function to test with (should return boolean)
|
|
1449
|
+
* @param thisArg Value to use as `this` when executing function
|
|
1450
|
+
*
|
|
1451
|
+
* @example
|
|
1452
|
+
* miniMap.filter(user => user.username === 'Bob');
|
|
1453
|
+
*/
|
|
1454
|
+
filter<K2 extends K>(fn: (value: V, key: K, miniMap: this) => key is K2): MiniMap<K2, V>;
|
|
1455
|
+
filter<V2 extends V>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>;
|
|
1456
|
+
filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>;
|
|
1457
|
+
filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
|
|
1458
|
+
filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
|
|
1459
|
+
filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
|
|
1460
|
+
toJSON(): [K, V][];
|
|
1461
|
+
/**
|
|
1462
|
+
* Maps each item to another value into an array. Identical in behavior to
|
|
1463
|
+
* [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
|
1464
|
+
*
|
|
1465
|
+
* @param fn Function that produces an element of the new array, taking three arguments
|
|
1466
|
+
* @param thisArg Value to use as `this` when executing function
|
|
1467
|
+
*
|
|
1468
|
+
* @example
|
|
1469
|
+
* miniMap.map(user => user.tag);
|
|
1470
|
+
*/
|
|
1471
|
+
map<T>(fn: (value: V, key: K, miniMap: this) => T): T[];
|
|
1472
|
+
map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[];
|
|
1473
|
+
}
|
|
1474
|
+
declare function queueTrackEnd(player: Player, dontShiftQueue?: boolean): Promise<Track>;
|
|
1475
|
+
declare function safeStringify(obj: any, padding?: number): string;
|
|
1476
|
+
|
|
1477
|
+
/** Helper for generating Opaque types. */
|
|
1478
|
+
type Opaque<T, K> = T & {
|
|
1479
|
+
__opaque__: K;
|
|
1480
|
+
};
|
|
1481
|
+
/** Opqaue tyep for integernumber */
|
|
1482
|
+
type IntegerNumber = Opaque<number, 'Int'>;
|
|
1483
|
+
/** Opqaue tyep for floatnumber */
|
|
1484
|
+
type FloatNumber = Opaque<number, 'Float'>;
|
|
1485
|
+
type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec";
|
|
1486
|
+
type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
|
|
1487
|
+
type JioSaavnSearchPlatform = "jssearch" | "jsrec";
|
|
1488
|
+
type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
|
|
1489
|
+
type LavalinkClientSearchPlatform = "bcsearch";
|
|
1490
|
+
type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
|
|
1491
|
+
type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
|
|
1492
|
+
type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
|
|
1493
|
+
type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
|
|
1494
|
+
"youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "vk" | "vk music" | "vkmusic" | "tidal" | "tidal music" | "qobuz" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
|
|
1495
|
+
type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
1496
|
+
type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "jiosaavn" | "appleMusic" | "tidal" | "TwitchTv" | "vimeo";
|
|
1497
|
+
interface PlaylistInfo {
|
|
1498
|
+
/** The playlist name */
|
|
1499
|
+
name: string;
|
|
1500
|
+
/** The playlist title (same as name) */
|
|
1501
|
+
title: string;
|
|
1502
|
+
/** The playlist Author */
|
|
1503
|
+
author?: string;
|
|
1504
|
+
/** The playlist Thumbnail */
|
|
1505
|
+
thumbnail?: string;
|
|
1506
|
+
/** A Uri to the playlist */
|
|
1507
|
+
uri?: string;
|
|
1508
|
+
/** The playlist selected track. */
|
|
1509
|
+
selectedTrack: Track | null;
|
|
1510
|
+
/** The duration of the entire playlist. (calcualted) */
|
|
1511
|
+
duration: number;
|
|
1512
|
+
}
|
|
1513
|
+
interface SearchResult {
|
|
1514
|
+
loadType: LoadTypes;
|
|
1515
|
+
exception: Exception | null;
|
|
1516
|
+
pluginInfo: PluginInfo;
|
|
1517
|
+
playlist: PlaylistInfo | null;
|
|
1518
|
+
tracks: Track[];
|
|
1519
|
+
}
|
|
1520
|
+
interface UnresolvedSearchResult {
|
|
1521
|
+
loadType: LoadTypes;
|
|
1522
|
+
exception: Exception | null;
|
|
1523
|
+
pluginInfo: PluginInfo;
|
|
1524
|
+
playlist: PlaylistInfo | null;
|
|
1525
|
+
tracks: UnresolvedTrack[];
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* @internal
|
|
1529
|
+
*/
|
|
1530
|
+
interface MiniMapConstructor {
|
|
1531
|
+
new (): MiniMap<unknown, unknown>;
|
|
1532
|
+
new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): MiniMap<K, V>;
|
|
1533
|
+
new <K, V>(iterable: Iterable<readonly [K, V]>): MiniMap<K, V>;
|
|
1534
|
+
readonly prototype: MiniMap<unknown, unknown>;
|
|
1535
|
+
readonly [Symbol.species]: MiniMapConstructor;
|
|
1536
|
+
}
|
|
1537
|
+
type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
|
|
1538
|
+
type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
|
|
1539
|
+
interface Exception {
|
|
1540
|
+
/** Severity of the error */
|
|
1541
|
+
severity: Severity;
|
|
1542
|
+
/** Nodejs Error */
|
|
1543
|
+
error?: Error;
|
|
1544
|
+
/** Message by lavalink */
|
|
1545
|
+
message: string;
|
|
1546
|
+
/** Cause by lavalink */
|
|
1547
|
+
cause: string;
|
|
1548
|
+
/** causeStackTrace by lavalink */
|
|
1549
|
+
causeStackTrace: string;
|
|
1550
|
+
}
|
|
1551
|
+
interface PlayerEvent {
|
|
1552
|
+
op: "event";
|
|
1553
|
+
type: PlayerEventType;
|
|
1554
|
+
guildId: string;
|
|
1555
|
+
}
|
|
1556
|
+
interface TrackStartEvent extends PlayerEvent {
|
|
1557
|
+
type: "TrackStartEvent";
|
|
1558
|
+
track: LavalinkTrack;
|
|
1559
|
+
}
|
|
1560
|
+
interface TrackEndEvent extends PlayerEvent {
|
|
1561
|
+
type: "TrackEndEvent";
|
|
1562
|
+
track: LavalinkTrack;
|
|
1563
|
+
reason: TrackEndReason;
|
|
1564
|
+
}
|
|
1565
|
+
interface TrackExceptionEvent extends PlayerEvent {
|
|
1566
|
+
type: "TrackExceptionEvent";
|
|
1567
|
+
exception?: Exception;
|
|
1568
|
+
track: LavalinkTrack;
|
|
1569
|
+
error: string;
|
|
1570
|
+
}
|
|
1571
|
+
interface TrackStuckEvent extends PlayerEvent {
|
|
1572
|
+
type: "TrackStuckEvent";
|
|
1573
|
+
thresholdMs: number;
|
|
1574
|
+
track: LavalinkTrack;
|
|
1575
|
+
}
|
|
1576
|
+
interface WebSocketClosedEvent extends PlayerEvent {
|
|
1577
|
+
type: "WebSocketClosedEvent";
|
|
1578
|
+
code: number;
|
|
1579
|
+
byRemote: boolean;
|
|
1580
|
+
reason: string;
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Types & Events for Sponsorblock-plugin from Lavalink: https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
|
|
1584
|
+
*/
|
|
1585
|
+
type SponsorBlockSegmentEvents = SponsorBlockSegmentSkipped | SponsorBlockSegmentsLoaded | SponsorBlockChapterStarted | SponsorBlockChaptersLoaded;
|
|
1586
|
+
type SponsorBlockSegmentEventType = "SegmentSkipped" | "SegmentsLoaded" | "ChaptersLoaded" | "ChapterStarted";
|
|
1587
|
+
interface SponsorBlockSegmentsLoaded extends PlayerEvent {
|
|
1588
|
+
type: "SegmentsLoaded";
|
|
1589
|
+
segments: {
|
|
1590
|
+
category: string;
|
|
1591
|
+
start: number;
|
|
1592
|
+
end: number;
|
|
1593
|
+
}[];
|
|
1594
|
+
}
|
|
1595
|
+
interface SponsorBlockSegmentSkipped extends PlayerEvent {
|
|
1596
|
+
type: "SegmentSkipped";
|
|
1597
|
+
segment: {
|
|
1598
|
+
category: string;
|
|
1599
|
+
start: number;
|
|
1600
|
+
end: number;
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
interface SponsorBlockChapterStarted extends PlayerEvent {
|
|
1604
|
+
type: "ChapterStarted";
|
|
1605
|
+
/** The Chapter which started */
|
|
1606
|
+
chapter: {
|
|
1607
|
+
/** The Name of the Chapter */
|
|
1608
|
+
name: string;
|
|
1609
|
+
start: number;
|
|
1610
|
+
end: number;
|
|
1611
|
+
duration: number;
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
interface SponsorBlockChaptersLoaded extends PlayerEvent {
|
|
1615
|
+
type: "ChaptersLoaded";
|
|
1616
|
+
/** All Chapters loaded */
|
|
1617
|
+
chapters: {
|
|
1618
|
+
/** The Name of the Chapter */
|
|
1619
|
+
name: string;
|
|
1620
|
+
start: number;
|
|
1621
|
+
end: number;
|
|
1622
|
+
duration: number;
|
|
1623
|
+
}[];
|
|
1624
|
+
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Types & Events for Lyrics plugin from Lavalink: https://github.com/topi314/LavaLyrics
|
|
1627
|
+
*/
|
|
1628
|
+
type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
|
|
1629
|
+
type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
|
|
1630
|
+
interface LyricsFoundEvent extends PlayerEvent {
|
|
1631
|
+
/** The lyricsfound event */
|
|
1632
|
+
type: "LyricsFoundEvent";
|
|
1633
|
+
/** The guildId */
|
|
1634
|
+
guildId: string;
|
|
1635
|
+
/** The lyrics */
|
|
1636
|
+
lyrics: LyricsResult;
|
|
1637
|
+
}
|
|
1638
|
+
interface LyricsFoundEvent extends PlayerEvent {
|
|
1639
|
+
/** The lyricsfound event */
|
|
1640
|
+
type: "LyricsFoundEvent";
|
|
1641
|
+
/** The guildId */
|
|
1642
|
+
guildId: string;
|
|
1643
|
+
/** The lyrics */
|
|
1644
|
+
lyrics: LyricsResult;
|
|
1645
|
+
}
|
|
1646
|
+
interface LyricsNotFoundEvent extends PlayerEvent {
|
|
1647
|
+
/**The lyricsnotfound event*/
|
|
1648
|
+
type: "LyricsNotFoundEvent";
|
|
1649
|
+
/**The guildId*/
|
|
1650
|
+
guildId: string;
|
|
1651
|
+
}
|
|
1652
|
+
interface LyricsNotFoundEvent extends PlayerEvent {
|
|
1653
|
+
/**The lyricsnotfound event*/
|
|
1654
|
+
type: "LyricsNotFoundEvent";
|
|
1655
|
+
/**The guildId*/
|
|
1656
|
+
guildId: string;
|
|
1657
|
+
}
|
|
1658
|
+
interface LyricsLineEvent extends PlayerEvent {
|
|
1659
|
+
/**The lyricsline event*/
|
|
1660
|
+
type: "LyricsLineEvent";
|
|
1661
|
+
/** The guildId */
|
|
1662
|
+
guildId: string;
|
|
1663
|
+
/** The line number */
|
|
1664
|
+
lineIndex: number;
|
|
1665
|
+
/** The line */
|
|
1666
|
+
line: LyricsLine;
|
|
1667
|
+
/**skipped is true if the line was skipped */
|
|
1668
|
+
skipped: boolean;
|
|
1669
|
+
}
|
|
1670
|
+
interface LyricsLineEvent extends PlayerEvent {
|
|
1671
|
+
/**The lyricsline event*/
|
|
1672
|
+
type: "LyricsLineEvent";
|
|
1673
|
+
/** The guildId */
|
|
1674
|
+
guildId: string;
|
|
1675
|
+
/** The line number */
|
|
1676
|
+
lineIndex: number;
|
|
1677
|
+
/** The line */
|
|
1678
|
+
line: LyricsLine;
|
|
1679
|
+
/**skipped is true if the line was skipped */
|
|
1680
|
+
skipped: boolean;
|
|
1681
|
+
}
|
|
1682
|
+
type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
|
|
1683
|
+
type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
|
|
1684
|
+
type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
|
|
1685
|
+
type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
|
|
1686
|
+
interface InvalidLavalinkRestRequest {
|
|
1687
|
+
/** Rest Request Data for when it was made */
|
|
1688
|
+
timestamp: number;
|
|
1689
|
+
/** Status of the request */
|
|
1690
|
+
status: number;
|
|
1691
|
+
/** Specific Errro which was sent */
|
|
1692
|
+
error: string;
|
|
1693
|
+
/** Specific Message which was created */
|
|
1694
|
+
message?: string;
|
|
1695
|
+
/** The specific error trace from the request */
|
|
1696
|
+
trace?: unknown;
|
|
1697
|
+
/** Path of where it's from */
|
|
1698
|
+
path: string;
|
|
1699
|
+
}
|
|
1700
|
+
interface LavalinkPlayerVoice {
|
|
1701
|
+
/** The Voice Token */
|
|
1702
|
+
token: string;
|
|
1703
|
+
/** The Voice Server Endpoint */
|
|
1704
|
+
endpoint: string;
|
|
1705
|
+
/** The Voice SessionId */
|
|
1706
|
+
sessionId: string;
|
|
1707
|
+
/** Wether or not the player is connected */
|
|
1708
|
+
connected?: boolean;
|
|
1709
|
+
/** The Ping to the voice server */
|
|
1710
|
+
ping?: number;
|
|
1711
|
+
}
|
|
1712
|
+
type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
|
|
1713
|
+
interface FailingAddress {
|
|
1714
|
+
/** The failing address */
|
|
1715
|
+
failingAddress: string;
|
|
1716
|
+
/** The timestamp when the address failed */
|
|
1717
|
+
failingTimestamp: number;
|
|
1718
|
+
/** The timestamp when the address failed as a pretty string */
|
|
1719
|
+
failingTime: string;
|
|
1720
|
+
}
|
|
1721
|
+
type RoutePlannerTypes = "RotatingIpRoutePlanner" | "NanoIpRoutePlanner" | "RotatingNanoIpRoutePlanner" | "BalancingIpRoutePlanner";
|
|
1722
|
+
interface RoutePlanner {
|
|
1723
|
+
class?: RoutePlannerTypes;
|
|
1724
|
+
details?: {
|
|
1725
|
+
/** The ip block being used */
|
|
1726
|
+
ipBlock: {
|
|
1727
|
+
/** The type of the ip block */
|
|
1728
|
+
type: "Inet4Address" | "Inet6Address";
|
|
1729
|
+
/** The size of the ip block */
|
|
1730
|
+
size: string;
|
|
1731
|
+
};
|
|
1732
|
+
/** The failing addresses */
|
|
1733
|
+
failingAddresses: FailingAddress[];
|
|
1734
|
+
/** The number of rotations */
|
|
1735
|
+
rotateIndex?: string;
|
|
1736
|
+
/** The current offset in the block */
|
|
1737
|
+
ipIndex?: string;
|
|
1738
|
+
/** The current address being used */
|
|
1739
|
+
currentAddress?: string;
|
|
1740
|
+
/** The current offset in the ip block */
|
|
1741
|
+
currentAddressIndex?: string;
|
|
1742
|
+
/** The information in which /64 block ips are chosen. This number increases on each ban. */
|
|
1743
|
+
blockIndex?: string;
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
interface Session {
|
|
1747
|
+
/** Wether or not session is resuming or not */
|
|
1748
|
+
resuming: boolean;
|
|
1749
|
+
/** For how long a session is lasting while not connected */
|
|
1750
|
+
timeout: number;
|
|
1751
|
+
}
|
|
1752
|
+
interface GuildShardPayload {
|
|
1753
|
+
/** The OP code */
|
|
1754
|
+
op: number;
|
|
1755
|
+
/** Data to send */
|
|
1756
|
+
d: {
|
|
1757
|
+
/** Guild id to apply voice settings */
|
|
1758
|
+
guild_id: string;
|
|
1759
|
+
/** channel to move/connect to, or null to leave it */
|
|
1760
|
+
channel_id: string | null;
|
|
1761
|
+
/** wether or not mute yourself */
|
|
1762
|
+
self_mute: boolean;
|
|
1763
|
+
/** wether or not deafen yourself */
|
|
1764
|
+
self_deaf: boolean;
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
interface PlayerUpdateInfo {
|
|
1768
|
+
/** guild id of the player */
|
|
1769
|
+
guildId: string;
|
|
1770
|
+
/** Player options to provide to lavalink */
|
|
1771
|
+
playerOptions: LavalinkPlayOptions;
|
|
1772
|
+
/** Whether or not replace the current track with the new one (true is recommended) */
|
|
1773
|
+
noReplace?: boolean;
|
|
1774
|
+
}
|
|
1775
|
+
interface LavalinkPlayer {
|
|
1776
|
+
/** Guild Id of the player */
|
|
1777
|
+
guildId: string;
|
|
1778
|
+
/** IF playing a track, all of the track information */
|
|
1779
|
+
track?: LavalinkTrack;
|
|
1780
|
+
/** Lavalink volume (mind volumedecrementer) */
|
|
1781
|
+
volume: number;
|
|
1782
|
+
/** Wether it's paused or not */
|
|
1783
|
+
paused: boolean;
|
|
1784
|
+
/** Voice Endpoint data */
|
|
1785
|
+
voice: LavalinkPlayerVoice;
|
|
1786
|
+
/** All Audio Filters */
|
|
1787
|
+
filters: Partial<LavalinkFilterData>;
|
|
1788
|
+
/** Lavalink-Voice-State Variables */
|
|
1789
|
+
state: {
|
|
1790
|
+
/** Time since connection established */
|
|
1791
|
+
time: number;
|
|
1792
|
+
/** Position of the track */
|
|
1793
|
+
position: number;
|
|
1794
|
+
/** COnnected or not */
|
|
1795
|
+
connected: boolean;
|
|
1796
|
+
/** Ping to voice server */
|
|
1797
|
+
ping: number;
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
interface ChannelDeletePacket {
|
|
1801
|
+
/** Packet key for channel delete */
|
|
1802
|
+
t: "CHANNEL_DELETE";
|
|
1803
|
+
/** data which is sent and relevant */
|
|
1804
|
+
d: {
|
|
1805
|
+
/** guild id */
|
|
1806
|
+
guild_id: string;
|
|
1807
|
+
/** Channel id */
|
|
1808
|
+
id: string;
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
interface VoiceState {
|
|
1812
|
+
/** OP key from lavalink */
|
|
1813
|
+
op: "voiceUpdate";
|
|
1814
|
+
/** GuildId provided by lavalink */
|
|
1815
|
+
guildId: string;
|
|
1816
|
+
/** Event data */
|
|
1817
|
+
event: VoiceServer;
|
|
1818
|
+
/** Session Id of the voice connection */
|
|
1819
|
+
sessionId?: string;
|
|
1820
|
+
/** guild id of the voice channel */
|
|
1821
|
+
guild_id: string;
|
|
1822
|
+
/** user id from the voice connection */
|
|
1823
|
+
user_id: string;
|
|
1824
|
+
/** Session Id of the voice connection */
|
|
1825
|
+
session_id: string;
|
|
1826
|
+
/** Voice Channel Id */
|
|
1827
|
+
channel_id: string;
|
|
1828
|
+
/** Server Mute status */
|
|
1829
|
+
mute: boolean;
|
|
1830
|
+
/** Server Deaf status */
|
|
1831
|
+
deaf: boolean;
|
|
1832
|
+
/** Self Deaf status */
|
|
1833
|
+
self_deaf: boolean;
|
|
1834
|
+
/** Self Mute status */
|
|
1835
|
+
self_mute: boolean;
|
|
1836
|
+
/** Self Video (Camera) status */
|
|
1837
|
+
self_video: boolean;
|
|
1838
|
+
/** Self Stream status */
|
|
1839
|
+
self_stream: boolean;
|
|
1840
|
+
/** Wether the user requests to speak (stage channel) */
|
|
1841
|
+
request_to_speak_timestamp: boolean;
|
|
1842
|
+
/** Self suppressed status (stage channel) */
|
|
1843
|
+
suppress: boolean;
|
|
1844
|
+
}
|
|
1845
|
+
/** The Base64 decodes tring by lavalink */
|
|
1846
|
+
type Base64 = string;
|
|
1847
|
+
interface VoiceServer {
|
|
1848
|
+
/** Voice Token */
|
|
1849
|
+
token: string;
|
|
1850
|
+
/** Guild Id of the voice server connection */
|
|
1851
|
+
guild_id: string;
|
|
1852
|
+
/** Server Endpoint */
|
|
1853
|
+
endpoint: string;
|
|
1854
|
+
}
|
|
1855
|
+
interface VoicePacket {
|
|
1856
|
+
/** Voice Packet Keys to send */
|
|
1857
|
+
t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
|
|
1858
|
+
/** Voice Packets to send */
|
|
1859
|
+
d: VoiceState | VoiceServer;
|
|
1860
|
+
}
|
|
1861
|
+
interface NodeMessage extends NodeStats {
|
|
1862
|
+
/** The type of the event */
|
|
1863
|
+
type: PlayerEventType;
|
|
1864
|
+
/** what ops are applying to that event */
|
|
1865
|
+
op: "stats" | "playerUpdate" | "event";
|
|
1866
|
+
/** The specific guild id for that message */
|
|
1867
|
+
guildId: string;
|
|
1868
|
+
}
|
|
1869
|
+
/** Specific types to filter for lavasearch, will be filtered to correct types */
|
|
1870
|
+
type LavaSearchType = "track" | "album" | "artist" | "playlist" | "text" | "tracks" | "albums" | "artists" | "playlists" | "texts";
|
|
1871
|
+
interface LavaSearchFilteredResponse {
|
|
1872
|
+
/** The Information of a playlist provided by lavasearch */
|
|
1873
|
+
info: PlaylistInfo;
|
|
1874
|
+
/** additional plugin information */
|
|
1875
|
+
pluginInfo: PluginInfo;
|
|
1876
|
+
/** List of tracks */
|
|
1877
|
+
tracks: Track[];
|
|
1878
|
+
}
|
|
1879
|
+
interface LavaSearchResponse {
|
|
1880
|
+
/** An array of tracks, only present if track is in types */
|
|
1881
|
+
tracks: Track[];
|
|
1882
|
+
/** An array of albums, only present if album is in types */
|
|
1883
|
+
albums: LavaSearchFilteredResponse[];
|
|
1884
|
+
/** An array of artists, only present if artist is in types */
|
|
1885
|
+
artists: LavaSearchFilteredResponse[];
|
|
1886
|
+
/** An array of playlists, only present if playlist is in types */
|
|
1887
|
+
playlists: LavaSearchFilteredResponse[];
|
|
1888
|
+
/** An array of text results, only present if text is in types */
|
|
1889
|
+
texts: {
|
|
1890
|
+
text: string;
|
|
1891
|
+
pluginInfo: PluginInfo;
|
|
1892
|
+
}[];
|
|
1893
|
+
/** Addition result data provided by plugins */
|
|
1894
|
+
pluginInfo: PluginInfo;
|
|
1895
|
+
}
|
|
1896
|
+
/** SearchQuery Object for raw lavalink requests */
|
|
1897
|
+
type SearchQuery = {
|
|
1898
|
+
/** lavalink search Query / identifier string */
|
|
1899
|
+
query: string;
|
|
1900
|
+
/** Extra url query params to use, e.g. for flowertts */
|
|
1901
|
+
extraQueryUrlParams?: URLSearchParams;
|
|
1902
|
+
/** Source to append to the search query string */
|
|
1903
|
+
source?: SearchPlatform;
|
|
1904
|
+
} | /** Our just the search query / identifier string */ string;
|
|
1905
|
+
/** SearchQuery Object for Lavalink LavaSearch Plugin requests */
|
|
1906
|
+
type LavaSearchQuery = {
|
|
1907
|
+
/** lavalink search Query / identifier string */
|
|
1908
|
+
query: string;
|
|
1909
|
+
/** Source to append to the search query string */
|
|
1910
|
+
source: LavaSrcSearchPlatformBase;
|
|
1911
|
+
/** The Types to filter the search to */
|
|
1912
|
+
types?: LavaSearchType[];
|
|
1913
|
+
};
|
|
1914
|
+
type Awaitable<T> = Promise<T> | T;
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Lavalink Node creator class
|
|
1918
|
+
*/
|
|
1919
|
+
declare class LavalinkNode {
|
|
1920
|
+
private heartBeatPingTimestamp;
|
|
1921
|
+
private heartBeatPongTimestamp;
|
|
1922
|
+
get heartBeatPing(): number;
|
|
1923
|
+
private heartBeatInterval?;
|
|
1924
|
+
private pingTimeout?;
|
|
1925
|
+
isAlive: boolean;
|
|
1926
|
+
/** The provided Options of the Node */
|
|
1927
|
+
options: LavalinkNodeOptions;
|
|
1928
|
+
/** The amount of rest calls the node has made. */
|
|
1929
|
+
calls: number;
|
|
1930
|
+
/** Stats from lavalink, will be updated via an interval by lavalink. */
|
|
1931
|
+
stats: NodeStats;
|
|
1932
|
+
/** The current sessionId, only present when connected */
|
|
1933
|
+
sessionId?: string | null;
|
|
1934
|
+
/** Wether the node resuming is enabled or not */
|
|
1935
|
+
resuming: {
|
|
1936
|
+
enabled: boolean;
|
|
1937
|
+
timeout: number | null;
|
|
1938
|
+
};
|
|
1939
|
+
/** Actual Lavalink Information of the Node */
|
|
1940
|
+
info: LavalinkInfo | null;
|
|
1941
|
+
/** The Node Manager of this Node */
|
|
1942
|
+
private NodeManager;
|
|
1943
|
+
/** The Reconnection Timeout */
|
|
1944
|
+
private reconnectTimeout?;
|
|
1945
|
+
/** The Reconnection Attempt counter */
|
|
1946
|
+
private reconnectAttempts;
|
|
1947
|
+
/** The Socket of the Lavalink */
|
|
1948
|
+
private socket;
|
|
1949
|
+
/** Version of what the Lavalink Server should be */
|
|
1950
|
+
private version;
|
|
1951
|
+
/**
|
|
1952
|
+
* Create a new Node
|
|
1953
|
+
* @param options Lavalink Node Options
|
|
1954
|
+
* @param manager Node Manager
|
|
1955
|
+
*
|
|
1956
|
+
*
|
|
1957
|
+
* @example
|
|
1958
|
+
* ```ts
|
|
1959
|
+
* // don't create a node manually, instead use:
|
|
1960
|
+
*
|
|
1961
|
+
* client.lavalink.nodeManager.createNode(options)
|
|
1962
|
+
* ```
|
|
1963
|
+
*/
|
|
1964
|
+
constructor(options: LavalinkNodeOptions, manager: NodeManager);
|
|
1965
|
+
/**
|
|
1966
|
+
* Raw Request util function
|
|
1967
|
+
* @param endpoint endpoint string
|
|
1968
|
+
* @param modify modify the request
|
|
1969
|
+
* @param extraQueryUrlParams UrlSearchParams to use in a encodedURI, useful for example for flowertts
|
|
1970
|
+
* @returns object containing request and option information
|
|
1971
|
+
*
|
|
1972
|
+
* @example
|
|
1973
|
+
* ```ts
|
|
1974
|
+
* player.node.rawRequest(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET");
|
|
1975
|
+
* ```
|
|
1976
|
+
*/
|
|
1977
|
+
private rawRequest;
|
|
1978
|
+
/**
|
|
1979
|
+
* Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins
|
|
1980
|
+
* @param endpoint The endpoint that we will make the call to
|
|
1981
|
+
* @param modify Used to modify the request before being sent
|
|
1982
|
+
* @returns The returned data
|
|
1983
|
+
*
|
|
1984
|
+
* @example
|
|
1985
|
+
* ```ts
|
|
1986
|
+
* player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);
|
|
1987
|
+
* ```
|
|
1988
|
+
*/
|
|
1989
|
+
request(endpoint: string, modify: ModifyRequest | undefined, parseAsText: true): Promise<string>;
|
|
1990
|
+
request(endpoint: string, modify?: ModifyRequest, parseAsText?: false): Promise<any>;
|
|
1991
|
+
/**
|
|
1992
|
+
* Search something raw on the node, please note only add tracks to players of that node
|
|
1993
|
+
* @param query SearchQuery Object
|
|
1994
|
+
* @param requestUser Request User for creating the player(s)
|
|
1995
|
+
* @param throwOnEmpty Wether to throw on an empty result or not
|
|
1996
|
+
* @returns Searchresult
|
|
1997
|
+
*
|
|
1998
|
+
* @example
|
|
1999
|
+
* ```ts
|
|
2000
|
+
* // use player.search() instead
|
|
2001
|
+
* player.node.search({ query: "Never gonna give you up by Rick Astley", source: "soundcloud" }, interaction.user);
|
|
2002
|
+
* player.node.search({ query: "https://deezer.com/track/123456789" }, interaction.user);
|
|
2003
|
+
* ```
|
|
2004
|
+
*/
|
|
2005
|
+
search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult>;
|
|
2006
|
+
/**
|
|
2007
|
+
* Search something using the lavaSearchPlugin (filtered searches by types)
|
|
2008
|
+
* @param query LavaSearchQuery Object
|
|
2009
|
+
* @param requestUser Request User for creating the player(s)
|
|
2010
|
+
* @param throwOnEmpty Wether to throw on an empty result or not
|
|
2011
|
+
* @returns LavaSearchresult (SearchResult if link is provided)
|
|
2012
|
+
*
|
|
2013
|
+
* @example
|
|
2014
|
+
* ```ts
|
|
2015
|
+
* // use player.search() instead
|
|
2016
|
+
* player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);
|
|
2017
|
+
* ```
|
|
2018
|
+
*/
|
|
2019
|
+
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
|
|
2020
|
+
/**
|
|
2021
|
+
* Update the Player State on the Lavalink Server
|
|
2022
|
+
* @param data data to send to lavalink and sync locally
|
|
2023
|
+
* @returns result from lavalink
|
|
2024
|
+
*
|
|
2025
|
+
* @example
|
|
2026
|
+
* ```ts
|
|
2027
|
+
* // use player.search() instead
|
|
2028
|
+
* player.node.updatePlayer({ guildId: player.guildId, playerOptions: { paused: true } }); // example to pause it
|
|
2029
|
+
* ```
|
|
2030
|
+
*/
|
|
2031
|
+
updatePlayer(data: PlayerUpdateInfo): Promise<LavalinkPlayer>;
|
|
2032
|
+
/**
|
|
2033
|
+
* Destroys the Player on the Lavalink Server
|
|
2034
|
+
* @param guildId
|
|
2035
|
+
* @returns request result
|
|
2036
|
+
*
|
|
2037
|
+
* @example
|
|
2038
|
+
* ```ts
|
|
2039
|
+
* // use player.destroy() instead
|
|
2040
|
+
* player.node.destroyPlayer(player.guildId);
|
|
2041
|
+
* ```
|
|
2042
|
+
*/
|
|
2043
|
+
destroyPlayer(guildId: any): Promise<void>;
|
|
2044
|
+
/**
|
|
2045
|
+
* Connect to the Lavalink Node
|
|
2046
|
+
* @param sessionId Provide the Session Id of the previous connection, to resume the node and it's player(s)
|
|
2047
|
+
* @returns void
|
|
2048
|
+
*
|
|
2049
|
+
* @example
|
|
2050
|
+
* ```ts
|
|
2051
|
+
* player.node.connect(); // if provided on bootup in managerOptions#nodes, this will be called automatically when doing lavalink.init()
|
|
2052
|
+
*
|
|
2053
|
+
* // or connect from a resuming session:
|
|
2054
|
+
* player.node.connect("sessionId");
|
|
2055
|
+
* ```
|
|
2056
|
+
*/
|
|
2057
|
+
connect(sessionId?: string): void;
|
|
2058
|
+
private heartBeat;
|
|
2059
|
+
/**
|
|
2060
|
+
* Get the id of the node
|
|
2061
|
+
*
|
|
2062
|
+
* @example
|
|
2063
|
+
* ```ts
|
|
2064
|
+
* const nodeId = player.node.id;
|
|
2065
|
+
* console.log("node id is: ", nodeId)
|
|
2066
|
+
* ```
|
|
2067
|
+
*/
|
|
2068
|
+
get id(): string;
|
|
2069
|
+
/**
|
|
2070
|
+
* Destroys the Node-Connection (Websocket) and all player's of the node
|
|
2071
|
+
* @param destroyReason Destroy Reason to use when destroying the players
|
|
2072
|
+
* @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
|
|
2073
|
+
* @param movePlayers whether to movePlayers to different eligible connected node. If false players won't be moved @default false
|
|
2074
|
+
* @returns void
|
|
2075
|
+
*
|
|
2076
|
+
* @example
|
|
2077
|
+
* Destroys node and its players
|
|
2078
|
+
* ```ts
|
|
2079
|
+
* player.node.destroy("custom Player Destroy Reason", true);
|
|
2080
|
+
* ```
|
|
2081
|
+
* destroys only the node and moves its players to different connected node.
|
|
2082
|
+
* ```ts
|
|
2083
|
+
* player.node.destroy("custom Player Destroy Reason", true, true);
|
|
2084
|
+
* ```
|
|
2085
|
+
*/
|
|
2086
|
+
destroy(destroyReason?: DestroyReasonsType, deleteNode?: boolean, movePlayers?: boolean): void;
|
|
2087
|
+
/**
|
|
2088
|
+
* Disconnects the Node-Connection (Websocket)
|
|
2089
|
+
* @param disconnectReason Disconnect Reason to use when disconnecting Node
|
|
2090
|
+
* @returns void
|
|
2091
|
+
*
|
|
2092
|
+
* Also the node will not get re-connected again.
|
|
2093
|
+
*
|
|
2094
|
+
* @example
|
|
2095
|
+
* ```ts
|
|
2096
|
+
* player.node.destroy("custom Player Destroy Reason", true);
|
|
2097
|
+
* ```
|
|
2098
|
+
*/
|
|
2099
|
+
disconnect(disconnectReason?: DisconnectReasonsType): void;
|
|
2100
|
+
/**
|
|
2101
|
+
* Returns if connected to the Node.
|
|
2102
|
+
*
|
|
2103
|
+
* @example
|
|
2104
|
+
* ```ts
|
|
2105
|
+
* const isConnected = player.node.connected;
|
|
2106
|
+
* console.log("node is connected: ", isConnected ? "yes" : "no")
|
|
2107
|
+
* ```
|
|
2108
|
+
*/
|
|
2109
|
+
get connected(): boolean;
|
|
2110
|
+
/**
|
|
2111
|
+
* Returns the current ConnectionStatus
|
|
2112
|
+
*
|
|
2113
|
+
* @example
|
|
2114
|
+
* ```ts
|
|
2115
|
+
* try {
|
|
2116
|
+
* const statusOfConnection = player.node.connectionStatus;
|
|
2117
|
+
* console.log("node's connection status is:", statusOfConnection)
|
|
2118
|
+
* } catch (error) {
|
|
2119
|
+
* console.error("no socket available?", error)
|
|
2120
|
+
* }
|
|
2121
|
+
* ```
|
|
2122
|
+
*/
|
|
2123
|
+
get connectionStatus(): string;
|
|
2124
|
+
/**
|
|
2125
|
+
* Gets all Players of a Node
|
|
2126
|
+
* @returns array of players inside of lavalink
|
|
2127
|
+
*
|
|
2128
|
+
* @example
|
|
2129
|
+
* ```ts
|
|
2130
|
+
* const node = lavalink.nodes.get("NODEID");
|
|
2131
|
+
* const playersOfLavalink = await node?.fetchAllPlayers();
|
|
2132
|
+
* ```
|
|
2133
|
+
*/
|
|
2134
|
+
fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest | null>;
|
|
2135
|
+
/**
|
|
2136
|
+
* Gets specific Player Information
|
|
2137
|
+
* @returns lavalink player object if player exists on lavalink
|
|
2138
|
+
*
|
|
2139
|
+
* @example
|
|
2140
|
+
* ```ts
|
|
2141
|
+
* const node = lavalink.nodes.get("NODEID");
|
|
2142
|
+
* const playerInformation = await node?.fetchPlayer("guildId");
|
|
2143
|
+
* ```
|
|
2144
|
+
*/
|
|
2145
|
+
fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest | null>;
|
|
2146
|
+
/**
|
|
2147
|
+
* Updates the session with and enables/disables resuming and timeout
|
|
2148
|
+
* @param resuming Whether resuming is enabled for this session or not
|
|
2149
|
+
* @param timeout The timeout in seconds (default is 60s)
|
|
2150
|
+
* @returns the result of the request
|
|
2151
|
+
*
|
|
2152
|
+
* @example
|
|
2153
|
+
* ```ts
|
|
2154
|
+
* const node = player.node || lavalink.nodes.get("NODEID");
|
|
2155
|
+
* await node?.updateSession(true, 180e3); // will enable resuming for 180seconds
|
|
2156
|
+
* ```
|
|
2157
|
+
*/
|
|
2158
|
+
updateSession(resuming?: boolean, timeout?: number): Promise<Session | InvalidLavalinkRestRequest | null>;
|
|
2159
|
+
/**
|
|
2160
|
+
* Decode Track or Tracks
|
|
2161
|
+
*/
|
|
2162
|
+
decode: {
|
|
2163
|
+
/**
|
|
2164
|
+
* Decode a single track into its info
|
|
2165
|
+
* @param encoded valid encoded base64 string from a track
|
|
2166
|
+
* @param requester the requesteruser for building the track
|
|
2167
|
+
* @returns decoded track from lavalink
|
|
2168
|
+
*
|
|
2169
|
+
* @example
|
|
2170
|
+
* ```ts
|
|
2171
|
+
* const encodedBase64 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
|
|
2172
|
+
* const track = await player.node.decode.singleTrack(encodedBase64, interaction.user);
|
|
2173
|
+
* ```
|
|
2174
|
+
*/
|
|
2175
|
+
singleTrack: (encoded: Base64, requester: unknown) => Promise<Track>;
|
|
2176
|
+
/**
|
|
2177
|
+
* Decodes multiple tracks into their info
|
|
2178
|
+
* @param encodeds valid encoded base64 string array from all tracks
|
|
2179
|
+
* @param requester the requesteruser for building the tracks
|
|
2180
|
+
* @returns array of all tracks you decoded
|
|
2181
|
+
*
|
|
2182
|
+
* @example
|
|
2183
|
+
* ```ts
|
|
2184
|
+
* const encodedBase64_1 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
|
|
2185
|
+
* const encodedBase64_2 = 'QAABJAMAClRhbGsgYSBMb3QACjQwNHZpbmNlbnQAAAAAAAHr1gBxTzpodHRwczovL2FwaS12Mi5zb3VuZGNsb3VkLmNvbS9tZWRpYS9zb3VuZGNsb3VkOnRyYWNrczo4NTE0MjEwNzYvMzUyYTRiOTAtNzYxOS00M2E5LWJiOGItMjIxMzE0YzFjNjNhL3N0cmVhbS9obHMAAQAsaHR0cHM6Ly9zb3VuZGNsb3VkLmNvbS80MDR2aW5jZW50L3RhbGstYS1sb3QBADpodHRwczovL2kxLnNuZGNkbi5jb20vYXJ0d29ya3MtRTN1ek5Gc0Y4QzBXLTAtb3JpZ2luYWwuanBnAQAMUVpITkExOTg1Nzg0AApzb3VuZGNsb3VkAAAAAAAAAAA=';
|
|
2186
|
+
* const tracks = await player.node.decode.multipleTracks([encodedBase64_1, encodedBase64_2], interaction.user);
|
|
2187
|
+
* ```
|
|
2188
|
+
*/
|
|
2189
|
+
multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
|
|
2190
|
+
};
|
|
2191
|
+
lyrics: {
|
|
2192
|
+
/**
|
|
2193
|
+
* Get the lyrics of a track
|
|
2194
|
+
* @param track the track to get the lyrics for
|
|
2195
|
+
* @param skipTrackSource wether to skip the track source or not
|
|
2196
|
+
* @returns the lyrics of the track
|
|
2197
|
+
* @example
|
|
2198
|
+
*
|
|
2199
|
+
* ```ts
|
|
2200
|
+
* const lyrics = await player.node.lyrics.get(track, true);
|
|
2201
|
+
* // use it of player instead:
|
|
2202
|
+
* // const lyrics = await player.getLyrics(track, true);
|
|
2203
|
+
* ```
|
|
2204
|
+
*/
|
|
2205
|
+
get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
|
|
2206
|
+
/**
|
|
2207
|
+
* Get the lyrics of the current playing track
|
|
2208
|
+
*
|
|
2209
|
+
* @param guildId the guild id of the player
|
|
2210
|
+
* @param skipTrackSource wether to skip the track source or not
|
|
2211
|
+
* @returns the lyrics of the current playing track
|
|
2212
|
+
* @example
|
|
2213
|
+
* ```ts
|
|
2214
|
+
* const lyrics = await player.node.lyrics.getCurrent(guildId);
|
|
2215
|
+
* // use it of player instead:
|
|
2216
|
+
* // const lyrics = await player.getCurrentLyrics();
|
|
2217
|
+
* ```
|
|
2218
|
+
*/
|
|
2219
|
+
getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
|
|
2220
|
+
/**
|
|
2221
|
+
* subscribe to lyrics updates for a guild
|
|
2222
|
+
* @param guildId the guild id of the player
|
|
2223
|
+
* @returns request data of the request
|
|
2224
|
+
*
|
|
2225
|
+
* @example
|
|
2226
|
+
* ```ts
|
|
2227
|
+
* await player.node.lyrics.subscribe(guildId);
|
|
2228
|
+
* // use it of player instead:
|
|
2229
|
+
* // const lyrics = await player.subscribeLyrics();
|
|
2230
|
+
* ```
|
|
2231
|
+
*/
|
|
2232
|
+
subscribe: (guildId: string) => Promise<unknown>;
|
|
2233
|
+
/**
|
|
2234
|
+
* unsubscribe from lyrics updates for a guild
|
|
2235
|
+
* @param guildId the guild id of the player
|
|
2236
|
+
* @returns request data of the request
|
|
2237
|
+
*
|
|
2238
|
+
* @example
|
|
2239
|
+
* ```ts
|
|
2240
|
+
* await player.node.lyrics.unsubscribe(guildId);
|
|
2241
|
+
* // use it of player instead:
|
|
2242
|
+
* // const lyrics = await player.unsubscribeLyrics();
|
|
2243
|
+
* ```
|
|
2244
|
+
*/
|
|
2245
|
+
unsubscribe: (guildId: string) => Promise<void>;
|
|
2246
|
+
};
|
|
2247
|
+
/**
|
|
2248
|
+
* Request Lavalink statistics.
|
|
2249
|
+
* @returns the lavalink node stats
|
|
2250
|
+
*
|
|
2251
|
+
* @example
|
|
2252
|
+
* ```ts
|
|
2253
|
+
* const lavalinkStats = await player.node.fetchStats();
|
|
2254
|
+
* ```
|
|
2255
|
+
*/
|
|
2256
|
+
fetchStats(): Promise<BaseNodeStats>;
|
|
2257
|
+
/**
|
|
2258
|
+
* Request Lavalink version.
|
|
2259
|
+
* @returns the current used lavalink version
|
|
2260
|
+
*
|
|
2261
|
+
* @example
|
|
2262
|
+
* ```ts
|
|
2263
|
+
* const lavalinkVersion = await player.node.fetchVersion();
|
|
2264
|
+
* ```
|
|
2265
|
+
*/
|
|
2266
|
+
fetchVersion(): Promise<string>;
|
|
2267
|
+
/**
|
|
2268
|
+
* Request Lavalink information.
|
|
2269
|
+
* @returns lavalink info object
|
|
2270
|
+
*
|
|
2271
|
+
* @example
|
|
2272
|
+
* ```ts
|
|
2273
|
+
* const lavalinkInfo = await player.node.fetchInfo();
|
|
2274
|
+
* const availablePlugins:string[] = lavalinkInfo.plugins.map(plugin => plugin.name);
|
|
2275
|
+
* const availableSources:string[] = lavalinkInfo.sourceManagers;
|
|
2276
|
+
* ```
|
|
2277
|
+
*/
|
|
2278
|
+
fetchInfo(): Promise<LavalinkInfo>;
|
|
2279
|
+
/**
|
|
2280
|
+
* Lavalink's Route Planner Api
|
|
2281
|
+
*/
|
|
2282
|
+
routePlannerApi: {
|
|
2283
|
+
/**
|
|
2284
|
+
* Get routplanner Info from Lavalink for ip rotation
|
|
2285
|
+
* @returns the status of the routeplanner
|
|
2286
|
+
*
|
|
2287
|
+
* @example
|
|
2288
|
+
* ```ts
|
|
2289
|
+
* const routePlannerStatus = await player.node.routePlannerApi.getStatus();
|
|
2290
|
+
* const usedBlock = routePlannerStatus.details?.ipBlock;
|
|
2291
|
+
* const currentIp = routePlannerStatus.currentAddress;
|
|
2292
|
+
* ```
|
|
2293
|
+
*/
|
|
2294
|
+
getStatus: () => Promise<RoutePlanner>;
|
|
2295
|
+
/**
|
|
2296
|
+
* Release blacklisted IP address into pool of IPs for ip rotation
|
|
2297
|
+
* @param address IP address
|
|
2298
|
+
* @returns request data of the request
|
|
2299
|
+
*
|
|
2300
|
+
* @example
|
|
2301
|
+
* ```ts
|
|
2302
|
+
* await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
|
|
2303
|
+
* ```
|
|
2304
|
+
*/
|
|
2305
|
+
unmarkFailedAddress: (address: string) => Promise<unknown>;
|
|
2306
|
+
/**
|
|
2307
|
+
* Release all blacklisted IP addresses into pool of IPs
|
|
2308
|
+
* @returns request data of the request
|
|
2309
|
+
*
|
|
2310
|
+
* @example
|
|
2311
|
+
* ```ts
|
|
2312
|
+
* await player.node.routePlannerApi.unmarkAllFailedAddresses();
|
|
2313
|
+
* ```
|
|
2314
|
+
*/
|
|
2315
|
+
unmarkAllFailedAddresses: () => Promise<unknown>;
|
|
2316
|
+
};
|
|
2317
|
+
/** @private Utils for validating the */
|
|
2318
|
+
private validate;
|
|
2319
|
+
/**
|
|
2320
|
+
* Sync the data of the player you make an action to lavalink to
|
|
2321
|
+
* @param data data to use to update the player
|
|
2322
|
+
* @param res result data from lavalink, to override, if available
|
|
2323
|
+
* @returns boolean
|
|
2324
|
+
*/
|
|
2325
|
+
private syncPlayerData;
|
|
2326
|
+
/**
|
|
2327
|
+
* Get the rest Adress for making requests
|
|
2328
|
+
*/
|
|
2329
|
+
private get restAddress();
|
|
2330
|
+
/**
|
|
2331
|
+
* Reconnect to the lavalink node
|
|
2332
|
+
* @param instaReconnect @default false wether to instantly try to reconnect
|
|
2333
|
+
* @returns void
|
|
2334
|
+
*
|
|
2335
|
+
* @example
|
|
2336
|
+
* ```ts
|
|
2337
|
+
* await player.node.reconnect();
|
|
2338
|
+
* ```
|
|
2339
|
+
*/
|
|
2340
|
+
private reconnect;
|
|
2341
|
+
/** @private util function for handling opening events from websocket */
|
|
2342
|
+
private open;
|
|
2343
|
+
/** @private util function for handling closing events from websocket */
|
|
2344
|
+
private close;
|
|
2345
|
+
/** @private util function for handling error events from websocket */
|
|
2346
|
+
private error;
|
|
2347
|
+
/** @private util function for handling message events from websocket */
|
|
2348
|
+
private message;
|
|
2349
|
+
/** @private middleware util function for handling all kind of events from websocket */
|
|
2350
|
+
private handleEvent;
|
|
2351
|
+
private getTrackOfPayload;
|
|
2352
|
+
/** @private util function for handling trackStart event */
|
|
2353
|
+
private trackStart;
|
|
2354
|
+
/** @private util function for handling trackEnd event */
|
|
2355
|
+
private trackEnd;
|
|
2356
|
+
/** @private util function for handling trackStuck event */
|
|
2357
|
+
private trackStuck;
|
|
2358
|
+
/** @private util function for handling trackError event */
|
|
2359
|
+
private trackError;
|
|
2360
|
+
/** @private util function for handling socketClosed event */
|
|
2361
|
+
private socketClosed;
|
|
2362
|
+
/** @private util function for handling SponsorBlock Segmentloaded event */
|
|
2363
|
+
private SponsorBlockSegmentLoaded;
|
|
2364
|
+
/** @private util function for handling SponsorBlock SegmentSkipped event */
|
|
2365
|
+
private SponsorBlockSegmentSkipped;
|
|
2366
|
+
/** @private util function for handling SponsorBlock Chaptersloaded event */
|
|
2367
|
+
private SponsorBlockChaptersLoaded;
|
|
2368
|
+
/** @private util function for handling SponsorBlock Chaptersstarted event */
|
|
2369
|
+
private SponsorBlockChapterStarted;
|
|
2370
|
+
/**
|
|
2371
|
+
* Get the current sponsorblocks for the sponsorblock plugin
|
|
2372
|
+
* @param player passthrough the player
|
|
2373
|
+
* @returns sponsorblock seggment from lavalink
|
|
2374
|
+
*
|
|
2375
|
+
* @example
|
|
2376
|
+
* ```ts
|
|
2377
|
+
* // use it on the player via player.getSponsorBlock();
|
|
2378
|
+
* const sponsorBlockSegments = await player.node.getSponsorBlock(player);
|
|
2379
|
+
* ```
|
|
2380
|
+
*/
|
|
2381
|
+
getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;
|
|
2382
|
+
/**
|
|
2383
|
+
* Set the current sponsorblocks for the sponsorblock plugin
|
|
2384
|
+
* @param player passthrough the player
|
|
2385
|
+
* @returns void
|
|
2386
|
+
*
|
|
2387
|
+
* @example
|
|
2388
|
+
* ```ts
|
|
2389
|
+
* // use it on the player via player.setSponsorBlock();
|
|
2390
|
+
* const sponsorBlockSegments = await player.node.setSponsorBlock(player, ["sponsor", "selfpromo"]);
|
|
2391
|
+
* ```
|
|
2392
|
+
*/
|
|
2393
|
+
setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;
|
|
2394
|
+
/**
|
|
2395
|
+
* Delete the sponsorblock plugins
|
|
2396
|
+
* @param player passthrough the player
|
|
2397
|
+
* @returns void
|
|
2398
|
+
*
|
|
2399
|
+
* @example
|
|
2400
|
+
* ```ts
|
|
2401
|
+
* // use it on the player via player.deleteSponsorBlock();
|
|
2402
|
+
* const sponsorBlockSegments = await player.node.deleteSponsorBlock(player);
|
|
2403
|
+
* ```
|
|
2404
|
+
*/
|
|
2405
|
+
deleteSponsorBlock(player: Player): Promise<void>;
|
|
2406
|
+
/** private util function for handling the queue end event */
|
|
2407
|
+
private queueEnd;
|
|
2408
|
+
/**
|
|
2409
|
+
* Emitted whenever a line of lyrics gets emitted
|
|
2410
|
+
* @event
|
|
2411
|
+
* @param {Player} player The player that emitted the event
|
|
2412
|
+
* @param {Track} track The track that emitted the event
|
|
2413
|
+
* @param {LyricsLineEvent} payload The payload of the event
|
|
2414
|
+
*/
|
|
2415
|
+
private LyricsLine;
|
|
2416
|
+
/**
|
|
2417
|
+
* Emitted whenever the lyrics for a track got found
|
|
2418
|
+
* @event
|
|
2419
|
+
* @param {Player} player The player that emitted the event
|
|
2420
|
+
* @param {Track} track The track that emitted the event
|
|
2421
|
+
* @param {LyricsFoundEvent} payload The payload of the event
|
|
2422
|
+
*/
|
|
2423
|
+
private LyricsFound;
|
|
2424
|
+
/**
|
|
2425
|
+
* Emitted whenever the lyrics for a track got not found
|
|
2426
|
+
* @event
|
|
2427
|
+
* @param {Player} player The player that emitted the event
|
|
2428
|
+
* @param {Track} track The track that emitted the event
|
|
2429
|
+
* @param {LyricsNotFoundEvent} payload The payload of the event
|
|
2430
|
+
*/
|
|
2431
|
+
private LyricsNotFound;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
declare class NodeManager extends EventEmitter {
|
|
2435
|
+
/**
|
|
2436
|
+
* Emit an event
|
|
2437
|
+
* @param event The event to emit
|
|
2438
|
+
* @param args The arguments to pass to the event
|
|
2439
|
+
* @returns
|
|
2440
|
+
*/
|
|
2441
|
+
emit<Event extends keyof NodeManagerEvents>(event: Event, ...args: Parameters<NodeManagerEvents[Event]>): boolean;
|
|
2442
|
+
/**
|
|
2443
|
+
* Add an event listener
|
|
2444
|
+
* @param event The event to listen to
|
|
2445
|
+
* @param listener The listener to add
|
|
2446
|
+
* @returns
|
|
2447
|
+
*/
|
|
2448
|
+
on<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
2449
|
+
/**
|
|
2450
|
+
* Add an event listener that only fires once
|
|
2451
|
+
* @param event The event to listen to
|
|
2452
|
+
* @param listener The listener to add
|
|
2453
|
+
* @returns
|
|
2454
|
+
*/
|
|
2455
|
+
once<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
2456
|
+
/**
|
|
2457
|
+
* Remove an event listener
|
|
2458
|
+
* @param event The event to remove the listener from
|
|
2459
|
+
* @param listener The listener to remove
|
|
2460
|
+
* @returns
|
|
2461
|
+
*/
|
|
2462
|
+
off<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
2463
|
+
/**
|
|
2464
|
+
* Remove an event listener
|
|
2465
|
+
* @param event The event to remove the listener from
|
|
2466
|
+
* @param listener The listener to remove
|
|
2467
|
+
* @returns
|
|
2468
|
+
*/
|
|
2469
|
+
removeListener<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
2470
|
+
/**
|
|
2471
|
+
* The LavalinkManager that created this NodeManager
|
|
2472
|
+
*/
|
|
2473
|
+
LavalinkManager: LavalinkManager;
|
|
2474
|
+
/**
|
|
2475
|
+
* A map of all nodes in the nodeManager
|
|
2476
|
+
*/
|
|
2477
|
+
nodes: MiniMap<string, LavalinkNode>;
|
|
2478
|
+
/**
|
|
2479
|
+
* @param LavalinkManager The LavalinkManager that created this NodeManager
|
|
2480
|
+
*/
|
|
2481
|
+
constructor(LavalinkManager: LavalinkManager);
|
|
2482
|
+
/**
|
|
2483
|
+
* Disconnects all Nodes from lavalink ws sockets
|
|
2484
|
+
* @param deleteAllNodes if the nodes should also be deleted from nodeManager.nodes
|
|
2485
|
+
* @param destroyPlayers if the players should be destroyed
|
|
2486
|
+
* @returns amount of disconnected Nodes
|
|
2487
|
+
*/
|
|
2488
|
+
disconnectAll(deleteAllNodes?: boolean, destroyPlayers?: boolean): Promise<number>;
|
|
2489
|
+
/**
|
|
2490
|
+
* Connects all not connected nodes
|
|
2491
|
+
* @returns Amount of connected Nodes
|
|
2492
|
+
*/
|
|
2493
|
+
connectAll(): Promise<number>;
|
|
2494
|
+
/**
|
|
2495
|
+
* Forcefully reconnects all nodes
|
|
2496
|
+
* @returns amount of nodes
|
|
2497
|
+
*/
|
|
2498
|
+
reconnectAll(): Promise<number>;
|
|
2499
|
+
/**
|
|
2500
|
+
* Create a node and add it to the nodeManager
|
|
2501
|
+
* @param options The options for the node
|
|
2502
|
+
* @returns The node that was created
|
|
2503
|
+
*/
|
|
2504
|
+
createNode(options: LavalinkNodeOptions): LavalinkNode;
|
|
2505
|
+
/**
|
|
2506
|
+
* Get the nodes sorted for the least usage, by a sorttype
|
|
2507
|
+
* @param sortType The type of sorting to use
|
|
2508
|
+
* @returns
|
|
2509
|
+
*/
|
|
2510
|
+
leastUsedNodes(sortType?: "memory" | "cpuLavalink" | "cpuSystem" | "calls" | "playingPlayers" | "players"): LavalinkNode[];
|
|
2511
|
+
/**
|
|
2512
|
+
* Delete a node from the nodeManager and destroy it
|
|
2513
|
+
* @param node The node to delete
|
|
2514
|
+
* @param movePlayers whether to movePlayers to different connected node before deletion. @default false
|
|
2515
|
+
* @returns
|
|
2516
|
+
*
|
|
2517
|
+
* @example
|
|
2518
|
+
* Deletes the node
|
|
2519
|
+
* ```ts
|
|
2520
|
+
* client.lavalink.nodeManager.deleteNode("nodeId to delete");
|
|
2521
|
+
* ```
|
|
2522
|
+
* Moves players to a different node before deleting
|
|
2523
|
+
* ```ts
|
|
2524
|
+
* client.lavalink.nodeManager.deleteNode("nodeId to delete", true);
|
|
2525
|
+
* ```
|
|
2526
|
+
*/
|
|
2527
|
+
deleteNode(node: LavalinkNodeIdentifier | LavalinkNode, movePlayers?: boolean): void;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
/**
|
|
2531
|
+
* The events from the lavalink Manager
|
|
2532
|
+
*/
|
|
2533
|
+
interface LavalinkManagerEvents {
|
|
2534
|
+
/**
|
|
2535
|
+
* Emitted when a Track started playing.
|
|
2536
|
+
* @event Manager#trackStart
|
|
2537
|
+
*/
|
|
2538
|
+
"trackStart": (player: Player, track: Track | null, payload: TrackStartEvent) => void;
|
|
2539
|
+
/**
|
|
2540
|
+
* Emitted when a Track finished.
|
|
2541
|
+
* @event Manager#trackEnd
|
|
2542
|
+
*/
|
|
2543
|
+
"trackEnd": (player: Player, track: Track | null, payload: TrackEndEvent) => void;
|
|
2544
|
+
/**
|
|
2545
|
+
* Emitted when a Track got stuck while playing.
|
|
2546
|
+
* @event Manager#trackStuck
|
|
2547
|
+
*/
|
|
2548
|
+
"trackStuck": (player: Player, track: Track | null, payload: TrackStuckEvent) => void;
|
|
2549
|
+
/**
|
|
2550
|
+
* Emitted when a Track errored.
|
|
2551
|
+
* @event Manager#trackError
|
|
2552
|
+
*/
|
|
2553
|
+
"trackError": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
|
|
2554
|
+
/**
|
|
2555
|
+
* Emitted when the Playing finished and no more tracks in the queue.
|
|
2556
|
+
* @event Manager#queueEnd
|
|
2557
|
+
*/
|
|
2558
|
+
"queueEnd": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackEndEvent | TrackStuckEvent | TrackExceptionEvent) => void;
|
|
2559
|
+
/**
|
|
2560
|
+
* Emitted when a Player is created.
|
|
2561
|
+
* @event Manager#playerCreate
|
|
2562
|
+
*/
|
|
2563
|
+
"playerCreate": (player: Player) => void;
|
|
2564
|
+
/**
|
|
2565
|
+
* Emitted when a Player is moved within the channel.
|
|
2566
|
+
* @event Manager#playerMove
|
|
2567
|
+
*/
|
|
2568
|
+
"playerMove": (player: Player, oldVoiceChannelId: string, newVoiceChannelId: string) => void;
|
|
2569
|
+
/**
|
|
2570
|
+
* Emitted when a Player is disconnected from a channel.
|
|
2571
|
+
* @event Manager#playerDisconnect
|
|
2572
|
+
*/
|
|
2573
|
+
"playerDisconnect": (player: Player, voiceChannelId: string) => void;
|
|
2574
|
+
/**
|
|
2575
|
+
* Emitted when a Node-Socket got closed for a specific Player.
|
|
2576
|
+
* 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.
|
|
2577
|
+
*
|
|
2578
|
+
* So this is just information, normally lavalink should handle disconnections
|
|
2579
|
+
*
|
|
2580
|
+
* Discord Docs:
|
|
2581
|
+
* @link https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
|
|
2582
|
+
*
|
|
2583
|
+
* Lavalink Docs:
|
|
2584
|
+
* @link https://lavalink.dev/api/websocket.html#websocketclosedevent
|
|
2585
|
+
* @event Manager#playerSocketClosed
|
|
2586
|
+
*/
|
|
2587
|
+
"playerSocketClosed": (player: Player, payload: WebSocketClosedEvent) => void;
|
|
2588
|
+
/**
|
|
2589
|
+
* Emitted when a Player get's destroyed
|
|
2590
|
+
* @event Manager#playerDestroy
|
|
2591
|
+
*/
|
|
2592
|
+
"playerDestroy": (player: Player, destroyReason?: DestroyReasonsType) => void;
|
|
2593
|
+
/**
|
|
2594
|
+
* Always emits when the player (on lavalink side) got updated
|
|
2595
|
+
* @event Manager#playerUpdate
|
|
2596
|
+
*/
|
|
2597
|
+
"playerUpdate": (oldPlayerJson: PlayerJson, newPlayer: Player) => void;
|
|
2598
|
+
/**
|
|
2599
|
+
* Emitted when the player's selfMuted or serverMuted state changed (true -> false | false -> true)
|
|
2600
|
+
* @event Manager#playerMuteChange
|
|
2601
|
+
*/
|
|
2602
|
+
"playerMuteChange": (player: Player, selfMuted: boolean, serverMuted: boolean) => void;
|
|
2603
|
+
/**
|
|
2604
|
+
* Emitted when the player's selfDeafed or serverDeafed state changed (true -> false | false -> true)
|
|
2605
|
+
* @event Manager#playerDeafChange
|
|
2606
|
+
*/
|
|
2607
|
+
"playerDeafChange": (player: Player, selfDeafed: boolean, serverDeafed: boolean) => void;
|
|
2608
|
+
/**
|
|
2609
|
+
* Emitted when the player's suppressed (true -> false | false -> true)
|
|
2610
|
+
* @event Manager#playerSuppressChange
|
|
2611
|
+
*/
|
|
2612
|
+
"playerSuppressChange": (player: Player, suppress: boolean) => void;
|
|
2613
|
+
/**
|
|
2614
|
+
* Emitted when the player's queue got empty, and the timeout started
|
|
2615
|
+
* @event Manager#playerQueueEmptyStart
|
|
2616
|
+
*/
|
|
2617
|
+
"playerQueueEmptyStart": (player: Player, timeoutMs: number) => void;
|
|
2618
|
+
/**
|
|
2619
|
+
* Emitted when the player's queue got empty, and the timeout finished leading to destroying the player
|
|
2620
|
+
* @event Manager#playerQueueEmptyEnd
|
|
2621
|
+
*/
|
|
2622
|
+
"playerQueueEmptyEnd": (player: Player) => void;
|
|
2623
|
+
/**
|
|
2624
|
+
* Emitted when the player's queue got empty, and the timeout got cancelled becuase a track got re-added to it.
|
|
2625
|
+
* @event Manager#playerQueueEmptyEnd
|
|
2626
|
+
*/
|
|
2627
|
+
"playerQueueEmptyCancel": (player: Player) => void;
|
|
2628
|
+
/**
|
|
2629
|
+
* Emitted, when a user joins the voice channel, while there is a player existing
|
|
2630
|
+
* @event Manager#playerQueueEmptyStart
|
|
2631
|
+
*/
|
|
2632
|
+
"playerVoiceJoin": (player: Player, userId: string) => void;
|
|
2633
|
+
/**
|
|
2634
|
+
* Emitted, when a user leaves the voice channel, while there is a player existing
|
|
2635
|
+
* @event Manager#playerQueueEmptyEnd
|
|
2636
|
+
*/
|
|
2637
|
+
"playerVoiceLeave": (player: Player, userId: string) => void;
|
|
2638
|
+
/**
|
|
2639
|
+
* SPONSORBLOCK-PLUGIN EVENT
|
|
2640
|
+
* Emitted when Segments are loaded
|
|
2641
|
+
* @link https://github.com/topi314/Sponsorblock-Plugin#segmentsloaded
|
|
2642
|
+
* @event Manager#trackError
|
|
2643
|
+
*/
|
|
2644
|
+
"SegmentsLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentsLoaded) => void;
|
|
2645
|
+
/**
|
|
2646
|
+
* SPONSORBLOCK-PLUGIN EVENT
|
|
2647
|
+
* Emitted when a specific Segment was skipped
|
|
2648
|
+
* @link https://github.com/topi314/Sponsorblock-Plugin#segmentskipped
|
|
2649
|
+
* @event Manager#trackError
|
|
2650
|
+
*/
|
|
2651
|
+
"SegmentSkipped": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockSegmentSkipped) => void;
|
|
2652
|
+
/**
|
|
2653
|
+
* SPONSORBLOCK-PLUGIN EVENT
|
|
2654
|
+
* Emitted when a specific Chapter starts playing
|
|
2655
|
+
* @link https://github.com/topi314/Sponsorblock-Plugin#chapterstarted
|
|
2656
|
+
* @event Manager#trackError
|
|
2657
|
+
*/
|
|
2658
|
+
"ChapterStarted": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChapterStarted) => void;
|
|
2659
|
+
/**
|
|
2660
|
+
* SPONSORBLOCK-PLUGIN EVENT
|
|
2661
|
+
* Emitted when Chapters are loaded
|
|
2662
|
+
* @link https://github.com/topi314/Sponsorblock-Plugin#chaptersloaded
|
|
2663
|
+
* @event Manager#trackError
|
|
2664
|
+
*/
|
|
2665
|
+
"ChaptersLoaded": (player: Player, track: Track | UnresolvedTrack | null, payload: SponsorBlockChaptersLoaded) => void;
|
|
2666
|
+
/**
|
|
2667
|
+
* Lavalink-Client Debug Event
|
|
2668
|
+
* Emitted for several erros, and logs within lavalink-client, if managerOptions.advancedOptions.enableDebugEvents is true
|
|
2669
|
+
* Useful for debugging the lavalink-client
|
|
2670
|
+
*
|
|
2671
|
+
* @event Manager#debug
|
|
2672
|
+
*/
|
|
2673
|
+
"debug": (eventKey: DebugEvents, eventData: {
|
|
2674
|
+
message: string;
|
|
2675
|
+
state: "log" | "warn" | "error";
|
|
2676
|
+
error?: Error | string;
|
|
2677
|
+
functionLayer: string;
|
|
2678
|
+
}) => void;
|
|
2679
|
+
/**
|
|
2680
|
+
* Emitted when a Lyrics line is received
|
|
2681
|
+
* @link https://github.com/topi314/LavaLyrics
|
|
2682
|
+
* @event Manager#LyricsLine
|
|
2683
|
+
*/
|
|
2684
|
+
"LyricsLine": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
|
|
2685
|
+
/**
|
|
2686
|
+
* Emitted when a Lyrics is found
|
|
2687
|
+
* @link https://github.com/topi314/LavaLyrics
|
|
2688
|
+
* @event Manager#LyricsFound
|
|
2689
|
+
*/
|
|
2690
|
+
"LyricsFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
|
|
2691
|
+
/**
|
|
2692
|
+
* Emitted when a Lyrics is not found
|
|
2693
|
+
* @link https://github.com/topi314/LavaLyrics
|
|
2694
|
+
* @event Manager#LyricsNotFound
|
|
2695
|
+
*/
|
|
2696
|
+
"LyricsNotFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
|
|
2697
|
+
"playerResumed": (player: Player, track: Track | UnresolvedTrack | null) => void;
|
|
2698
|
+
"playerPaused": (player: Player, track: Track | UnresolvedTrack | null) => void;
|
|
2699
|
+
}
|
|
2700
|
+
/**
|
|
2701
|
+
* The Bot client Options needed for the manager
|
|
2702
|
+
*/
|
|
2703
|
+
interface BotClientOptions {
|
|
2704
|
+
/** Bot Client Id */
|
|
2705
|
+
id: string;
|
|
2706
|
+
/** Bot Client Username */
|
|
2707
|
+
username?: string;
|
|
2708
|
+
/** So users can pass entire objects / classes */
|
|
2709
|
+
[x: string | number | symbol]: unknown;
|
|
2710
|
+
}
|
|
2711
|
+
/** Sub Manager Options, for player specific things */
|
|
2712
|
+
interface ManagerPlayerOptions {
|
|
2713
|
+
/** If the Lavalink Volume should be decremented by x number */
|
|
2714
|
+
volumeDecrementer?: number;
|
|
2715
|
+
/** How often it should update the the player Position */
|
|
2716
|
+
clientBasedPositionUpdateInterval?: number;
|
|
2717
|
+
/** What should be used as a searchPlatform, if no source was provided during the query */
|
|
2718
|
+
defaultSearchPlatform?: SearchPlatform;
|
|
2719
|
+
/** Applies the volume via a filter, not via the lavalink volume transformer */
|
|
2720
|
+
applyVolumeAsFilter?: boolean;
|
|
2721
|
+
/** Transforms the saved data of a requested user */
|
|
2722
|
+
requesterTransformer?: (requester: unknown) => unknown;
|
|
2723
|
+
/** What lavalink-client should do when the player reconnects */
|
|
2724
|
+
onDisconnect?: {
|
|
2725
|
+
/** Try to reconnect? -> If fails -> Destroy */
|
|
2726
|
+
autoReconnect?: boolean;
|
|
2727
|
+
/** Only try to reconnect if there are tracks in the queue */
|
|
2728
|
+
autoReconnectOnlyWithTracks?: boolean;
|
|
2729
|
+
/** Instantly destroy player (overrides autoReconnect) | Don't provide == disable feature*/
|
|
2730
|
+
destroyPlayer?: boolean;
|
|
2731
|
+
};
|
|
2732
|
+
/** Minimum time to play the song before autoPlayFunction is executed (prevents error spamming) Set to 0 to disable it @default 10000 */
|
|
2733
|
+
minAutoPlayMs?: number;
|
|
2734
|
+
/** 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 }" */
|
|
2735
|
+
maxErrorsPerTime?: {
|
|
2736
|
+
/** The threshold time to count errors (recommended is 35s) */
|
|
2737
|
+
threshold: number;
|
|
2738
|
+
/** The max amount of errors within the threshold time which are allowed before destroying the player (when errors > maxAmount -> player.destroy()) */
|
|
2739
|
+
maxAmount: number;
|
|
2740
|
+
};
|
|
2741
|
+
onEmptyQueue?: {
|
|
2742
|
+
/** 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! */
|
|
2743
|
+
autoPlayFunction?: (player: Player, lastPlayedTrack: Track) => Promise<void>;
|
|
2744
|
+
destroyAfterMs?: number;
|
|
2745
|
+
};
|
|
2746
|
+
useUnresolvedData?: boolean;
|
|
2747
|
+
}
|
|
2748
|
+
/** Manager Options used to create the manager */
|
|
2749
|
+
interface ManagerOptions {
|
|
2750
|
+
/** The Node Options, for all Nodes! (on init) */
|
|
2751
|
+
nodes: LavalinkNodeOptions[];
|
|
2752
|
+
/** @async The Function to send the voice connection changes from Lavalink to Discord */
|
|
2753
|
+
sendToShard: (guildId: string, payload: GuildShardPayload) => void;
|
|
2754
|
+
/** The Bot Client's Data for Authorization */
|
|
2755
|
+
client?: BotClientOptions;
|
|
2756
|
+
/** QueueOptions for all Queues */
|
|
2757
|
+
queueOptions?: ManagerQueueOptions;
|
|
2758
|
+
/** PlayerOptions for all Players */
|
|
2759
|
+
playerOptions?: ManagerPlayerOptions;
|
|
2760
|
+
/** If it should skip to the next Track on TrackEnd / TrackError etc. events */
|
|
2761
|
+
autoSkip?: boolean;
|
|
2762
|
+
/** If it should skip to the next Track if track.resolve errors while trying to play a track. */
|
|
2763
|
+
autoSkipOnResolveError?: boolean;
|
|
2764
|
+
/** If it should emit only new (unique) songs and not when a looping track (or similar) is plaid, default false */
|
|
2765
|
+
emitNewSongsOnly?: boolean;
|
|
2766
|
+
/** Only allow link requests with links either matching some of that regExp or including some of that string */
|
|
2767
|
+
linksWhitelist?: (RegExp | string)[];
|
|
2768
|
+
/** 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) */
|
|
2769
|
+
linksBlacklist?: (RegExp | string)[];
|
|
2770
|
+
/** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
|
|
2771
|
+
linksAllowed?: boolean;
|
|
2772
|
+
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
2773
|
+
advancedOptions?: {
|
|
2774
|
+
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
2775
|
+
maxFilterFixDuration?: number;
|
|
2776
|
+
/** Enable Debug event */
|
|
2777
|
+
enableDebugEvents?: boolean;
|
|
2778
|
+
/** optional */
|
|
2779
|
+
debugOptions?: {
|
|
2780
|
+
/** For logging custom searches */
|
|
2781
|
+
logCustomSearches?: boolean;
|
|
2782
|
+
/** logs for debugging the "no-Audio" playing error */
|
|
2783
|
+
noAudio?: boolean;
|
|
2784
|
+
/** For Logging the Destroy function */
|
|
2785
|
+
playerDestroy?: {
|
|
2786
|
+
/** To show the debug reason at all times. */
|
|
2787
|
+
debugLog?: boolean;
|
|
2788
|
+
/** If you get 'Error: Use Player#destroy("reason") not LavalinkManager#deletePlayer() to stop the Player' put it on true */
|
|
2789
|
+
dontThrowError?: boolean;
|
|
2790
|
+
};
|
|
2791
|
+
};
|
|
2792
|
+
};
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
declare class LavalinkManager extends EventEmitter {
|
|
2796
|
+
/**
|
|
2797
|
+
* Emit an event
|
|
2798
|
+
* @param event The event to emit
|
|
2799
|
+
* @param args The arguments to pass to the event
|
|
2800
|
+
* @returns
|
|
2801
|
+
*/
|
|
2802
|
+
emit<Event extends keyof LavalinkManagerEvents>(event: Event, ...args: Parameters<LavalinkManagerEvents[Event]>): boolean;
|
|
2803
|
+
/**
|
|
2804
|
+
* Add an event listener
|
|
2805
|
+
* @param event The event to listen to
|
|
2806
|
+
* @param listener The listener to add
|
|
2807
|
+
* @returns
|
|
2808
|
+
*/
|
|
2809
|
+
on<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
2810
|
+
/**
|
|
2811
|
+
* Add an event listener that only fires once
|
|
2812
|
+
* @param event The event to listen to
|
|
2813
|
+
* @param listener The listener to add
|
|
2814
|
+
* @returns
|
|
2815
|
+
*/
|
|
2816
|
+
once<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
2817
|
+
/**
|
|
2818
|
+
* Remove an event listener
|
|
2819
|
+
* @param event The event to remove the listener from
|
|
2820
|
+
* @param listener The listener to remove
|
|
2821
|
+
* @returns
|
|
2822
|
+
*/
|
|
2823
|
+
off<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
2824
|
+
/**
|
|
2825
|
+
* Remove an event listener
|
|
2826
|
+
* @param event The event to remove the listener from
|
|
2827
|
+
* @param listener The listener to remove
|
|
2828
|
+
* @returns
|
|
2829
|
+
*/
|
|
2830
|
+
removeListener<Event extends keyof LavalinkManagerEvents>(event: Event, listener: LavalinkManagerEvents[Event]): this;
|
|
2831
|
+
/** The Options of LavalinkManager (changeable) */
|
|
2832
|
+
options: ManagerOptions;
|
|
2833
|
+
/** LavalinkManager's NodeManager to manage all Nodes */
|
|
2834
|
+
nodeManager: NodeManager;
|
|
2835
|
+
/** LavalinkManager's Utils Class */
|
|
2836
|
+
utils: ManagerUtils;
|
|
2837
|
+
/** Wether the manager was initiated or not */
|
|
2838
|
+
initiated: boolean;
|
|
2839
|
+
/** All Players stored in a MiniMap */
|
|
2840
|
+
readonly players: MiniMap<string, Player>;
|
|
2841
|
+
/**
|
|
2842
|
+
* Applies the options provided by the User
|
|
2843
|
+
* @param options
|
|
2844
|
+
* @returns
|
|
2845
|
+
*/
|
|
2846
|
+
private applyOptions;
|
|
2847
|
+
/**
|
|
2848
|
+
* Validates the current manager's options
|
|
2849
|
+
* @param options
|
|
2850
|
+
*/
|
|
2851
|
+
private validateOptions;
|
|
2852
|
+
/**
|
|
2853
|
+
* Create the Lavalink Manager
|
|
2854
|
+
* @param options
|
|
2855
|
+
*
|
|
2856
|
+
* @example
|
|
2857
|
+
* ```ts
|
|
2858
|
+
* //const client = new Client({...}); // create your BOT Client (e.g. via discord.js)
|
|
2859
|
+
* client.lavalink = new LavalinkManager({
|
|
2860
|
+
* nodes: [
|
|
2861
|
+
* {
|
|
2862
|
+
* authorization: "yourverystrongpassword",
|
|
2863
|
+
* host: "localhost",
|
|
2864
|
+
* port: 2333,
|
|
2865
|
+
* id: "testnode"
|
|
2866
|
+
* },
|
|
2867
|
+
* sendToShard(guildId, payload) => client.guilds.cache.get(guildId)?.shard?.send(payload),
|
|
2868
|
+
* client: {
|
|
2869
|
+
* id: process.env.CLIENT_ID,
|
|
2870
|
+
* username: "TESTBOT"
|
|
2871
|
+
* },
|
|
2872
|
+
* // optional Options:
|
|
2873
|
+
* autoSkip: true,
|
|
2874
|
+
* playerOptions: {
|
|
2875
|
+
* applyVolumeAsFilter: false,
|
|
2876
|
+
* clientBasedPositionUpdateInterval: 150,
|
|
2877
|
+
* defaultSearchPlatform: "ytmsearch",
|
|
2878
|
+
* volumeDecrementer: 0.75,
|
|
2879
|
+
* //requesterTransformer: YourRequesterTransformerFunction,
|
|
2880
|
+
* onDisconnect: {
|
|
2881
|
+
* autoReconnect: true,
|
|
2882
|
+
* destroyPlayer: false
|
|
2883
|
+
* },
|
|
2884
|
+
* onEmptyQueue: {
|
|
2885
|
+
* destroyAfterMs: 30_000,
|
|
2886
|
+
* //autoPlayFunction: YourAutoplayFunction,
|
|
2887
|
+
* },
|
|
2888
|
+
* useUnresolvedData: true
|
|
2889
|
+
* },
|
|
2890
|
+
* queueOptions: {
|
|
2891
|
+
* maxPreviousTracks: 25,
|
|
2892
|
+
* //queueStore: yourCustomQueueStoreManagerClass,
|
|
2893
|
+
* //queueChangesWatcher: yourCustomQueueChangesWatcherClass
|
|
2894
|
+
* },
|
|
2895
|
+
* linksBlacklist: [],
|
|
2896
|
+
* linksWhitelist: [],
|
|
2897
|
+
* advancedOptions: {
|
|
2898
|
+
* maxFilterFixDuration: 600_000,
|
|
2899
|
+
* debugOptions: {
|
|
2900
|
+
* noAudio: false,
|
|
2901
|
+
* playerDestroy: {
|
|
2902
|
+
* dontThrowError: false,
|
|
2903
|
+
* debugLogs: false
|
|
2904
|
+
* }
|
|
2905
|
+
* }
|
|
2906
|
+
* }
|
|
2907
|
+
* ]
|
|
2908
|
+
* })
|
|
2909
|
+
* ```
|
|
2910
|
+
*/
|
|
2911
|
+
constructor(options: ManagerOptions);
|
|
2912
|
+
/**
|
|
2913
|
+
* Get a Player from Lava
|
|
2914
|
+
* @param guildId The guildId of the player
|
|
2915
|
+
*
|
|
2916
|
+
* @example
|
|
2917
|
+
* ```ts
|
|
2918
|
+
* const player = client.lavalink.getPlayer(interaction.guildId);
|
|
2919
|
+
* ```
|
|
2920
|
+
* A quicker and easier way than doing:
|
|
2921
|
+
* ```ts
|
|
2922
|
+
* const player = client.lavalink.players.get(interaction.guildId);
|
|
2923
|
+
* ```
|
|
2924
|
+
* @returns
|
|
2925
|
+
*/
|
|
2926
|
+
getPlayer(guildId: string): Player | undefined;
|
|
2927
|
+
/**
|
|
2928
|
+
* Create a Music-Player. If a player exists, then it returns it before creating a new one
|
|
2929
|
+
* @param options
|
|
2930
|
+
* @returns
|
|
2931
|
+
*
|
|
2932
|
+
* @example
|
|
2933
|
+
* ```ts
|
|
2934
|
+
* const player = client.lavalink.createPlayer({
|
|
2935
|
+
* guildId: interaction.guildId,
|
|
2936
|
+
* voiceChannelId: interaction.member.voice.channelId,
|
|
2937
|
+
* // everything below is optional
|
|
2938
|
+
* textChannelId: interaction.channelId,
|
|
2939
|
+
* volume: 100,
|
|
2940
|
+
* selfDeaf: true,
|
|
2941
|
+
* selfMute: false,
|
|
2942
|
+
* instaUpdateFiltersFix: true,
|
|
2943
|
+
* applyVolumeAsFilter: false
|
|
2944
|
+
* //only needed if you want to autopick node by region (configured by you)
|
|
2945
|
+
* // vcRegion: interaction.member.voice.rtcRegion,
|
|
2946
|
+
* // provide a specific node
|
|
2947
|
+
* // node: client.lavalink.nodeManager.leastUsedNodes("memory")[0]
|
|
2948
|
+
* });
|
|
2949
|
+
* ```
|
|
2950
|
+
*/
|
|
2951
|
+
createPlayer(options: PlayerOptions): Player;
|
|
2952
|
+
/**
|
|
2953
|
+
* Destroy a player with optional destroy reason and disconnect it from the voice channel
|
|
2954
|
+
* @param guildId
|
|
2955
|
+
* @param destroyReason
|
|
2956
|
+
* @returns
|
|
2957
|
+
*
|
|
2958
|
+
* @example
|
|
2959
|
+
* ```ts
|
|
2960
|
+
* client.lavalink.destroyPlayer(interaction.guildId, "forcefully destroyed the player");
|
|
2961
|
+
* // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
|
|
2962
|
+
* ```
|
|
2963
|
+
*/
|
|
2964
|
+
destroyPlayer(guildId: string, destroyReason?: string): Promise<void | Player>;
|
|
2965
|
+
/**
|
|
2966
|
+
* Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
|
|
2967
|
+
* @param guildId
|
|
2968
|
+
* @returns
|
|
2969
|
+
*
|
|
2970
|
+
* @example
|
|
2971
|
+
* ```ts
|
|
2972
|
+
* client.lavalink.deletePlayer(interaction.guildId);
|
|
2973
|
+
* // shouldn't be used except you know what you are doing.
|
|
2974
|
+
* ```
|
|
2975
|
+
*/
|
|
2976
|
+
deletePlayer(guildId: string): boolean | void;
|
|
2977
|
+
/**
|
|
2978
|
+
* Checks wether the the lib is useable based on if any node is connected
|
|
2979
|
+
*
|
|
2980
|
+
* @example
|
|
2981
|
+
* ```ts
|
|
2982
|
+
* if(!client.lavalink.useable) return console.error("can'T search yet, because there is no useable lavalink node.")
|
|
2983
|
+
* // continue with code e.g. createing a player and searching
|
|
2984
|
+
* ```
|
|
2985
|
+
*/
|
|
2986
|
+
get useable(): boolean;
|
|
2987
|
+
/**
|
|
2988
|
+
* Initiates the Manager, creates all nodes and connects all of them
|
|
2989
|
+
* @param clientData
|
|
2990
|
+
*
|
|
2991
|
+
* @example
|
|
2992
|
+
* ```ts
|
|
2993
|
+
* // on the bot ready event
|
|
2994
|
+
* client.on("ready", () => {
|
|
2995
|
+
* client.lavalink.init({
|
|
2996
|
+
* id: client.user.id,
|
|
2997
|
+
* username: client.user.username
|
|
2998
|
+
* });
|
|
2999
|
+
* });
|
|
3000
|
+
* ```
|
|
3001
|
+
*/
|
|
3002
|
+
init(clientData: BotClientOptions): Promise<LavalinkManager>;
|
|
3003
|
+
/**
|
|
3004
|
+
* Sends voice data to the Lavalink server.
|
|
3005
|
+
* ! Without this the library won't work
|
|
3006
|
+
* @param data
|
|
3007
|
+
*
|
|
3008
|
+
* @example
|
|
3009
|
+
*
|
|
3010
|
+
* ```ts
|
|
3011
|
+
* // on the bot "raw" event
|
|
3012
|
+
* client.on("raw", (d) => {
|
|
3013
|
+
* // required in order to send audio updates and register channel deletion etc.
|
|
3014
|
+
* client.lavalink.sendRawData(d)
|
|
3015
|
+
* })
|
|
3016
|
+
* ```
|
|
3017
|
+
*/
|
|
3018
|
+
sendRawData(data: VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket): Promise<void>;
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
/** Default Sources Record, to allow source parsing with multiple inputs. */
|
|
3022
|
+
declare const DefaultSources: Record<SearchPlatform, LavalinkSearchPlatform | ClientCustomSearchPlatformUtils>;
|
|
3023
|
+
/** Lavalink Plugins definiton */
|
|
3024
|
+
declare const LavalinkPlugins: {
|
|
3025
|
+
DuncteBot_Plugin: string;
|
|
3026
|
+
LavaSrc: string;
|
|
3027
|
+
GoogleCloudTTS: string;
|
|
3028
|
+
LavaSearch: string;
|
|
3029
|
+
Jiosaavn_Plugin: string;
|
|
3030
|
+
LavalinkFilterPlugin: string;
|
|
3031
|
+
JavaTimedLyricsPlugin: string;
|
|
3032
|
+
};
|
|
3033
|
+
/** Lavalink Sources regexes for url validations */
|
|
3034
|
+
declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
|
|
3035
|
+
|
|
3036
|
+
export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, DefaultQueueStore, DefaultSources, DestroyReasons, type DestroyReasonsType, DisconnectReasons, type DisconnectReasonsType, type DistortionFilter, type DuncteSearchPlatform, type EQBand, EQList, type Exception, type FailingAddress, type FilterData, FilterManager, type FloatNumber, type FrameStats, type GitObject, type GuildShardPayload, type IntegerNumber, type InvalidLavalinkRestRequest, type JioSaavnSearchPlatform, type KaraokeFilter, type LavaSearchFilteredResponse, type LavaSearchQuery, type LavaSearchResponse, type LavaSearchType, type LavaSrcSearchPlatform, type LavaSrcSearchPlatformBase, type LavalinkClientSearchPlatform, type LavalinkClientSearchPlatformResolve, type LavalinkFilterData, type LavalinkInfo, LavalinkManager, type LavalinkManagerEvents, LavalinkNode, type LavalinkNodeIdentifier, type LavalinkNodeOptions, type LavalinkPlayOptions, type LavalinkPlayer, type LavalinkPlayerVoice, type LavalinkPlayerVoiceOptions, type LavalinkPlugin_JioSaavn_SourceNames, type LavalinkPlugin_LavaSrc_SourceNames, LavalinkPlugins, type LavalinkSearchPlatform, type LavalinkSourceNames, type LavalinkTrack, type LavalinkTrackInfo, type LoadTypes, type LowPassFilter, type LyricsEvent, type LyricsEventType, type LyricsFoundEvent, type LyricsLine, type LyricsLineEvent, type LyricsNotFoundEvent, type LyricsResult, type ManagerOptions, type ManagerPlayerOptions, type ManagerQueueOptions, ManagerUtils, type MemoryStats, MiniMap, type MiniMapConstructor, type ModifyRequest, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, type Opaque, type PlayOptions, Player, type PlayerEvent, type PlayerEventType, type PlayerEvents, type PlayerFilters, type PlayerJson, type PlayerOptions, type PlayerUpdateInfo, type PlaylistInfo, type PluginInfo, type PluginObject, Queue, type QueueChangesWatcher, QueueSaver, type QueueStoreManager, QueueSymbol, type RepeatMode, type RotationFilter, type RoutePlanner, type RoutePlannerTypes, type SearchPlatform, type SearchQuery, type SearchResult, type Session, type Severity, SourceLinksRegexes, type SourceNames, type SourcesRegex, type SponsorBlockChapterStarted, type SponsorBlockChaptersLoaded, type SponsorBlockSegment, type SponsorBlockSegmentEventType, type SponsorBlockSegmentEvents, type SponsorBlockSegmentSkipped, type SponsorBlockSegmentsLoaded, type State, type StoredQueue, type TimescaleFilter, type Track, type TrackEndEvent, type TrackEndReason, type TrackExceptionEvent, type TrackInfo, type TrackStartEvent, type TrackStuckEvent, TrackSymbol, type TremoloFilter, type UnresolvedQuery, type UnresolvedSearchResult, type UnresolvedTrack, type UnresolvedTrackInfo, UnresolvedTrackSymbol, type VersionObject, type VibratoFilter, type VoicePacket, type VoiceServer, type VoiceState, type WebSocketClosedEvent, type anyObject, audioOutputsData, parseLavalinkConnUrl, queueTrackEnd, safeStringify, validSponsorBlocks };
|