lavalink-client 1.1.11 → 1.1.12
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/dist/cjs/structures/Filters.js +39 -20
- package/dist/cjs/structures/Utils.js +26 -24
- package/dist/esm/structures/Filters.js +39 -20
- package/dist/esm/structures/Utils.js +26 -24
- package/package.json +1 -1
|
@@ -49,19 +49,19 @@ class FilterManager {
|
|
|
49
49
|
},
|
|
50
50
|
vibrato: {
|
|
51
51
|
frequency: 0,
|
|
52
|
-
depth: 0 // 0 < x
|
|
52
|
+
depth: 0 // 0 < x <= 1
|
|
53
53
|
},
|
|
54
54
|
pluginFilters: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
"lavalink-filter-plugin": {
|
|
56
|
+
echo: {
|
|
57
|
+
delay: 0,
|
|
58
|
+
decay: 0 // 0 < 1
|
|
59
|
+
},
|
|
60
|
+
reverb: {
|
|
61
|
+
delays: [],
|
|
62
|
+
gains: [] // [0.84, 0.83, 0.82, 0.81]
|
|
63
|
+
}
|
|
63
64
|
}
|
|
64
|
-
}*/
|
|
65
65
|
},
|
|
66
66
|
channelMix: exports.audioOutputsData.stereo,
|
|
67
67
|
/*distortion: {
|
|
@@ -98,6 +98,10 @@ class FilterManager {
|
|
|
98
98
|
delete sendData.pluginFilters?.["lavalink-filter-plugin"]?.echo;
|
|
99
99
|
if (!this.filters.reverb)
|
|
100
100
|
delete sendData.pluginFilters?.["lavalink-filter-plugin"]?.reverb;
|
|
101
|
+
if (sendData.pluginFilters?.["lavalink-filter-plugin"] && Object.values(sendData.pluginFilters?.["lavalink-filter-plugin"]).length === 0)
|
|
102
|
+
delete sendData.pluginFilters["lavalink-filter-plugin"];
|
|
103
|
+
if (sendData.pluginFilters && Object.values(sendData.pluginFilters).length === 0)
|
|
104
|
+
delete sendData.pluginFilters;
|
|
101
105
|
if (!this.filters.lowPass)
|
|
102
106
|
delete sendData.lowPass;
|
|
103
107
|
if (!this.filters.karaoke)
|
|
@@ -111,9 +115,16 @@ class FilterManager {
|
|
|
111
115
|
if (!this.player.node.sessionId)
|
|
112
116
|
throw new Error("The Lavalink-Node is either not ready or not up to date");
|
|
113
117
|
sendData.equalizer = [...this.equalizerBands];
|
|
118
|
+
if (sendData.equalizer.length === 0)
|
|
119
|
+
delete sendData.equalizer;
|
|
114
120
|
for (const key of [...Object.keys(sendData)]) {
|
|
115
121
|
// delete disabled filters
|
|
116
|
-
if (
|
|
122
|
+
if (key === "pluginFilters") {
|
|
123
|
+
for (const key of [...Object.keys(sendData.pluginFilters)]) {
|
|
124
|
+
// if (this.player.node.info && !this.player.node.info?.plugins?.find?.(v => v.name === key)) delete sendData[key];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (this.player.node.info && !this.player.node.info?.filters?.includes?.(key))
|
|
117
128
|
delete sendData[key];
|
|
118
129
|
}
|
|
119
130
|
const now = performance.now();
|
|
@@ -166,7 +177,7 @@ class FilterManager {
|
|
|
166
177
|
this.filters.karaoke = false;
|
|
167
178
|
this.filters.volume = false;
|
|
168
179
|
this.filters.audioOutput = "stereo";
|
|
169
|
-
//
|
|
180
|
+
// reset all filter datas
|
|
170
181
|
for (const [key, value] of Object.entries({
|
|
171
182
|
volume: 1,
|
|
172
183
|
lowPass: {
|
|
@@ -183,13 +194,17 @@ class FilterManager {
|
|
|
183
194
|
pitch: 1,
|
|
184
195
|
rate: 1 // 0 = x
|
|
185
196
|
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
pluginFilters: {
|
|
198
|
+
"lavalink-filter-plugin": {
|
|
199
|
+
echo: {
|
|
200
|
+
delay: 0,
|
|
201
|
+
decay: 0
|
|
202
|
+
},
|
|
203
|
+
reverb: {
|
|
204
|
+
delays: [],
|
|
205
|
+
gains: []
|
|
206
|
+
},
|
|
207
|
+
}
|
|
193
208
|
},
|
|
194
209
|
rotation: {
|
|
195
210
|
rotationHz: 0
|
|
@@ -363,7 +378,7 @@ class FilterManager {
|
|
|
363
378
|
* @param decay
|
|
364
379
|
* @returns
|
|
365
380
|
*/
|
|
366
|
-
async toggleEcho(delay =
|
|
381
|
+
async toggleEcho(delay = 4, decay = 0.8) {
|
|
367
382
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("echo"))
|
|
368
383
|
throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable aka not installed!)");
|
|
369
384
|
if (!this.data)
|
|
@@ -372,6 +387,8 @@ class FilterManager {
|
|
|
372
387
|
this.data.pluginFilters = {};
|
|
373
388
|
if (!this.data.pluginFilters["lavalink-filter-plugin"])
|
|
374
389
|
this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
|
|
390
|
+
if (!this.data.pluginFilters["lavalink-filter-plugin"].echo)
|
|
391
|
+
this.data.pluginFilters["lavalink-filter-plugin"].echo = { decay: 0, delay: 0 };
|
|
375
392
|
this.data.pluginFilters["lavalink-filter-plugin"].echo.delay = this.filters.echo ? 0 : delay;
|
|
376
393
|
this.data.pluginFilters["lavalink-filter-plugin"].echo.decay = this.filters.echo ? 0 : decay;
|
|
377
394
|
this.filters.echo = !this.filters.echo;
|
|
@@ -393,6 +410,8 @@ class FilterManager {
|
|
|
393
410
|
this.data.pluginFilters = {};
|
|
394
411
|
if (!this.data.pluginFilters["lavalink-filter-plugin"])
|
|
395
412
|
this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
|
|
413
|
+
if (!this.data.pluginFilters["lavalink-filter-plugin"].reverb)
|
|
414
|
+
this.data.pluginFilters["lavalink-filter-plugin"].reverb = { delays: [], gains: [] };
|
|
396
415
|
this.data.pluginFilters["lavalink-filter-plugin"].reverb.delays = this.filters.reverb ? [] : delays;
|
|
397
416
|
this.data.pluginFilters["lavalink-filter-plugin"].reverb.gains = this.filters.reverb ? [] : gains;
|
|
398
417
|
this.filters.reverb = !this.filters.reverb;
|
|
@@ -156,40 +156,40 @@ class ManagerUtils {
|
|
|
156
156
|
if (!node.info.sourceManagers?.length)
|
|
157
157
|
throw new Error("Lavalink Node, has no sourceManagers enabled");
|
|
158
158
|
// missing links: beam.pro local getyarn.io clypit pornhub reddit ocreamix soundgasm
|
|
159
|
-
if ((LavalinkManagerStatics_1.SourceLinksRegexes.YoutubeMusicRegex.test(queryString) || LavalinkManagerStatics_1.SourceLinksRegexes.YoutubeRegex.test(queryString)) && !node.info
|
|
159
|
+
if ((LavalinkManagerStatics_1.SourceLinksRegexes.YoutubeMusicRegex.test(queryString) || LavalinkManagerStatics_1.SourceLinksRegexes.YoutubeRegex.test(queryString)) && !node.info?.sourceManagers?.includes("youtube")) {
|
|
160
160
|
throw new Error("Lavalink Node has not 'youtube' enabled");
|
|
161
161
|
}
|
|
162
|
-
if ((LavalinkManagerStatics_1.SourceLinksRegexes.SoundCloudMobileRegex.test(queryString) || LavalinkManagerStatics_1.SourceLinksRegexes.SoundCloudRegex.test(queryString)) && !node.info
|
|
162
|
+
if ((LavalinkManagerStatics_1.SourceLinksRegexes.SoundCloudMobileRegex.test(queryString) || LavalinkManagerStatics_1.SourceLinksRegexes.SoundCloudRegex.test(queryString)) && !node.info?.sourceManagers?.includes("soundcloud")) {
|
|
163
163
|
throw new Error("Lavalink Node has not 'soundcloud' enabled");
|
|
164
164
|
}
|
|
165
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.bandcamp.test(queryString) && !node.info
|
|
165
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.bandcamp.test(queryString) && !node.info?.sourceManagers?.includes("bandcamp")) {
|
|
166
166
|
throw new Error("Lavalink Node has not 'bandcamp' enabled");
|
|
167
167
|
}
|
|
168
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.TwitchTv.test(queryString) && !node.info
|
|
168
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.TwitchTv.test(queryString) && !node.info?.sourceManagers?.includes("twitch")) {
|
|
169
169
|
throw new Error("Lavalink Node has not 'twitch' enabled");
|
|
170
170
|
}
|
|
171
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.vimeo.test(queryString) && !node.info
|
|
171
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.vimeo.test(queryString) && !node.info?.sourceManagers?.includes("vimeo")) {
|
|
172
172
|
throw new Error("Lavalink Node has not 'vimeo' enabled");
|
|
173
173
|
}
|
|
174
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.tiktok.test(queryString) && !node.info
|
|
174
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.tiktok.test(queryString) && !node.info?.sourceManagers?.includes("tiktok")) {
|
|
175
175
|
throw new Error("Lavalink Node has not 'tiktok' enabled");
|
|
176
176
|
}
|
|
177
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.mixcloud.test(queryString) && !node.info
|
|
177
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.mixcloud.test(queryString) && !node.info?.sourceManagers?.includes("mixcloud")) {
|
|
178
178
|
throw new Error("Lavalink Node has not 'mixcloud' enabled");
|
|
179
179
|
}
|
|
180
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.AllSpotifyRegex.test(queryString) && !node.info
|
|
180
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.AllSpotifyRegex.test(queryString) && !node.info?.sourceManagers?.includes("spotify")) {
|
|
181
181
|
throw new Error("Lavalink Node has not 'spotify' enabled");
|
|
182
182
|
}
|
|
183
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.appleMusic.test(queryString) && !node.info
|
|
183
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.appleMusic.test(queryString) && !node.info?.sourceManagers?.includes("applemusic")) {
|
|
184
184
|
throw new Error("Lavalink Node has not 'applemusic' enabled");
|
|
185
185
|
}
|
|
186
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.AllDeezerRegex.test(queryString) && !node.info
|
|
186
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.AllDeezerRegex.test(queryString) && !node.info?.sourceManagers?.includes("deezer")) {
|
|
187
187
|
throw new Error("Lavalink Node has not 'deezer' enabled");
|
|
188
188
|
}
|
|
189
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.AllDeezerRegex.test(queryString) && node.info
|
|
189
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.AllDeezerRegex.test(queryString) && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
|
|
190
190
|
throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'deezer' to work");
|
|
191
191
|
}
|
|
192
|
-
if (LavalinkManagerStatics_1.SourceLinksRegexes.musicYandex.test(queryString) && !node.info
|
|
192
|
+
if (LavalinkManagerStatics_1.SourceLinksRegexes.musicYandex.test(queryString) && !node.info?.sourceManagers?.includes("yandexmusic")) {
|
|
193
193
|
throw new Error("Lavalink Node has not 'yandexmusic' enabled");
|
|
194
194
|
}
|
|
195
195
|
return;
|
|
@@ -200,40 +200,42 @@ class ManagerUtils {
|
|
|
200
200
|
const source = LavalinkManagerStatics_1.DefaultSources[sourceString.toLowerCase().trim()];
|
|
201
201
|
if (!source)
|
|
202
202
|
throw new Error(`Lavalink Node SearchQuerySource: '${sourceString}' is not available`);
|
|
203
|
-
if (
|
|
203
|
+
if (!node.info)
|
|
204
|
+
throw new Error("Lavalink Node does not have any info cached yet, not ready yet!");
|
|
205
|
+
if (source === "amsearch" && !node.info?.sourceManagers?.includes("applemusic")) {
|
|
204
206
|
throw new Error("Lavalink Node has not 'applemusic' enabled, which is required to have 'amsearch' work");
|
|
205
207
|
}
|
|
206
|
-
if (source === "dzisrc" && !node.info
|
|
208
|
+
if (source === "dzisrc" && !node.info?.sourceManagers?.includes("deezer")) {
|
|
207
209
|
throw new Error("Lavalink Node has not 'deezer' enabled, which is required to have 'dzisrc' work");
|
|
208
210
|
}
|
|
209
|
-
if (source === "dzsearch" && !node.info
|
|
211
|
+
if (source === "dzsearch" && !node.info?.sourceManagers?.includes("deezer")) {
|
|
210
212
|
throw new Error("Lavalink Node has not 'deezer' enabled, which is required to have 'dzsearch' work");
|
|
211
213
|
}
|
|
212
|
-
if (source === "dzisrc" && node.info
|
|
214
|
+
if (source === "dzisrc" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
|
|
213
215
|
throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzisrc' to work");
|
|
214
216
|
}
|
|
215
|
-
if (source === "dzsearch" && node.info
|
|
217
|
+
if (source === "dzsearch" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
|
|
216
218
|
throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzsearch' to work");
|
|
217
219
|
}
|
|
218
|
-
if (source === "scsearch" && !node.info
|
|
220
|
+
if (source === "scsearch" && !node.info?.sourceManagers?.includes("soundcloud")) {
|
|
219
221
|
throw new Error("Lavalink Node has not 'soundcloud' enabled, which is required to have 'scsearch' work");
|
|
220
222
|
}
|
|
221
|
-
if (source === "speak" && !node.info
|
|
223
|
+
if (source === "speak" && !node.info?.plugins?.find(c => c.name.toLowerCase().includes(LavalinkManagerStatics_1.LavalinkPlugins.DuncteBot_Plugin.toLowerCase()))) {
|
|
222
224
|
throw new Error("Lavalink Node has not 'speak' enabled, which is required to have 'speak' work");
|
|
223
225
|
}
|
|
224
|
-
if (source === "tts" && !node.info
|
|
226
|
+
if (source === "tts" && !node.info?.plugins?.find(c => c.name.toLowerCase().includes(LavalinkManagerStatics_1.LavalinkPlugins.GoogleCloudTTS.toLowerCase()))) {
|
|
225
227
|
throw new Error("Lavalink Node has not 'tts' enabled, which is required to have 'tts' work");
|
|
226
228
|
}
|
|
227
|
-
if (source === "ftts" && !(node.info
|
|
229
|
+
if (source === "ftts" && !(node.info?.sourceManagers?.includes("ftts") || node.info?.sourceManagers?.includes("flowery-tts") || node.info?.sourceManagers?.includes("flowerytts"))) {
|
|
228
230
|
throw new Error("Lavalink Node has not 'flowery-tts' enabled, which is required to have 'ftts' work");
|
|
229
231
|
}
|
|
230
|
-
if (source === "ymsearch" && !node.info
|
|
232
|
+
if (source === "ymsearch" && !node.info?.sourceManagers?.includes("yandexmusic")) {
|
|
231
233
|
throw new Error("Lavalink Node has not 'yandexmusic' enabled, which is required to have 'ymsearch' work");
|
|
232
234
|
}
|
|
233
|
-
if (source === "ytmsearch" && !node.info.sourceManagers
|
|
235
|
+
if (source === "ytmsearch" && !node.info.sourceManagers?.includes("youtube")) {
|
|
234
236
|
throw new Error("Lavalink Node has not 'youtube' enabled, which is required to have 'ytmsearch' work");
|
|
235
237
|
}
|
|
236
|
-
if (source === "ytsearch" && !node.info
|
|
238
|
+
if (source === "ytsearch" && !node.info?.sourceManagers?.includes("youtube")) {
|
|
237
239
|
throw new Error("Lavalink Node has not 'youtube' enabled, which is required to have 'ytsearch' work");
|
|
238
240
|
}
|
|
239
241
|
return;
|
|
@@ -46,19 +46,19 @@ export class FilterManager {
|
|
|
46
46
|
},
|
|
47
47
|
vibrato: {
|
|
48
48
|
frequency: 0,
|
|
49
|
-
depth: 0 // 0 < x
|
|
49
|
+
depth: 0 // 0 < x <= 1
|
|
50
50
|
},
|
|
51
51
|
pluginFilters: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
"lavalink-filter-plugin": {
|
|
53
|
+
echo: {
|
|
54
|
+
delay: 0,
|
|
55
|
+
decay: 0 // 0 < 1
|
|
56
|
+
},
|
|
57
|
+
reverb: {
|
|
58
|
+
delays: [],
|
|
59
|
+
gains: [] // [0.84, 0.83, 0.82, 0.81]
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
|
-
}*/
|
|
62
62
|
},
|
|
63
63
|
channelMix: audioOutputsData.stereo,
|
|
64
64
|
/*distortion: {
|
|
@@ -95,6 +95,10 @@ export class FilterManager {
|
|
|
95
95
|
delete sendData.pluginFilters?.["lavalink-filter-plugin"]?.echo;
|
|
96
96
|
if (!this.filters.reverb)
|
|
97
97
|
delete sendData.pluginFilters?.["lavalink-filter-plugin"]?.reverb;
|
|
98
|
+
if (sendData.pluginFilters?.["lavalink-filter-plugin"] && Object.values(sendData.pluginFilters?.["lavalink-filter-plugin"]).length === 0)
|
|
99
|
+
delete sendData.pluginFilters["lavalink-filter-plugin"];
|
|
100
|
+
if (sendData.pluginFilters && Object.values(sendData.pluginFilters).length === 0)
|
|
101
|
+
delete sendData.pluginFilters;
|
|
98
102
|
if (!this.filters.lowPass)
|
|
99
103
|
delete sendData.lowPass;
|
|
100
104
|
if (!this.filters.karaoke)
|
|
@@ -108,9 +112,16 @@ export class FilterManager {
|
|
|
108
112
|
if (!this.player.node.sessionId)
|
|
109
113
|
throw new Error("The Lavalink-Node is either not ready or not up to date");
|
|
110
114
|
sendData.equalizer = [...this.equalizerBands];
|
|
115
|
+
if (sendData.equalizer.length === 0)
|
|
116
|
+
delete sendData.equalizer;
|
|
111
117
|
for (const key of [...Object.keys(sendData)]) {
|
|
112
118
|
// delete disabled filters
|
|
113
|
-
if (
|
|
119
|
+
if (key === "pluginFilters") {
|
|
120
|
+
for (const key of [...Object.keys(sendData.pluginFilters)]) {
|
|
121
|
+
// if (this.player.node.info && !this.player.node.info?.plugins?.find?.(v => v.name === key)) delete sendData[key];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (this.player.node.info && !this.player.node.info?.filters?.includes?.(key))
|
|
114
125
|
delete sendData[key];
|
|
115
126
|
}
|
|
116
127
|
const now = performance.now();
|
|
@@ -163,7 +174,7 @@ export class FilterManager {
|
|
|
163
174
|
this.filters.karaoke = false;
|
|
164
175
|
this.filters.volume = false;
|
|
165
176
|
this.filters.audioOutput = "stereo";
|
|
166
|
-
//
|
|
177
|
+
// reset all filter datas
|
|
167
178
|
for (const [key, value] of Object.entries({
|
|
168
179
|
volume: 1,
|
|
169
180
|
lowPass: {
|
|
@@ -180,13 +191,17 @@ export class FilterManager {
|
|
|
180
191
|
pitch: 1,
|
|
181
192
|
rate: 1 // 0 = x
|
|
182
193
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
194
|
+
pluginFilters: {
|
|
195
|
+
"lavalink-filter-plugin": {
|
|
196
|
+
echo: {
|
|
197
|
+
delay: 0,
|
|
198
|
+
decay: 0
|
|
199
|
+
},
|
|
200
|
+
reverb: {
|
|
201
|
+
delays: [],
|
|
202
|
+
gains: []
|
|
203
|
+
},
|
|
204
|
+
}
|
|
190
205
|
},
|
|
191
206
|
rotation: {
|
|
192
207
|
rotationHz: 0
|
|
@@ -360,7 +375,7 @@ export class FilterManager {
|
|
|
360
375
|
* @param decay
|
|
361
376
|
* @returns
|
|
362
377
|
*/
|
|
363
|
-
async toggleEcho(delay =
|
|
378
|
+
async toggleEcho(delay = 4, decay = 0.8) {
|
|
364
379
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("echo"))
|
|
365
380
|
throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable aka not installed!)");
|
|
366
381
|
if (!this.data)
|
|
@@ -369,6 +384,8 @@ export class FilterManager {
|
|
|
369
384
|
this.data.pluginFilters = {};
|
|
370
385
|
if (!this.data.pluginFilters["lavalink-filter-plugin"])
|
|
371
386
|
this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
|
|
387
|
+
if (!this.data.pluginFilters["lavalink-filter-plugin"].echo)
|
|
388
|
+
this.data.pluginFilters["lavalink-filter-plugin"].echo = { decay: 0, delay: 0 };
|
|
372
389
|
this.data.pluginFilters["lavalink-filter-plugin"].echo.delay = this.filters.echo ? 0 : delay;
|
|
373
390
|
this.data.pluginFilters["lavalink-filter-plugin"].echo.decay = this.filters.echo ? 0 : decay;
|
|
374
391
|
this.filters.echo = !this.filters.echo;
|
|
@@ -390,6 +407,8 @@ export class FilterManager {
|
|
|
390
407
|
this.data.pluginFilters = {};
|
|
391
408
|
if (!this.data.pluginFilters["lavalink-filter-plugin"])
|
|
392
409
|
this.data.pluginFilters["lavalink-filter-plugin"] = { echo: { decay: 0, delay: 0 }, reverb: { delays: [], gains: [] } };
|
|
410
|
+
if (!this.data.pluginFilters["lavalink-filter-plugin"].reverb)
|
|
411
|
+
this.data.pluginFilters["lavalink-filter-plugin"].reverb = { delays: [], gains: [] };
|
|
393
412
|
this.data.pluginFilters["lavalink-filter-plugin"].reverb.delays = this.filters.reverb ? [] : delays;
|
|
394
413
|
this.data.pluginFilters["lavalink-filter-plugin"].reverb.gains = this.filters.reverb ? [] : gains;
|
|
395
414
|
this.filters.reverb = !this.filters.reverb;
|
|
@@ -153,40 +153,40 @@ export class ManagerUtils {
|
|
|
153
153
|
if (!node.info.sourceManagers?.length)
|
|
154
154
|
throw new Error("Lavalink Node, has no sourceManagers enabled");
|
|
155
155
|
// missing links: beam.pro local getyarn.io clypit pornhub reddit ocreamix soundgasm
|
|
156
|
-
if ((SourceLinksRegexes.YoutubeMusicRegex.test(queryString) || SourceLinksRegexes.YoutubeRegex.test(queryString)) && !node.info
|
|
156
|
+
if ((SourceLinksRegexes.YoutubeMusicRegex.test(queryString) || SourceLinksRegexes.YoutubeRegex.test(queryString)) && !node.info?.sourceManagers?.includes("youtube")) {
|
|
157
157
|
throw new Error("Lavalink Node has not 'youtube' enabled");
|
|
158
158
|
}
|
|
159
|
-
if ((SourceLinksRegexes.SoundCloudMobileRegex.test(queryString) || SourceLinksRegexes.SoundCloudRegex.test(queryString)) && !node.info
|
|
159
|
+
if ((SourceLinksRegexes.SoundCloudMobileRegex.test(queryString) || SourceLinksRegexes.SoundCloudRegex.test(queryString)) && !node.info?.sourceManagers?.includes("soundcloud")) {
|
|
160
160
|
throw new Error("Lavalink Node has not 'soundcloud' enabled");
|
|
161
161
|
}
|
|
162
|
-
if (SourceLinksRegexes.bandcamp.test(queryString) && !node.info
|
|
162
|
+
if (SourceLinksRegexes.bandcamp.test(queryString) && !node.info?.sourceManagers?.includes("bandcamp")) {
|
|
163
163
|
throw new Error("Lavalink Node has not 'bandcamp' enabled");
|
|
164
164
|
}
|
|
165
|
-
if (SourceLinksRegexes.TwitchTv.test(queryString) && !node.info
|
|
165
|
+
if (SourceLinksRegexes.TwitchTv.test(queryString) && !node.info?.sourceManagers?.includes("twitch")) {
|
|
166
166
|
throw new Error("Lavalink Node has not 'twitch' enabled");
|
|
167
167
|
}
|
|
168
|
-
if (SourceLinksRegexes.vimeo.test(queryString) && !node.info
|
|
168
|
+
if (SourceLinksRegexes.vimeo.test(queryString) && !node.info?.sourceManagers?.includes("vimeo")) {
|
|
169
169
|
throw new Error("Lavalink Node has not 'vimeo' enabled");
|
|
170
170
|
}
|
|
171
|
-
if (SourceLinksRegexes.tiktok.test(queryString) && !node.info
|
|
171
|
+
if (SourceLinksRegexes.tiktok.test(queryString) && !node.info?.sourceManagers?.includes("tiktok")) {
|
|
172
172
|
throw new Error("Lavalink Node has not 'tiktok' enabled");
|
|
173
173
|
}
|
|
174
|
-
if (SourceLinksRegexes.mixcloud.test(queryString) && !node.info
|
|
174
|
+
if (SourceLinksRegexes.mixcloud.test(queryString) && !node.info?.sourceManagers?.includes("mixcloud")) {
|
|
175
175
|
throw new Error("Lavalink Node has not 'mixcloud' enabled");
|
|
176
176
|
}
|
|
177
|
-
if (SourceLinksRegexes.AllSpotifyRegex.test(queryString) && !node.info
|
|
177
|
+
if (SourceLinksRegexes.AllSpotifyRegex.test(queryString) && !node.info?.sourceManagers?.includes("spotify")) {
|
|
178
178
|
throw new Error("Lavalink Node has not 'spotify' enabled");
|
|
179
179
|
}
|
|
180
|
-
if (SourceLinksRegexes.appleMusic.test(queryString) && !node.info
|
|
180
|
+
if (SourceLinksRegexes.appleMusic.test(queryString) && !node.info?.sourceManagers?.includes("applemusic")) {
|
|
181
181
|
throw new Error("Lavalink Node has not 'applemusic' enabled");
|
|
182
182
|
}
|
|
183
|
-
if (SourceLinksRegexes.AllDeezerRegex.test(queryString) && !node.info
|
|
183
|
+
if (SourceLinksRegexes.AllDeezerRegex.test(queryString) && !node.info?.sourceManagers?.includes("deezer")) {
|
|
184
184
|
throw new Error("Lavalink Node has not 'deezer' enabled");
|
|
185
185
|
}
|
|
186
|
-
if (SourceLinksRegexes.AllDeezerRegex.test(queryString) && node.info
|
|
186
|
+
if (SourceLinksRegexes.AllDeezerRegex.test(queryString) && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
|
|
187
187
|
throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'deezer' to work");
|
|
188
188
|
}
|
|
189
|
-
if (SourceLinksRegexes.musicYandex.test(queryString) && !node.info
|
|
189
|
+
if (SourceLinksRegexes.musicYandex.test(queryString) && !node.info?.sourceManagers?.includes("yandexmusic")) {
|
|
190
190
|
throw new Error("Lavalink Node has not 'yandexmusic' enabled");
|
|
191
191
|
}
|
|
192
192
|
return;
|
|
@@ -197,40 +197,42 @@ export class ManagerUtils {
|
|
|
197
197
|
const source = DefaultSources[sourceString.toLowerCase().trim()];
|
|
198
198
|
if (!source)
|
|
199
199
|
throw new Error(`Lavalink Node SearchQuerySource: '${sourceString}' is not available`);
|
|
200
|
-
if (
|
|
200
|
+
if (!node.info)
|
|
201
|
+
throw new Error("Lavalink Node does not have any info cached yet, not ready yet!");
|
|
202
|
+
if (source === "amsearch" && !node.info?.sourceManagers?.includes("applemusic")) {
|
|
201
203
|
throw new Error("Lavalink Node has not 'applemusic' enabled, which is required to have 'amsearch' work");
|
|
202
204
|
}
|
|
203
|
-
if (source === "dzisrc" && !node.info
|
|
205
|
+
if (source === "dzisrc" && !node.info?.sourceManagers?.includes("deezer")) {
|
|
204
206
|
throw new Error("Lavalink Node has not 'deezer' enabled, which is required to have 'dzisrc' work");
|
|
205
207
|
}
|
|
206
|
-
if (source === "dzsearch" && !node.info
|
|
208
|
+
if (source === "dzsearch" && !node.info?.sourceManagers?.includes("deezer")) {
|
|
207
209
|
throw new Error("Lavalink Node has not 'deezer' enabled, which is required to have 'dzsearch' work");
|
|
208
210
|
}
|
|
209
|
-
if (source === "dzisrc" && node.info
|
|
211
|
+
if (source === "dzisrc" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
|
|
210
212
|
throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzisrc' to work");
|
|
211
213
|
}
|
|
212
|
-
if (source === "dzsearch" && node.info
|
|
214
|
+
if (source === "dzsearch" && node.info?.sourceManagers?.includes("deezer") && !node.info?.sourceManagers?.includes("http")) {
|
|
213
215
|
throw new Error("Lavalink Node has not 'http' enabled, which is required to have 'dzsearch' to work");
|
|
214
216
|
}
|
|
215
|
-
if (source === "scsearch" && !node.info
|
|
217
|
+
if (source === "scsearch" && !node.info?.sourceManagers?.includes("soundcloud")) {
|
|
216
218
|
throw new Error("Lavalink Node has not 'soundcloud' enabled, which is required to have 'scsearch' work");
|
|
217
219
|
}
|
|
218
|
-
if (source === "speak" && !node.info
|
|
220
|
+
if (source === "speak" && !node.info?.plugins?.find(c => c.name.toLowerCase().includes(LavalinkPlugins.DuncteBot_Plugin.toLowerCase()))) {
|
|
219
221
|
throw new Error("Lavalink Node has not 'speak' enabled, which is required to have 'speak' work");
|
|
220
222
|
}
|
|
221
|
-
if (source === "tts" && !node.info
|
|
223
|
+
if (source === "tts" && !node.info?.plugins?.find(c => c.name.toLowerCase().includes(LavalinkPlugins.GoogleCloudTTS.toLowerCase()))) {
|
|
222
224
|
throw new Error("Lavalink Node has not 'tts' enabled, which is required to have 'tts' work");
|
|
223
225
|
}
|
|
224
|
-
if (source === "ftts" && !(node.info
|
|
226
|
+
if (source === "ftts" && !(node.info?.sourceManagers?.includes("ftts") || node.info?.sourceManagers?.includes("flowery-tts") || node.info?.sourceManagers?.includes("flowerytts"))) {
|
|
225
227
|
throw new Error("Lavalink Node has not 'flowery-tts' enabled, which is required to have 'ftts' work");
|
|
226
228
|
}
|
|
227
|
-
if (source === "ymsearch" && !node.info
|
|
229
|
+
if (source === "ymsearch" && !node.info?.sourceManagers?.includes("yandexmusic")) {
|
|
228
230
|
throw new Error("Lavalink Node has not 'yandexmusic' enabled, which is required to have 'ymsearch' work");
|
|
229
231
|
}
|
|
230
|
-
if (source === "ytmsearch" && !node.info.sourceManagers
|
|
232
|
+
if (source === "ytmsearch" && !node.info.sourceManagers?.includes("youtube")) {
|
|
231
233
|
throw new Error("Lavalink Node has not 'youtube' enabled, which is required to have 'ytmsearch' work");
|
|
232
234
|
}
|
|
233
|
-
if (source === "ytsearch" && !node.info
|
|
235
|
+
if (source === "ytsearch" && !node.info?.sourceManagers?.includes("youtube")) {
|
|
234
236
|
throw new Error("Lavalink Node has not 'youtube' enabled, which is required to have 'ytsearch' work");
|
|
235
237
|
}
|
|
236
238
|
return;
|
package/package.json
CHANGED