lavalink-client 2.10.1 → 2.10.2
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 +42 -0
- package/dist/index.cjs +160 -14
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +159 -14
- package/dist/index.mjs +159 -14
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -200,6 +200,48 @@ node.addMixerLayer()
|
|
|
200
200
|
- **`node.getConnectionMetrics()`**: Get connection metrics. [Docs](https://nodelink.js.org/docs/api/rest#node-information)
|
|
201
201
|
- **`node.loadDirectStream(track, volume, position, filters)`**: Stream raw PCM audio. [Docs](https://nodelink.js.org/docs/api/nodelink-features#loadstream)
|
|
202
202
|
|
|
203
|
+
### NodeLink Specific Sources (`SourcesRecord`)
|
|
204
|
+
|
|
205
|
+
By default, the client uses a generic `DefaultSources` record to map human-friendly prefixes like `youtube:`, `spotify:`, etc. to Lavalink search sources.
|
|
206
|
+
|
|
207
|
+
For NodeLink, you can override this behavior to use the NodeLink-specific source prefixes (including `admsearch`, `audiomack`, `gaanasearch`, `gtts`, `pipertts`, etc.) via the `NodeLinkDefaultSources` export and the `ManagerUtils#SourcesRecord` property:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import { LavalinkManager, NodeType, NodeLinkNode, NodeLinkDefaultSources } from "lavalink-client";
|
|
211
|
+
|
|
212
|
+
// create the manager as usual, but with a NodeLink node
|
|
213
|
+
client.lavalink = new LavalinkManager({
|
|
214
|
+
nodes: [
|
|
215
|
+
{
|
|
216
|
+
authorization: "youshallnotpass",
|
|
217
|
+
host: "localhost",
|
|
218
|
+
port: 2333,
|
|
219
|
+
id: "nodelink-main",
|
|
220
|
+
nodeType: NodeType.NodeLink,
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
sendToShard: (guildId, payload) => client.guilds.cache.get(guildId)?.shard?.send(payload),
|
|
224
|
+
autoSkip: true,
|
|
225
|
+
client: {
|
|
226
|
+
id: envConfig.clientId,
|
|
227
|
+
username: "MyBot",
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// IMPORTANT: Override the default source mapping so `ytsearch:`, `amsearch:`, `admsearch:`, etc.
|
|
232
|
+
// use the NodeLink-specific prefixes.
|
|
233
|
+
client.lavalink.utils.SourcesRecord = NodeLinkDefaultSources;
|
|
234
|
+
|
|
235
|
+
// Optional: You can also provide your own custom record extending NodeLinkDefaultSources:
|
|
236
|
+
client.lavalink.utils.SourcesRecord = {
|
|
237
|
+
...NodeLinkDefaultSources,
|
|
238
|
+
// custom alias that only your bot understands, which resolves to a NodeLink source
|
|
239
|
+
mycustomsource: "ytsearch",
|
|
240
|
+
};
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
This makes all helper methods that use `ManagerUtils` (such as `transformQuery`, `transformLavaSearchQuery` and `validateSourceString`) work with NodeLink’s extended search prefixes when you are connected to a NodeLink node.
|
|
244
|
+
|
|
203
245
|
### NodeLink Specififc Events?
|
|
204
246
|
|
|
205
247
|
```ts
|
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
LavalinkPlugins: () => LavalinkPlugins,
|
|
42
42
|
ManagerUtils: () => ManagerUtils,
|
|
43
43
|
MiniMap: () => MiniMap,
|
|
44
|
+
NodeLinkDefaultSources: () => NodeLinkDefaultSources,
|
|
44
45
|
NodeLinkExclusiveEvents: () => NodeLinkExclusiveEvents,
|
|
45
46
|
NodeLinkNode: () => NodeLinkNode,
|
|
46
47
|
NodeManager: () => NodeManager,
|
|
@@ -486,8 +487,6 @@ var DefaultSources = {
|
|
|
486
487
|
pandora: "pdsearch",
|
|
487
488
|
pd: "pdsearch",
|
|
488
489
|
pdsearch: "pdsearch",
|
|
489
|
-
pdisrc: "pdisrc",
|
|
490
|
-
pdrec: "pdrec",
|
|
491
490
|
"pandora music": "pdsearch",
|
|
492
491
|
pandoramusic: "pdsearch",
|
|
493
492
|
// speak PLUGIN
|
|
@@ -522,7 +521,15 @@ var DefaultSources = {
|
|
|
522
521
|
jiosaavn: "jssearch",
|
|
523
522
|
js: "jssearch",
|
|
524
523
|
jssearch: "jssearch",
|
|
525
|
-
jsrec: "jsrec"
|
|
524
|
+
jsrec: "jsrec",
|
|
525
|
+
// amazon music
|
|
526
|
+
amzsearch: "amzsearch",
|
|
527
|
+
// audiomack
|
|
528
|
+
admsearch: "admsearch",
|
|
529
|
+
// gaana
|
|
530
|
+
gnsearch: "gnsearch",
|
|
531
|
+
// shazam
|
|
532
|
+
szsearch: "szsearch"
|
|
526
533
|
};
|
|
527
534
|
var LavalinkPlugins = {
|
|
528
535
|
DuncteBot_Plugin: "DuncteBot-plugin",
|
|
@@ -531,7 +538,8 @@ var LavalinkPlugins = {
|
|
|
531
538
|
LavaSearch: "lavasearch-plugin",
|
|
532
539
|
Jiosaavn_Plugin: "jiosaavn-plugin",
|
|
533
540
|
LavalinkFilterPlugin: "lavalink-filter-plugin",
|
|
534
|
-
JavaTimedLyricsPlugin: "java-lyrics-plugin"
|
|
541
|
+
JavaTimedLyricsPlugin: "java-lyrics-plugin",
|
|
542
|
+
PulseLinkPlugin: "pulselink-plugin"
|
|
535
543
|
};
|
|
536
544
|
var SourceLinksRegexes = {
|
|
537
545
|
/** DEFAULT SUPPORTED BY LAVALINK */
|
|
@@ -607,6 +615,8 @@ function parseLavalinkConnUrl(connectionUrl) {
|
|
|
607
615
|
}
|
|
608
616
|
var ManagerUtils = class {
|
|
609
617
|
LavalinkManager = void 0;
|
|
618
|
+
/** Override this with your custom sources record if you want to use custom sources for your node */
|
|
619
|
+
SourcesRecord = DefaultSources;
|
|
610
620
|
constructor(LavalinkManager2) {
|
|
611
621
|
this.LavalinkManager = LavalinkManager2;
|
|
612
622
|
}
|
|
@@ -934,13 +944,13 @@ var ManagerUtils = class {
|
|
|
934
944
|
return;
|
|
935
945
|
}
|
|
936
946
|
/**
|
|
937
|
-
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the
|
|
947
|
+
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the Default Sources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
|
|
938
948
|
* @param queryString
|
|
939
949
|
* @returns
|
|
940
950
|
*/
|
|
941
951
|
findSourceOfQuery(queryString) {
|
|
942
|
-
const foundSource = Object.keys(
|
|
943
|
-
if (foundSource && !["https", "http"].includes(foundSource) &&
|
|
952
|
+
const foundSource = Object.keys(this.SourcesRecord).find((source) => queryString?.toLowerCase?.()?.startsWith(`${source}:`.toLowerCase()))?.trim?.()?.toLowerCase?.();
|
|
953
|
+
if (foundSource && !["https", "http"].includes(foundSource) && this.SourcesRecord[foundSource]) {
|
|
944
954
|
return foundSource;
|
|
945
955
|
}
|
|
946
956
|
return null;
|
|
@@ -953,7 +963,7 @@ var ManagerUtils = class {
|
|
|
953
963
|
extractSourceOfQuery(searchQuery) {
|
|
954
964
|
const foundSource = this.findSourceOfQuery(searchQuery.query);
|
|
955
965
|
if (foundSource) {
|
|
956
|
-
searchQuery.source =
|
|
966
|
+
searchQuery.source = this.SourcesRecord[foundSource];
|
|
957
967
|
searchQuery.query = searchQuery.query.slice(`${foundSource}:`.length, searchQuery.query.length);
|
|
958
968
|
}
|
|
959
969
|
return searchQuery;
|
|
@@ -984,7 +994,7 @@ var ManagerUtils = class {
|
|
|
984
994
|
return this.extractSourceOfQuery(Query);
|
|
985
995
|
}
|
|
986
996
|
const providedSource = query?.source?.trim?.()?.toLowerCase?.();
|
|
987
|
-
const validSourceExtracted =
|
|
997
|
+
const validSourceExtracted = this.SourcesRecord[providedSource ?? typedDefault];
|
|
988
998
|
return this.extractSourceOfQuery({
|
|
989
999
|
query: query.query,
|
|
990
1000
|
extraQueryUrlParams: query.extraQueryUrlParams,
|
|
@@ -1008,7 +1018,7 @@ var ManagerUtils = class {
|
|
|
1008
1018
|
return this.extractSourceOfQuery(Query2);
|
|
1009
1019
|
}
|
|
1010
1020
|
const providedSource = query?.source?.trim?.()?.toLowerCase?.();
|
|
1011
|
-
const validSourceExtracted =
|
|
1021
|
+
const validSourceExtracted = this.SourcesRecord[providedSource ?? typedDefault];
|
|
1012
1022
|
const Query = {
|
|
1013
1023
|
query: query.query,
|
|
1014
1024
|
types: query.types ? ["track", "playlist", "artist", "album", "text"].filter(
|
|
@@ -1032,7 +1042,7 @@ var ManagerUtils = class {
|
|
|
1032
1042
|
*/
|
|
1033
1043
|
validateSourceString(node, sourceString) {
|
|
1034
1044
|
if (!sourceString) throw new Error(`No SourceString was provided`);
|
|
1035
|
-
const source =
|
|
1045
|
+
const source = this.SourcesRecord[sourceString.toLowerCase().trim()];
|
|
1036
1046
|
if (!source && !!this.LavalinkManager.options.playerOptions.allowCustomSources)
|
|
1037
1047
|
throw new Error(
|
|
1038
1048
|
`Lavalink-Client does not support SearchQuerySource: '${sourceString}'. You can disable this check by setting 'ManagerOptions.PlayerOptions.allowCustomSources' to true`
|
|
@@ -1110,6 +1120,18 @@ var ManagerUtils = class {
|
|
|
1110
1120
|
if (["pdsearch", "pdisrc", "pdrec"].includes(source) && !node.info?.sourceManagers?.includes("pandora")) {
|
|
1111
1121
|
throw new Error("Lavalink Node has not 'pandora' enabled, which is required to have '" + source + "' work");
|
|
1112
1122
|
}
|
|
1123
|
+
if (source === "amzsearch" && !node.info?.sourceManagers?.includes("amazonmusic")) {
|
|
1124
|
+
throw new Error("Lavalink Node has not 'amazonmusic' enabled, which is required to have 'amzsearch' work");
|
|
1125
|
+
}
|
|
1126
|
+
if (source === "admsearch" && !node.info?.sourceManagers?.includes("audiomack")) {
|
|
1127
|
+
throw new Error("Lavalink Node has not 'audiomack' enabled, which is required to have 'admsearch' work");
|
|
1128
|
+
}
|
|
1129
|
+
if (source === "gnsearch" && !node.info?.sourceManagers?.includes("gaana")) {
|
|
1130
|
+
throw new Error("Lavalink Node has not 'gaana' enabled, which is required to have 'gnsearch' work");
|
|
1131
|
+
}
|
|
1132
|
+
if (source === "szsearch" && !node.info?.sourceManagers?.includes("shazam")) {
|
|
1133
|
+
throw new Error("Lavalink Node has not 'shazam' enabled, which is required to have 'szsearch' work");
|
|
1134
|
+
}
|
|
1113
1135
|
return;
|
|
1114
1136
|
}
|
|
1115
1137
|
};
|
|
@@ -1432,8 +1454,10 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1432
1454
|
path: `/${this.version}/${endpoint.startsWith("/") ? endpoint.slice(1) : endpoint}`,
|
|
1433
1455
|
method: "GET",
|
|
1434
1456
|
headers: {
|
|
1435
|
-
Authorization: this.options.authorization
|
|
1457
|
+
Authorization: this.options.authorization,
|
|
1458
|
+
...this.NodeManager.LavalinkManager?.options?.httpHeaders
|
|
1436
1459
|
},
|
|
1460
|
+
// if httpHeaders is undefined/null, it won't be added, so we can keept it short like this
|
|
1437
1461
|
signal: this.options.requestSignalTimeoutMS && this.options.requestSignalTimeoutMS > 0 ? AbortSignal.timeout(this.options.requestSignalTimeoutMS) : void 0
|
|
1438
1462
|
};
|
|
1439
1463
|
modify?.(options);
|
|
@@ -1668,7 +1692,8 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1668
1692
|
"Client-Name": String(this._LManager.options.client.username || "Lavalink-Client").replace(
|
|
1669
1693
|
/[^\x20-\x7E]/g,
|
|
1670
1694
|
""
|
|
1671
|
-
)
|
|
1695
|
+
),
|
|
1696
|
+
...this.NodeManager.LavalinkManager.options?.httpHeaders
|
|
1672
1697
|
};
|
|
1673
1698
|
if (typeof this.options.sessionId === "string" || typeof sessionId === "string") {
|
|
1674
1699
|
headers["Session-Id"] = this.options.sessionId || sessionId;
|
|
@@ -3153,13 +3178,119 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
3153
3178
|
if (this.info?.sourceManagers.includes("vkmusic")) source.add("vksearch").add("vkrec");
|
|
3154
3179
|
if (this.info?.sourceManagers.includes("tidal")) source.add("tdsearch").add("tdrec");
|
|
3155
3180
|
if (this.info?.sourceManagers.includes("qobuz")) source.add("qbsearch").add("qbisrc").add("qbrec");
|
|
3156
|
-
if (this.info?.sourceManagers.includes("pandora")) source.add("pdsearch").add("pdisrc").add("pdrec");
|
|
3157
3181
|
if (this.info?.sourceManagers.includes("youtube")) source.add("ytsearch").add("ytmsearch");
|
|
3158
3182
|
return typeof src === "string" && source.has(src);
|
|
3159
3183
|
}
|
|
3160
3184
|
};
|
|
3161
3185
|
|
|
3162
3186
|
// src/structures/NodeLink.ts
|
|
3187
|
+
var NodeLinkDefaultSources = {
|
|
3188
|
+
// youtubemusic
|
|
3189
|
+
"youtube music": "ytmsearch",
|
|
3190
|
+
youtubemusic: "ytmsearch",
|
|
3191
|
+
ytmsearch: "ytmsearch",
|
|
3192
|
+
ytm: "ytmsearch",
|
|
3193
|
+
musicyoutube: "ytmsearch",
|
|
3194
|
+
"music youtube": "ytmsearch",
|
|
3195
|
+
// youtube
|
|
3196
|
+
youtube: "ytsearch",
|
|
3197
|
+
yt: "ytsearch",
|
|
3198
|
+
ytsearch: "ytsearch",
|
|
3199
|
+
// soundcloud
|
|
3200
|
+
soundcloud: "scsearch",
|
|
3201
|
+
scsearch: "scsearch",
|
|
3202
|
+
sc: "scsearch",
|
|
3203
|
+
// apple music
|
|
3204
|
+
"apple music": "amsearch",
|
|
3205
|
+
apple: "amsearch",
|
|
3206
|
+
applemusic: "amsearch",
|
|
3207
|
+
amsearch: "amsearch",
|
|
3208
|
+
am: "amsearch",
|
|
3209
|
+
musicapple: "amsearch",
|
|
3210
|
+
"music apple": "amsearch",
|
|
3211
|
+
// spotify
|
|
3212
|
+
spotify: "spsearch",
|
|
3213
|
+
spsearch: "spsearch",
|
|
3214
|
+
sp: "spsearch",
|
|
3215
|
+
"spotify.com": "spsearch",
|
|
3216
|
+
spotifycom: "spsearch",
|
|
3217
|
+
sprec: "sprec",
|
|
3218
|
+
spsuggestion: "sprec",
|
|
3219
|
+
// deezer
|
|
3220
|
+
deezer: "dzsearch",
|
|
3221
|
+
dz: "dzsearch",
|
|
3222
|
+
dzsearch: "dzsearch",
|
|
3223
|
+
dzisrc: "dzsearch",
|
|
3224
|
+
// NodeLink doesn't expose `dzisrc` as a prefix string
|
|
3225
|
+
dzrec: "dzrec",
|
|
3226
|
+
// yandexmusic
|
|
3227
|
+
"yandex music": "ymsearch",
|
|
3228
|
+
yandexmusic: "ymsearch",
|
|
3229
|
+
yandex: "ymsearch",
|
|
3230
|
+
ymsearch: "ymsearch",
|
|
3231
|
+
ymrec: "ymsearch",
|
|
3232
|
+
// VK Music
|
|
3233
|
+
vksearch: "vksearch",
|
|
3234
|
+
vkmusic: "vksearch",
|
|
3235
|
+
"vk music": "vksearch",
|
|
3236
|
+
vkrec: "vkrec",
|
|
3237
|
+
vk: "vksearch",
|
|
3238
|
+
// Qobuz
|
|
3239
|
+
qbsearch: "qbsearch",
|
|
3240
|
+
qobuz: "qbsearch",
|
|
3241
|
+
qbisrc: "qbsearch",
|
|
3242
|
+
// NodeLink doesn't expose `qbisrc` as a prefix string
|
|
3243
|
+
qbrec: "qbsearch",
|
|
3244
|
+
// NodeLink doesn't expose `qbrec` as a prefix string
|
|
3245
|
+
// pandora
|
|
3246
|
+
pandora: "pdsearch",
|
|
3247
|
+
pd: "pdsearch",
|
|
3248
|
+
pdsearch: "pdsearch",
|
|
3249
|
+
"pandora music": "pdsearch",
|
|
3250
|
+
pandoramusic: "pdsearch",
|
|
3251
|
+
// speak PLUGIN
|
|
3252
|
+
speak: "speak",
|
|
3253
|
+
// Map Lavalink's `tts` prefix to NodeLink's `gtts`
|
|
3254
|
+
tts: "gtts",
|
|
3255
|
+
ftts: "ftts",
|
|
3256
|
+
flowery: "flowery",
|
|
3257
|
+
"flowery.tts": "flowery",
|
|
3258
|
+
flowerytts: "flowery",
|
|
3259
|
+
// Client sided search platforms
|
|
3260
|
+
bandcamp: "bcsearch",
|
|
3261
|
+
bc: "bcsearch",
|
|
3262
|
+
bcsearch: "bcsearch",
|
|
3263
|
+
// other searches (not supported explicitly in NodeLink prefixes)
|
|
3264
|
+
phsearch: "search",
|
|
3265
|
+
pornhub: "search",
|
|
3266
|
+
porn: "search",
|
|
3267
|
+
// local files
|
|
3268
|
+
local: "local",
|
|
3269
|
+
// http requests
|
|
3270
|
+
http: "http",
|
|
3271
|
+
https: "https",
|
|
3272
|
+
link: "link",
|
|
3273
|
+
uri: "uri",
|
|
3274
|
+
// tidal
|
|
3275
|
+
tidal: "tdsearch",
|
|
3276
|
+
td: "tdsearch",
|
|
3277
|
+
"tidal music": "tdsearch",
|
|
3278
|
+
tdsearch: "tdsearch",
|
|
3279
|
+
tdrec: "tdrec",
|
|
3280
|
+
// jiosaavn
|
|
3281
|
+
jiosaavn: "jssearch",
|
|
3282
|
+
js: "jssearch",
|
|
3283
|
+
jssearch: "jssearch",
|
|
3284
|
+
jsrec: "jsrec",
|
|
3285
|
+
amzsearch: "amsearch",
|
|
3286
|
+
// amazon music (falls back to Apple Music search on NodeLink)
|
|
3287
|
+
// audiomack
|
|
3288
|
+
admsearch: "admsearch",
|
|
3289
|
+
// gaana
|
|
3290
|
+
gnsearch: "gaanasearch",
|
|
3291
|
+
// shazam
|
|
3292
|
+
szsearch: "szsearch"
|
|
3293
|
+
};
|
|
3163
3294
|
var NodeLinkNode = class extends LavalinkNode {
|
|
3164
3295
|
nodeType = "NodeLink" /* NodeLink */;
|
|
3165
3296
|
constructor(options, manager) {
|
|
@@ -6362,6 +6493,7 @@ var LavalinkManager = class _LavalinkManager extends import_node_events2.EventEm
|
|
|
6362
6493
|
queueChangesWatcher: options?.queueOptions?.queueChangesWatcher ?? null,
|
|
6363
6494
|
queueStore: options?.queueOptions?.queueStore ?? new DefaultQueueStore()
|
|
6364
6495
|
},
|
|
6496
|
+
httpHeaders: options?.httpHeaders ?? {},
|
|
6365
6497
|
advancedOptions: {
|
|
6366
6498
|
enableDebugEvents: options?.advancedOptions?.enableDebugEvents ?? false,
|
|
6367
6499
|
maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 6e5,
|
|
@@ -6415,6 +6547,19 @@ var LavalinkManager = class _LavalinkManager extends import_node_events2.EventEm
|
|
|
6415
6547
|
}
|
|
6416
6548
|
if (typeof options?.queueOptions?.maxPreviousTracks !== "number" || options?.queueOptions?.maxPreviousTracks < 0)
|
|
6417
6549
|
options.queueOptions.maxPreviousTracks = 25;
|
|
6550
|
+
if (options?.httpHeaders) {
|
|
6551
|
+
if (typeof options.httpHeaders !== "object" || Array.isArray(options.httpHeaders))
|
|
6552
|
+
throw new SyntaxError("ManagerOption.httpHeaders must be an object with string keys and string values");
|
|
6553
|
+
const forbiddenHeaders = ["authorization", "user-id", "client-name", "session-id"];
|
|
6554
|
+
for (const header in options.httpHeaders) {
|
|
6555
|
+
if (forbiddenHeaders.includes(header.toLowerCase()))
|
|
6556
|
+
throw new SyntaxError(
|
|
6557
|
+
`ManagerOption.httpHeaders cannot have the following headers: ${forbiddenHeaders.join(", ")}`
|
|
6558
|
+
);
|
|
6559
|
+
if (typeof options.httpHeaders[header] !== "string")
|
|
6560
|
+
throw new SyntaxError(`ManagerOption.httpHeaders values must be of type string :: ${header}`);
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6418
6563
|
}
|
|
6419
6564
|
/**
|
|
6420
6565
|
* Emits a debug event to the LavalinkManager
|
|
@@ -6899,6 +7044,7 @@ var LavalinkManager = class _LavalinkManager extends import_node_events2.EventEm
|
|
|
6899
7044
|
LavalinkPlugins,
|
|
6900
7045
|
ManagerUtils,
|
|
6901
7046
|
MiniMap,
|
|
7047
|
+
NodeLinkDefaultSources,
|
|
6902
7048
|
NodeLinkExclusiveEvents,
|
|
6903
7049
|
NodeLinkNode,
|
|
6904
7050
|
NodeManager,
|
package/dist/index.d.cts
CHANGED
|
@@ -417,6 +417,8 @@ declare function parseLavalinkConnUrl(connectionUrl: string): {
|
|
|
417
417
|
};
|
|
418
418
|
declare class ManagerUtils {
|
|
419
419
|
LavalinkManager: LavalinkManager | undefined;
|
|
420
|
+
/** Override this with your custom sources record if you want to use custom sources for your node */
|
|
421
|
+
SourcesRecord: Record<SearchPlatform, LavalinkSearchPlatform | ClientCustomSearchPlatformUtils>;
|
|
420
422
|
constructor(LavalinkManager?: LavalinkManager);
|
|
421
423
|
/**
|
|
422
424
|
* Builds a pluginInfo object based on the provided data, extracting relevant information from the data and clientData parameters. This function is used to construct the pluginInfo property for tracks, allowing for consistent handling of plugin-related information across different track sources and formats.
|
|
@@ -504,7 +506,7 @@ declare class ManagerUtils {
|
|
|
504
506
|
*/
|
|
505
507
|
validateQueryString(node: LavalinkNode, queryString: string, sourceString?: SearchPlatform): void;
|
|
506
508
|
/**
|
|
507
|
-
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the
|
|
509
|
+
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the Default Sources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
|
|
508
510
|
* @param queryString
|
|
509
511
|
* @returns
|
|
510
512
|
*/
|
|
@@ -547,7 +549,7 @@ declare class ManagerUtils {
|
|
|
547
549
|
} | {
|
|
548
550
|
query: string;
|
|
549
551
|
types: string[];
|
|
550
|
-
source: "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "
|
|
552
|
+
source: "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "jssearch" | "jsrec" | "ftts" | "speak" | "phsearch" | "pornhub" | "porn" | "tts" | "amzsearch" | "admsearch" | "gnsearch" | "szsearch" | "pdsearch" | "local" | "http" | "https" | "link" | "uri" | "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" | "pandora" | "pd" | "pandora music" | "pandoramusic" | "flowerytts" | "flowery" | "flowery.tts" | "bandcamp" | "bc" | "js" | "jiosaavn" | "td";
|
|
551
553
|
};
|
|
552
554
|
/**
|
|
553
555
|
* Validates the provided source string against the capabilities of the Lavalink node. It checks if the source string is supported by the node's enabled source managers and plugins, throwing errors if any required sources or plugins are missing for the specified search platform. This ensures that search queries are only executed with compatible sources based on the node's configuration.
|
|
@@ -609,13 +611,17 @@ type Opaque<T, K> = T & {
|
|
|
609
611
|
type IntegerNumber = Opaque<number, "Int">;
|
|
610
612
|
/** Opqaue tyep for floatnumber */
|
|
611
613
|
type FloatNumber = Opaque<number, "Float">;
|
|
612
|
-
type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "
|
|
614
|
+
type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "ytsearch" | "jssearch" | "jsrec";
|
|
613
615
|
type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
|
|
614
616
|
type JioSaavnSearchPlatform = "jssearch" | "jsrec";
|
|
615
617
|
type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
|
|
618
|
+
type PulseLinkSearchPlatform = "spsearch" | "amzsearch" | "amsearch" | "dzsearch" | "ymsearch" | "vksearch" | "tdsearch" | "qbsearch" | "jssearch" | "admsearch" | "gnsearch" | "szsearch" | "pdsearch" | "ytsearch" | "ytmsearch";
|
|
616
619
|
type LavalinkClientSearchPlatform = "bcsearch";
|
|
617
620
|
type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
|
|
618
|
-
type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
|
|
621
|
+
type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | PulseLinkSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
|
|
622
|
+
type NodeLinkSearchPlatformBase = "ytsearch" | "ytmsearch" | "scsearch" | "search" | "spsearch" | "amsearch" | "dzsearch" | "tdsearch" | "bcsearch" | "admsearch" | "audiomack" | "gaanasearch" | "jssearch" | "lfsearch" | "pdsearch" | "vksearch" | "mcsearch" | "ncsearch" | "nicovideo" | "bilibili" | "shsearch" | "szsearch" | "ebox" | "jukebox" | "slsearch" | "qbsearch" | "ymsearch" | "ausearch" | "azsearch" | "agsearch" | "bksearch" | "lmsearch" | "pipertts" | "gtts" | "speak" | "ftts" | "flowery" | "gdsearch";
|
|
623
|
+
type NodeLinkRecommendationPlatform = "ytrec" | "sprec" | "dzrec" | "tdrec" | "jsrec" | "vkrec";
|
|
624
|
+
type NodeLinkSearchPlatform = NodeLinkSearchPlatformBase | NodeLinkRecommendationPlatform;
|
|
619
625
|
type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
|
|
620
626
|
type ClientSearchPlatform = ClientCustomSearchPlatformUtils | "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" | "pandora" | "pd" | "pandora music" | "pandoramusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
|
|
621
627
|
type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
@@ -2893,6 +2899,8 @@ declare class Player {
|
|
|
2893
2899
|
toJSON(): PlayerJson;
|
|
2894
2900
|
}
|
|
2895
2901
|
|
|
2902
|
+
/** Default Sources Record for NodeLink, to allow source parsing with multiple inputs. */
|
|
2903
|
+
declare const NodeLinkDefaultSources: Record<SearchPlatform, NodeLinkSearchPlatform | ClientCustomSearchPlatformUtils>;
|
|
2896
2904
|
declare class NodeLinkNode extends LavalinkNode {
|
|
2897
2905
|
nodeType: NodeType;
|
|
2898
2906
|
constructor(options: LavalinkNodeOptions, manager: NodeManager);
|
|
@@ -4073,6 +4081,8 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
|
|
|
4073
4081
|
linksBlacklist?: (RegExp | string)[];
|
|
4074
4082
|
/** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
|
|
4075
4083
|
linksAllowed?: boolean;
|
|
4084
|
+
/** Custom http headers to be sent with every request to lavalink */
|
|
4085
|
+
httpHeaders?: Record<string, string>;
|
|
4076
4086
|
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
4077
4087
|
advancedOptions?: {
|
|
4078
4088
|
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
@@ -4347,8 +4357,9 @@ declare const LavalinkPlugins: {
|
|
|
4347
4357
|
Jiosaavn_Plugin: string;
|
|
4348
4358
|
LavalinkFilterPlugin: string;
|
|
4349
4359
|
JavaTimedLyricsPlugin: string;
|
|
4360
|
+
PulseLinkPlugin: string;
|
|
4350
4361
|
};
|
|
4351
4362
|
/** Lavalink Sources regexes for url validations */
|
|
4352
4363
|
declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
|
|
4353
4364
|
|
|
4354
|
-
export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, type DeepRequired, 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, type NodeLinkConnectionMetrics, NodeLinkExclusiveEvents, NodeLinkNode, type NodeLink_ChorusFilter, type NodeLink_CompressorFilter, type NodeLink_EchoFilter, type NodeLink_HighPassFilter, type NodeLink_PhaserFilter, type NodeLink_SpatialFilter, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, NodeType, 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, RecommendationsStrings, ReconnectionState, type RepeatMode, type RequiredManagerOptions, 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 TrackRequester, 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 };
|
|
4365
|
+
export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, type DeepRequired, 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, type NodeLinkConnectionMetrics, NodeLinkDefaultSources, NodeLinkExclusiveEvents, NodeLinkNode, type NodeLinkRecommendationPlatform, type NodeLinkSearchPlatform, type NodeLinkSearchPlatformBase, type NodeLink_ChorusFilter, type NodeLink_CompressorFilter, type NodeLink_EchoFilter, type NodeLink_HighPassFilter, type NodeLink_PhaserFilter, type NodeLink_SpatialFilter, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, NodeType, 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, type PulseLinkSearchPlatform, Queue, type QueueChangesWatcher, QueueSaver, type QueueStoreManager, QueueSymbol, RecommendationsStrings, ReconnectionState, type RepeatMode, type RequiredManagerOptions, 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 TrackRequester, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -417,6 +417,8 @@ declare function parseLavalinkConnUrl(connectionUrl: string): {
|
|
|
417
417
|
};
|
|
418
418
|
declare class ManagerUtils {
|
|
419
419
|
LavalinkManager: LavalinkManager | undefined;
|
|
420
|
+
/** Override this with your custom sources record if you want to use custom sources for your node */
|
|
421
|
+
SourcesRecord: Record<SearchPlatform, LavalinkSearchPlatform | ClientCustomSearchPlatformUtils>;
|
|
420
422
|
constructor(LavalinkManager?: LavalinkManager);
|
|
421
423
|
/**
|
|
422
424
|
* Builds a pluginInfo object based on the provided data, extracting relevant information from the data and clientData parameters. This function is used to construct the pluginInfo property for tracks, allowing for consistent handling of plugin-related information across different track sources and formats.
|
|
@@ -504,7 +506,7 @@ declare class ManagerUtils {
|
|
|
504
506
|
*/
|
|
505
507
|
validateQueryString(node: LavalinkNode, queryString: string, sourceString?: SearchPlatform): void;
|
|
506
508
|
/**
|
|
507
|
-
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the
|
|
509
|
+
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the Default Sources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
|
|
508
510
|
* @param queryString
|
|
509
511
|
* @returns
|
|
510
512
|
*/
|
|
@@ -547,7 +549,7 @@ declare class ManagerUtils {
|
|
|
547
549
|
} | {
|
|
548
550
|
query: string;
|
|
549
551
|
types: string[];
|
|
550
|
-
source: "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "
|
|
552
|
+
source: "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "jssearch" | "jsrec" | "ftts" | "speak" | "phsearch" | "pornhub" | "porn" | "tts" | "amzsearch" | "admsearch" | "gnsearch" | "szsearch" | "pdsearch" | "local" | "http" | "https" | "link" | "uri" | "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" | "pandora" | "pd" | "pandora music" | "pandoramusic" | "flowerytts" | "flowery" | "flowery.tts" | "bandcamp" | "bc" | "js" | "jiosaavn" | "td";
|
|
551
553
|
};
|
|
552
554
|
/**
|
|
553
555
|
* Validates the provided source string against the capabilities of the Lavalink node. It checks if the source string is supported by the node's enabled source managers and plugins, throwing errors if any required sources or plugins are missing for the specified search platform. This ensures that search queries are only executed with compatible sources based on the node's configuration.
|
|
@@ -609,13 +611,17 @@ type Opaque<T, K> = T & {
|
|
|
609
611
|
type IntegerNumber = Opaque<number, "Int">;
|
|
610
612
|
/** Opqaue tyep for floatnumber */
|
|
611
613
|
type FloatNumber = Opaque<number, "Float">;
|
|
612
|
-
type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "
|
|
614
|
+
type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "dzrec" | "ymsearch" | "ymrec" | "vksearch" | "vkrec" | "tdsearch" | "tdrec" | "qbsearch" | "qbisrc" | "qbrec" | "ytsearch" | "jssearch" | "jsrec";
|
|
613
615
|
type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
|
|
614
616
|
type JioSaavnSearchPlatform = "jssearch" | "jsrec";
|
|
615
617
|
type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
|
|
618
|
+
type PulseLinkSearchPlatform = "spsearch" | "amzsearch" | "amsearch" | "dzsearch" | "ymsearch" | "vksearch" | "tdsearch" | "qbsearch" | "jssearch" | "admsearch" | "gnsearch" | "szsearch" | "pdsearch" | "ytsearch" | "ytmsearch";
|
|
616
619
|
type LavalinkClientSearchPlatform = "bcsearch";
|
|
617
620
|
type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
|
|
618
|
-
type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
|
|
621
|
+
type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | PulseLinkSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
|
|
622
|
+
type NodeLinkSearchPlatformBase = "ytsearch" | "ytmsearch" | "scsearch" | "search" | "spsearch" | "amsearch" | "dzsearch" | "tdsearch" | "bcsearch" | "admsearch" | "audiomack" | "gaanasearch" | "jssearch" | "lfsearch" | "pdsearch" | "vksearch" | "mcsearch" | "ncsearch" | "nicovideo" | "bilibili" | "shsearch" | "szsearch" | "ebox" | "jukebox" | "slsearch" | "qbsearch" | "ymsearch" | "ausearch" | "azsearch" | "agsearch" | "bksearch" | "lmsearch" | "pipertts" | "gtts" | "speak" | "ftts" | "flowery" | "gdsearch";
|
|
623
|
+
type NodeLinkRecommendationPlatform = "ytrec" | "sprec" | "dzrec" | "tdrec" | "jsrec" | "vkrec";
|
|
624
|
+
type NodeLinkSearchPlatform = NodeLinkSearchPlatformBase | NodeLinkRecommendationPlatform;
|
|
619
625
|
type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
|
|
620
626
|
type ClientSearchPlatform = ClientCustomSearchPlatformUtils | "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" | "pandora" | "pd" | "pandora music" | "pandoramusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn" | "td" | "tidal" | "tdrec";
|
|
621
627
|
type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
@@ -2893,6 +2899,8 @@ declare class Player {
|
|
|
2893
2899
|
toJSON(): PlayerJson;
|
|
2894
2900
|
}
|
|
2895
2901
|
|
|
2902
|
+
/** Default Sources Record for NodeLink, to allow source parsing with multiple inputs. */
|
|
2903
|
+
declare const NodeLinkDefaultSources: Record<SearchPlatform, NodeLinkSearchPlatform | ClientCustomSearchPlatformUtils>;
|
|
2896
2904
|
declare class NodeLinkNode extends LavalinkNode {
|
|
2897
2905
|
nodeType: NodeType;
|
|
2898
2906
|
constructor(options: LavalinkNodeOptions, manager: NodeManager);
|
|
@@ -4073,6 +4081,8 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
|
|
|
4073
4081
|
linksBlacklist?: (RegExp | string)[];
|
|
4074
4082
|
/** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
|
|
4075
4083
|
linksAllowed?: boolean;
|
|
4084
|
+
/** Custom http headers to be sent with every request to lavalink */
|
|
4085
|
+
httpHeaders?: Record<string, string>;
|
|
4076
4086
|
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
4077
4087
|
advancedOptions?: {
|
|
4078
4088
|
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
@@ -4347,8 +4357,9 @@ declare const LavalinkPlugins: {
|
|
|
4347
4357
|
Jiosaavn_Plugin: string;
|
|
4348
4358
|
LavalinkFilterPlugin: string;
|
|
4349
4359
|
JavaTimedLyricsPlugin: string;
|
|
4360
|
+
PulseLinkPlugin: string;
|
|
4350
4361
|
};
|
|
4351
4362
|
/** Lavalink Sources regexes for url validations */
|
|
4352
4363
|
declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
|
|
4353
4364
|
|
|
4354
|
-
export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, type DeepRequired, 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, type NodeLinkConnectionMetrics, NodeLinkExclusiveEvents, NodeLinkNode, type NodeLink_ChorusFilter, type NodeLink_CompressorFilter, type NodeLink_EchoFilter, type NodeLink_HighPassFilter, type NodeLink_PhaserFilter, type NodeLink_SpatialFilter, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, NodeType, 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, RecommendationsStrings, ReconnectionState, type RepeatMode, type RequiredManagerOptions, 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 TrackRequester, 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 };
|
|
4365
|
+
export { type AudioOutputs, type Awaitable, type Base64, type BaseNodeStats, type BasePlayOptions, type BotClientOptions, type CPUStats, type ChannelDeletePacket, type ChannelMixFilter, type ClientCustomSearchPlatformUtils, type ClientSearchPlatform, DebugEvents, type DeepRequired, 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, type NodeLinkConnectionMetrics, NodeLinkDefaultSources, NodeLinkExclusiveEvents, NodeLinkNode, type NodeLinkRecommendationPlatform, type NodeLinkSearchPlatform, type NodeLinkSearchPlatformBase, type NodeLink_ChorusFilter, type NodeLink_CompressorFilter, type NodeLink_EchoFilter, type NodeLink_HighPassFilter, type NodeLink_PhaserFilter, type NodeLink_SpatialFilter, NodeManager, type NodeManagerEvents, type NodeMessage, type NodeStats, NodeSymbol, NodeType, 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, type PulseLinkSearchPlatform, Queue, type QueueChangesWatcher, QueueSaver, type QueueStoreManager, QueueSymbol, RecommendationsStrings, ReconnectionState, type RepeatMode, type RequiredManagerOptions, 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 TrackRequester, 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 };
|
package/dist/index.js
CHANGED
|
@@ -421,8 +421,6 @@ var DefaultSources = {
|
|
|
421
421
|
pandora: "pdsearch",
|
|
422
422
|
pd: "pdsearch",
|
|
423
423
|
pdsearch: "pdsearch",
|
|
424
|
-
pdisrc: "pdisrc",
|
|
425
|
-
pdrec: "pdrec",
|
|
426
424
|
"pandora music": "pdsearch",
|
|
427
425
|
pandoramusic: "pdsearch",
|
|
428
426
|
// speak PLUGIN
|
|
@@ -457,7 +455,15 @@ var DefaultSources = {
|
|
|
457
455
|
jiosaavn: "jssearch",
|
|
458
456
|
js: "jssearch",
|
|
459
457
|
jssearch: "jssearch",
|
|
460
|
-
jsrec: "jsrec"
|
|
458
|
+
jsrec: "jsrec",
|
|
459
|
+
// amazon music
|
|
460
|
+
amzsearch: "amzsearch",
|
|
461
|
+
// audiomack
|
|
462
|
+
admsearch: "admsearch",
|
|
463
|
+
// gaana
|
|
464
|
+
gnsearch: "gnsearch",
|
|
465
|
+
// shazam
|
|
466
|
+
szsearch: "szsearch"
|
|
461
467
|
};
|
|
462
468
|
var LavalinkPlugins = {
|
|
463
469
|
DuncteBot_Plugin: "DuncteBot-plugin",
|
|
@@ -466,7 +472,8 @@ var LavalinkPlugins = {
|
|
|
466
472
|
LavaSearch: "lavasearch-plugin",
|
|
467
473
|
Jiosaavn_Plugin: "jiosaavn-plugin",
|
|
468
474
|
LavalinkFilterPlugin: "lavalink-filter-plugin",
|
|
469
|
-
JavaTimedLyricsPlugin: "java-lyrics-plugin"
|
|
475
|
+
JavaTimedLyricsPlugin: "java-lyrics-plugin",
|
|
476
|
+
PulseLinkPlugin: "pulselink-plugin"
|
|
470
477
|
};
|
|
471
478
|
var SourceLinksRegexes = {
|
|
472
479
|
/** DEFAULT SUPPORTED BY LAVALINK */
|
|
@@ -542,6 +549,8 @@ function parseLavalinkConnUrl(connectionUrl) {
|
|
|
542
549
|
}
|
|
543
550
|
var ManagerUtils = class {
|
|
544
551
|
LavalinkManager = void 0;
|
|
552
|
+
/** Override this with your custom sources record if you want to use custom sources for your node */
|
|
553
|
+
SourcesRecord = DefaultSources;
|
|
545
554
|
constructor(LavalinkManager2) {
|
|
546
555
|
this.LavalinkManager = LavalinkManager2;
|
|
547
556
|
}
|
|
@@ -869,13 +878,13 @@ var ManagerUtils = class {
|
|
|
869
878
|
return;
|
|
870
879
|
}
|
|
871
880
|
/**
|
|
872
|
-
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the
|
|
881
|
+
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the Default Sources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
|
|
873
882
|
* @param queryString
|
|
874
883
|
* @returns
|
|
875
884
|
*/
|
|
876
885
|
findSourceOfQuery(queryString) {
|
|
877
|
-
const foundSource = Object.keys(
|
|
878
|
-
if (foundSource && !["https", "http"].includes(foundSource) &&
|
|
886
|
+
const foundSource = Object.keys(this.SourcesRecord).find((source) => queryString?.toLowerCase?.()?.startsWith(`${source}:`.toLowerCase()))?.trim?.()?.toLowerCase?.();
|
|
887
|
+
if (foundSource && !["https", "http"].includes(foundSource) && this.SourcesRecord[foundSource]) {
|
|
879
888
|
return foundSource;
|
|
880
889
|
}
|
|
881
890
|
return null;
|
|
@@ -888,7 +897,7 @@ var ManagerUtils = class {
|
|
|
888
897
|
extractSourceOfQuery(searchQuery) {
|
|
889
898
|
const foundSource = this.findSourceOfQuery(searchQuery.query);
|
|
890
899
|
if (foundSource) {
|
|
891
|
-
searchQuery.source =
|
|
900
|
+
searchQuery.source = this.SourcesRecord[foundSource];
|
|
892
901
|
searchQuery.query = searchQuery.query.slice(`${foundSource}:`.length, searchQuery.query.length);
|
|
893
902
|
}
|
|
894
903
|
return searchQuery;
|
|
@@ -919,7 +928,7 @@ var ManagerUtils = class {
|
|
|
919
928
|
return this.extractSourceOfQuery(Query);
|
|
920
929
|
}
|
|
921
930
|
const providedSource = query?.source?.trim?.()?.toLowerCase?.();
|
|
922
|
-
const validSourceExtracted =
|
|
931
|
+
const validSourceExtracted = this.SourcesRecord[providedSource ?? typedDefault];
|
|
923
932
|
return this.extractSourceOfQuery({
|
|
924
933
|
query: query.query,
|
|
925
934
|
extraQueryUrlParams: query.extraQueryUrlParams,
|
|
@@ -943,7 +952,7 @@ var ManagerUtils = class {
|
|
|
943
952
|
return this.extractSourceOfQuery(Query2);
|
|
944
953
|
}
|
|
945
954
|
const providedSource = query?.source?.trim?.()?.toLowerCase?.();
|
|
946
|
-
const validSourceExtracted =
|
|
955
|
+
const validSourceExtracted = this.SourcesRecord[providedSource ?? typedDefault];
|
|
947
956
|
const Query = {
|
|
948
957
|
query: query.query,
|
|
949
958
|
types: query.types ? ["track", "playlist", "artist", "album", "text"].filter(
|
|
@@ -967,7 +976,7 @@ var ManagerUtils = class {
|
|
|
967
976
|
*/
|
|
968
977
|
validateSourceString(node, sourceString) {
|
|
969
978
|
if (!sourceString) throw new Error(`No SourceString was provided`);
|
|
970
|
-
const source =
|
|
979
|
+
const source = this.SourcesRecord[sourceString.toLowerCase().trim()];
|
|
971
980
|
if (!source && !!this.LavalinkManager.options.playerOptions.allowCustomSources)
|
|
972
981
|
throw new Error(
|
|
973
982
|
`Lavalink-Client does not support SearchQuerySource: '${sourceString}'. You can disable this check by setting 'ManagerOptions.PlayerOptions.allowCustomSources' to true`
|
|
@@ -1045,6 +1054,18 @@ var ManagerUtils = class {
|
|
|
1045
1054
|
if (["pdsearch", "pdisrc", "pdrec"].includes(source) && !node.info?.sourceManagers?.includes("pandora")) {
|
|
1046
1055
|
throw new Error("Lavalink Node has not 'pandora' enabled, which is required to have '" + source + "' work");
|
|
1047
1056
|
}
|
|
1057
|
+
if (source === "amzsearch" && !node.info?.sourceManagers?.includes("amazonmusic")) {
|
|
1058
|
+
throw new Error("Lavalink Node has not 'amazonmusic' enabled, which is required to have 'amzsearch' work");
|
|
1059
|
+
}
|
|
1060
|
+
if (source === "admsearch" && !node.info?.sourceManagers?.includes("audiomack")) {
|
|
1061
|
+
throw new Error("Lavalink Node has not 'audiomack' enabled, which is required to have 'admsearch' work");
|
|
1062
|
+
}
|
|
1063
|
+
if (source === "gnsearch" && !node.info?.sourceManagers?.includes("gaana")) {
|
|
1064
|
+
throw new Error("Lavalink Node has not 'gaana' enabled, which is required to have 'gnsearch' work");
|
|
1065
|
+
}
|
|
1066
|
+
if (source === "szsearch" && !node.info?.sourceManagers?.includes("shazam")) {
|
|
1067
|
+
throw new Error("Lavalink Node has not 'shazam' enabled, which is required to have 'szsearch' work");
|
|
1068
|
+
}
|
|
1048
1069
|
return;
|
|
1049
1070
|
}
|
|
1050
1071
|
};
|
|
@@ -1367,8 +1388,10 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1367
1388
|
path: `/${this.version}/${endpoint.startsWith("/") ? endpoint.slice(1) : endpoint}`,
|
|
1368
1389
|
method: "GET",
|
|
1369
1390
|
headers: {
|
|
1370
|
-
Authorization: this.options.authorization
|
|
1391
|
+
Authorization: this.options.authorization,
|
|
1392
|
+
...this.NodeManager.LavalinkManager?.options?.httpHeaders
|
|
1371
1393
|
},
|
|
1394
|
+
// if httpHeaders is undefined/null, it won't be added, so we can keept it short like this
|
|
1372
1395
|
signal: this.options.requestSignalTimeoutMS && this.options.requestSignalTimeoutMS > 0 ? AbortSignal.timeout(this.options.requestSignalTimeoutMS) : void 0
|
|
1373
1396
|
};
|
|
1374
1397
|
modify?.(options);
|
|
@@ -1603,7 +1626,8 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1603
1626
|
"Client-Name": String(this._LManager.options.client.username || "Lavalink-Client").replace(
|
|
1604
1627
|
/[^\x20-\x7E]/g,
|
|
1605
1628
|
""
|
|
1606
|
-
)
|
|
1629
|
+
),
|
|
1630
|
+
...this.NodeManager.LavalinkManager.options?.httpHeaders
|
|
1607
1631
|
};
|
|
1608
1632
|
if (typeof this.options.sessionId === "string" || typeof sessionId === "string") {
|
|
1609
1633
|
headers["Session-Id"] = this.options.sessionId || sessionId;
|
|
@@ -3088,13 +3112,119 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
3088
3112
|
if (this.info?.sourceManagers.includes("vkmusic")) source.add("vksearch").add("vkrec");
|
|
3089
3113
|
if (this.info?.sourceManagers.includes("tidal")) source.add("tdsearch").add("tdrec");
|
|
3090
3114
|
if (this.info?.sourceManagers.includes("qobuz")) source.add("qbsearch").add("qbisrc").add("qbrec");
|
|
3091
|
-
if (this.info?.sourceManagers.includes("pandora")) source.add("pdsearch").add("pdisrc").add("pdrec");
|
|
3092
3115
|
if (this.info?.sourceManagers.includes("youtube")) source.add("ytsearch").add("ytmsearch");
|
|
3093
3116
|
return typeof src === "string" && source.has(src);
|
|
3094
3117
|
}
|
|
3095
3118
|
};
|
|
3096
3119
|
|
|
3097
3120
|
// src/structures/NodeLink.ts
|
|
3121
|
+
var NodeLinkDefaultSources = {
|
|
3122
|
+
// youtubemusic
|
|
3123
|
+
"youtube music": "ytmsearch",
|
|
3124
|
+
youtubemusic: "ytmsearch",
|
|
3125
|
+
ytmsearch: "ytmsearch",
|
|
3126
|
+
ytm: "ytmsearch",
|
|
3127
|
+
musicyoutube: "ytmsearch",
|
|
3128
|
+
"music youtube": "ytmsearch",
|
|
3129
|
+
// youtube
|
|
3130
|
+
youtube: "ytsearch",
|
|
3131
|
+
yt: "ytsearch",
|
|
3132
|
+
ytsearch: "ytsearch",
|
|
3133
|
+
// soundcloud
|
|
3134
|
+
soundcloud: "scsearch",
|
|
3135
|
+
scsearch: "scsearch",
|
|
3136
|
+
sc: "scsearch",
|
|
3137
|
+
// apple music
|
|
3138
|
+
"apple music": "amsearch",
|
|
3139
|
+
apple: "amsearch",
|
|
3140
|
+
applemusic: "amsearch",
|
|
3141
|
+
amsearch: "amsearch",
|
|
3142
|
+
am: "amsearch",
|
|
3143
|
+
musicapple: "amsearch",
|
|
3144
|
+
"music apple": "amsearch",
|
|
3145
|
+
// spotify
|
|
3146
|
+
spotify: "spsearch",
|
|
3147
|
+
spsearch: "spsearch",
|
|
3148
|
+
sp: "spsearch",
|
|
3149
|
+
"spotify.com": "spsearch",
|
|
3150
|
+
spotifycom: "spsearch",
|
|
3151
|
+
sprec: "sprec",
|
|
3152
|
+
spsuggestion: "sprec",
|
|
3153
|
+
// deezer
|
|
3154
|
+
deezer: "dzsearch",
|
|
3155
|
+
dz: "dzsearch",
|
|
3156
|
+
dzsearch: "dzsearch",
|
|
3157
|
+
dzisrc: "dzsearch",
|
|
3158
|
+
// NodeLink doesn't expose `dzisrc` as a prefix string
|
|
3159
|
+
dzrec: "dzrec",
|
|
3160
|
+
// yandexmusic
|
|
3161
|
+
"yandex music": "ymsearch",
|
|
3162
|
+
yandexmusic: "ymsearch",
|
|
3163
|
+
yandex: "ymsearch",
|
|
3164
|
+
ymsearch: "ymsearch",
|
|
3165
|
+
ymrec: "ymsearch",
|
|
3166
|
+
// VK Music
|
|
3167
|
+
vksearch: "vksearch",
|
|
3168
|
+
vkmusic: "vksearch",
|
|
3169
|
+
"vk music": "vksearch",
|
|
3170
|
+
vkrec: "vkrec",
|
|
3171
|
+
vk: "vksearch",
|
|
3172
|
+
// Qobuz
|
|
3173
|
+
qbsearch: "qbsearch",
|
|
3174
|
+
qobuz: "qbsearch",
|
|
3175
|
+
qbisrc: "qbsearch",
|
|
3176
|
+
// NodeLink doesn't expose `qbisrc` as a prefix string
|
|
3177
|
+
qbrec: "qbsearch",
|
|
3178
|
+
// NodeLink doesn't expose `qbrec` as a prefix string
|
|
3179
|
+
// pandora
|
|
3180
|
+
pandora: "pdsearch",
|
|
3181
|
+
pd: "pdsearch",
|
|
3182
|
+
pdsearch: "pdsearch",
|
|
3183
|
+
"pandora music": "pdsearch",
|
|
3184
|
+
pandoramusic: "pdsearch",
|
|
3185
|
+
// speak PLUGIN
|
|
3186
|
+
speak: "speak",
|
|
3187
|
+
// Map Lavalink's `tts` prefix to NodeLink's `gtts`
|
|
3188
|
+
tts: "gtts",
|
|
3189
|
+
ftts: "ftts",
|
|
3190
|
+
flowery: "flowery",
|
|
3191
|
+
"flowery.tts": "flowery",
|
|
3192
|
+
flowerytts: "flowery",
|
|
3193
|
+
// Client sided search platforms
|
|
3194
|
+
bandcamp: "bcsearch",
|
|
3195
|
+
bc: "bcsearch",
|
|
3196
|
+
bcsearch: "bcsearch",
|
|
3197
|
+
// other searches (not supported explicitly in NodeLink prefixes)
|
|
3198
|
+
phsearch: "search",
|
|
3199
|
+
pornhub: "search",
|
|
3200
|
+
porn: "search",
|
|
3201
|
+
// local files
|
|
3202
|
+
local: "local",
|
|
3203
|
+
// http requests
|
|
3204
|
+
http: "http",
|
|
3205
|
+
https: "https",
|
|
3206
|
+
link: "link",
|
|
3207
|
+
uri: "uri",
|
|
3208
|
+
// tidal
|
|
3209
|
+
tidal: "tdsearch",
|
|
3210
|
+
td: "tdsearch",
|
|
3211
|
+
"tidal music": "tdsearch",
|
|
3212
|
+
tdsearch: "tdsearch",
|
|
3213
|
+
tdrec: "tdrec",
|
|
3214
|
+
// jiosaavn
|
|
3215
|
+
jiosaavn: "jssearch",
|
|
3216
|
+
js: "jssearch",
|
|
3217
|
+
jssearch: "jssearch",
|
|
3218
|
+
jsrec: "jsrec",
|
|
3219
|
+
amzsearch: "amsearch",
|
|
3220
|
+
// amazon music (falls back to Apple Music search on NodeLink)
|
|
3221
|
+
// audiomack
|
|
3222
|
+
admsearch: "admsearch",
|
|
3223
|
+
// gaana
|
|
3224
|
+
gnsearch: "gaanasearch",
|
|
3225
|
+
// shazam
|
|
3226
|
+
szsearch: "szsearch"
|
|
3227
|
+
};
|
|
3098
3228
|
var NodeLinkNode = class extends LavalinkNode {
|
|
3099
3229
|
nodeType = "NodeLink" /* NodeLink */;
|
|
3100
3230
|
constructor(options, manager) {
|
|
@@ -6297,6 +6427,7 @@ var LavalinkManager = class _LavalinkManager extends EventEmitter2 {
|
|
|
6297
6427
|
queueChangesWatcher: options?.queueOptions?.queueChangesWatcher ?? null,
|
|
6298
6428
|
queueStore: options?.queueOptions?.queueStore ?? new DefaultQueueStore()
|
|
6299
6429
|
},
|
|
6430
|
+
httpHeaders: options?.httpHeaders ?? {},
|
|
6300
6431
|
advancedOptions: {
|
|
6301
6432
|
enableDebugEvents: options?.advancedOptions?.enableDebugEvents ?? false,
|
|
6302
6433
|
maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 6e5,
|
|
@@ -6350,6 +6481,19 @@ var LavalinkManager = class _LavalinkManager extends EventEmitter2 {
|
|
|
6350
6481
|
}
|
|
6351
6482
|
if (typeof options?.queueOptions?.maxPreviousTracks !== "number" || options?.queueOptions?.maxPreviousTracks < 0)
|
|
6352
6483
|
options.queueOptions.maxPreviousTracks = 25;
|
|
6484
|
+
if (options?.httpHeaders) {
|
|
6485
|
+
if (typeof options.httpHeaders !== "object" || Array.isArray(options.httpHeaders))
|
|
6486
|
+
throw new SyntaxError("ManagerOption.httpHeaders must be an object with string keys and string values");
|
|
6487
|
+
const forbiddenHeaders = ["authorization", "user-id", "client-name", "session-id"];
|
|
6488
|
+
for (const header in options.httpHeaders) {
|
|
6489
|
+
if (forbiddenHeaders.includes(header.toLowerCase()))
|
|
6490
|
+
throw new SyntaxError(
|
|
6491
|
+
`ManagerOption.httpHeaders cannot have the following headers: ${forbiddenHeaders.join(", ")}`
|
|
6492
|
+
);
|
|
6493
|
+
if (typeof options.httpHeaders[header] !== "string")
|
|
6494
|
+
throw new SyntaxError(`ManagerOption.httpHeaders values must be of type string :: ${header}`);
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6353
6497
|
}
|
|
6354
6498
|
/**
|
|
6355
6499
|
* Emits a debug event to the LavalinkManager
|
|
@@ -6833,6 +6977,7 @@ export {
|
|
|
6833
6977
|
LavalinkPlugins,
|
|
6834
6978
|
ManagerUtils,
|
|
6835
6979
|
MiniMap,
|
|
6980
|
+
NodeLinkDefaultSources,
|
|
6836
6981
|
NodeLinkExclusiveEvents,
|
|
6837
6982
|
NodeLinkNode,
|
|
6838
6983
|
NodeManager,
|
package/dist/index.mjs
CHANGED
|
@@ -421,8 +421,6 @@ var DefaultSources = {
|
|
|
421
421
|
pandora: "pdsearch",
|
|
422
422
|
pd: "pdsearch",
|
|
423
423
|
pdsearch: "pdsearch",
|
|
424
|
-
pdisrc: "pdisrc",
|
|
425
|
-
pdrec: "pdrec",
|
|
426
424
|
"pandora music": "pdsearch",
|
|
427
425
|
pandoramusic: "pdsearch",
|
|
428
426
|
// speak PLUGIN
|
|
@@ -457,7 +455,15 @@ var DefaultSources = {
|
|
|
457
455
|
jiosaavn: "jssearch",
|
|
458
456
|
js: "jssearch",
|
|
459
457
|
jssearch: "jssearch",
|
|
460
|
-
jsrec: "jsrec"
|
|
458
|
+
jsrec: "jsrec",
|
|
459
|
+
// amazon music
|
|
460
|
+
amzsearch: "amzsearch",
|
|
461
|
+
// audiomack
|
|
462
|
+
admsearch: "admsearch",
|
|
463
|
+
// gaana
|
|
464
|
+
gnsearch: "gnsearch",
|
|
465
|
+
// shazam
|
|
466
|
+
szsearch: "szsearch"
|
|
461
467
|
};
|
|
462
468
|
var LavalinkPlugins = {
|
|
463
469
|
DuncteBot_Plugin: "DuncteBot-plugin",
|
|
@@ -466,7 +472,8 @@ var LavalinkPlugins = {
|
|
|
466
472
|
LavaSearch: "lavasearch-plugin",
|
|
467
473
|
Jiosaavn_Plugin: "jiosaavn-plugin",
|
|
468
474
|
LavalinkFilterPlugin: "lavalink-filter-plugin",
|
|
469
|
-
JavaTimedLyricsPlugin: "java-lyrics-plugin"
|
|
475
|
+
JavaTimedLyricsPlugin: "java-lyrics-plugin",
|
|
476
|
+
PulseLinkPlugin: "pulselink-plugin"
|
|
470
477
|
};
|
|
471
478
|
var SourceLinksRegexes = {
|
|
472
479
|
/** DEFAULT SUPPORTED BY LAVALINK */
|
|
@@ -542,6 +549,8 @@ function parseLavalinkConnUrl(connectionUrl) {
|
|
|
542
549
|
}
|
|
543
550
|
var ManagerUtils = class {
|
|
544
551
|
LavalinkManager = void 0;
|
|
552
|
+
/** Override this with your custom sources record if you want to use custom sources for your node */
|
|
553
|
+
SourcesRecord = DefaultSources;
|
|
545
554
|
constructor(LavalinkManager2) {
|
|
546
555
|
this.LavalinkManager = LavalinkManager2;
|
|
547
556
|
}
|
|
@@ -869,13 +878,13 @@ var ManagerUtils = class {
|
|
|
869
878
|
return;
|
|
870
879
|
}
|
|
871
880
|
/**
|
|
872
|
-
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the
|
|
881
|
+
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the Default Sources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
|
|
873
882
|
* @param queryString
|
|
874
883
|
* @returns
|
|
875
884
|
*/
|
|
876
885
|
findSourceOfQuery(queryString) {
|
|
877
|
-
const foundSource = Object.keys(
|
|
878
|
-
if (foundSource && !["https", "http"].includes(foundSource) &&
|
|
886
|
+
const foundSource = Object.keys(this.SourcesRecord).find((source) => queryString?.toLowerCase?.()?.startsWith(`${source}:`.toLowerCase()))?.trim?.()?.toLowerCase?.();
|
|
887
|
+
if (foundSource && !["https", "http"].includes(foundSource) && this.SourcesRecord[foundSource]) {
|
|
879
888
|
return foundSource;
|
|
880
889
|
}
|
|
881
890
|
return null;
|
|
@@ -888,7 +897,7 @@ var ManagerUtils = class {
|
|
|
888
897
|
extractSourceOfQuery(searchQuery) {
|
|
889
898
|
const foundSource = this.findSourceOfQuery(searchQuery.query);
|
|
890
899
|
if (foundSource) {
|
|
891
|
-
searchQuery.source =
|
|
900
|
+
searchQuery.source = this.SourcesRecord[foundSource];
|
|
892
901
|
searchQuery.query = searchQuery.query.slice(`${foundSource}:`.length, searchQuery.query.length);
|
|
893
902
|
}
|
|
894
903
|
return searchQuery;
|
|
@@ -919,7 +928,7 @@ var ManagerUtils = class {
|
|
|
919
928
|
return this.extractSourceOfQuery(Query);
|
|
920
929
|
}
|
|
921
930
|
const providedSource = query?.source?.trim?.()?.toLowerCase?.();
|
|
922
|
-
const validSourceExtracted =
|
|
931
|
+
const validSourceExtracted = this.SourcesRecord[providedSource ?? typedDefault];
|
|
923
932
|
return this.extractSourceOfQuery({
|
|
924
933
|
query: query.query,
|
|
925
934
|
extraQueryUrlParams: query.extraQueryUrlParams,
|
|
@@ -943,7 +952,7 @@ var ManagerUtils = class {
|
|
|
943
952
|
return this.extractSourceOfQuery(Query2);
|
|
944
953
|
}
|
|
945
954
|
const providedSource = query?.source?.trim?.()?.toLowerCase?.();
|
|
946
|
-
const validSourceExtracted =
|
|
955
|
+
const validSourceExtracted = this.SourcesRecord[providedSource ?? typedDefault];
|
|
947
956
|
const Query = {
|
|
948
957
|
query: query.query,
|
|
949
958
|
types: query.types ? ["track", "playlist", "artist", "album", "text"].filter(
|
|
@@ -967,7 +976,7 @@ var ManagerUtils = class {
|
|
|
967
976
|
*/
|
|
968
977
|
validateSourceString(node, sourceString) {
|
|
969
978
|
if (!sourceString) throw new Error(`No SourceString was provided`);
|
|
970
|
-
const source =
|
|
979
|
+
const source = this.SourcesRecord[sourceString.toLowerCase().trim()];
|
|
971
980
|
if (!source && !!this.LavalinkManager.options.playerOptions.allowCustomSources)
|
|
972
981
|
throw new Error(
|
|
973
982
|
`Lavalink-Client does not support SearchQuerySource: '${sourceString}'. You can disable this check by setting 'ManagerOptions.PlayerOptions.allowCustomSources' to true`
|
|
@@ -1045,6 +1054,18 @@ var ManagerUtils = class {
|
|
|
1045
1054
|
if (["pdsearch", "pdisrc", "pdrec"].includes(source) && !node.info?.sourceManagers?.includes("pandora")) {
|
|
1046
1055
|
throw new Error("Lavalink Node has not 'pandora' enabled, which is required to have '" + source + "' work");
|
|
1047
1056
|
}
|
|
1057
|
+
if (source === "amzsearch" && !node.info?.sourceManagers?.includes("amazonmusic")) {
|
|
1058
|
+
throw new Error("Lavalink Node has not 'amazonmusic' enabled, which is required to have 'amzsearch' work");
|
|
1059
|
+
}
|
|
1060
|
+
if (source === "admsearch" && !node.info?.sourceManagers?.includes("audiomack")) {
|
|
1061
|
+
throw new Error("Lavalink Node has not 'audiomack' enabled, which is required to have 'admsearch' work");
|
|
1062
|
+
}
|
|
1063
|
+
if (source === "gnsearch" && !node.info?.sourceManagers?.includes("gaana")) {
|
|
1064
|
+
throw new Error("Lavalink Node has not 'gaana' enabled, which is required to have 'gnsearch' work");
|
|
1065
|
+
}
|
|
1066
|
+
if (source === "szsearch" && !node.info?.sourceManagers?.includes("shazam")) {
|
|
1067
|
+
throw new Error("Lavalink Node has not 'shazam' enabled, which is required to have 'szsearch' work");
|
|
1068
|
+
}
|
|
1048
1069
|
return;
|
|
1049
1070
|
}
|
|
1050
1071
|
};
|
|
@@ -1367,8 +1388,10 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1367
1388
|
path: `/${this.version}/${endpoint.startsWith("/") ? endpoint.slice(1) : endpoint}`,
|
|
1368
1389
|
method: "GET",
|
|
1369
1390
|
headers: {
|
|
1370
|
-
Authorization: this.options.authorization
|
|
1391
|
+
Authorization: this.options.authorization,
|
|
1392
|
+
...this.NodeManager.LavalinkManager?.options?.httpHeaders
|
|
1371
1393
|
},
|
|
1394
|
+
// if httpHeaders is undefined/null, it won't be added, so we can keept it short like this
|
|
1372
1395
|
signal: this.options.requestSignalTimeoutMS && this.options.requestSignalTimeoutMS > 0 ? AbortSignal.timeout(this.options.requestSignalTimeoutMS) : void 0
|
|
1373
1396
|
};
|
|
1374
1397
|
modify?.(options);
|
|
@@ -1603,7 +1626,8 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1603
1626
|
"Client-Name": String(this._LManager.options.client.username || "Lavalink-Client").replace(
|
|
1604
1627
|
/[^\x20-\x7E]/g,
|
|
1605
1628
|
""
|
|
1606
|
-
)
|
|
1629
|
+
),
|
|
1630
|
+
...this.NodeManager.LavalinkManager.options?.httpHeaders
|
|
1607
1631
|
};
|
|
1608
1632
|
if (typeof this.options.sessionId === "string" || typeof sessionId === "string") {
|
|
1609
1633
|
headers["Session-Id"] = this.options.sessionId || sessionId;
|
|
@@ -3088,13 +3112,119 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
3088
3112
|
if (this.info?.sourceManagers.includes("vkmusic")) source.add("vksearch").add("vkrec");
|
|
3089
3113
|
if (this.info?.sourceManagers.includes("tidal")) source.add("tdsearch").add("tdrec");
|
|
3090
3114
|
if (this.info?.sourceManagers.includes("qobuz")) source.add("qbsearch").add("qbisrc").add("qbrec");
|
|
3091
|
-
if (this.info?.sourceManagers.includes("pandora")) source.add("pdsearch").add("pdisrc").add("pdrec");
|
|
3092
3115
|
if (this.info?.sourceManagers.includes("youtube")) source.add("ytsearch").add("ytmsearch");
|
|
3093
3116
|
return typeof src === "string" && source.has(src);
|
|
3094
3117
|
}
|
|
3095
3118
|
};
|
|
3096
3119
|
|
|
3097
3120
|
// src/structures/NodeLink.ts
|
|
3121
|
+
var NodeLinkDefaultSources = {
|
|
3122
|
+
// youtubemusic
|
|
3123
|
+
"youtube music": "ytmsearch",
|
|
3124
|
+
youtubemusic: "ytmsearch",
|
|
3125
|
+
ytmsearch: "ytmsearch",
|
|
3126
|
+
ytm: "ytmsearch",
|
|
3127
|
+
musicyoutube: "ytmsearch",
|
|
3128
|
+
"music youtube": "ytmsearch",
|
|
3129
|
+
// youtube
|
|
3130
|
+
youtube: "ytsearch",
|
|
3131
|
+
yt: "ytsearch",
|
|
3132
|
+
ytsearch: "ytsearch",
|
|
3133
|
+
// soundcloud
|
|
3134
|
+
soundcloud: "scsearch",
|
|
3135
|
+
scsearch: "scsearch",
|
|
3136
|
+
sc: "scsearch",
|
|
3137
|
+
// apple music
|
|
3138
|
+
"apple music": "amsearch",
|
|
3139
|
+
apple: "amsearch",
|
|
3140
|
+
applemusic: "amsearch",
|
|
3141
|
+
amsearch: "amsearch",
|
|
3142
|
+
am: "amsearch",
|
|
3143
|
+
musicapple: "amsearch",
|
|
3144
|
+
"music apple": "amsearch",
|
|
3145
|
+
// spotify
|
|
3146
|
+
spotify: "spsearch",
|
|
3147
|
+
spsearch: "spsearch",
|
|
3148
|
+
sp: "spsearch",
|
|
3149
|
+
"spotify.com": "spsearch",
|
|
3150
|
+
spotifycom: "spsearch",
|
|
3151
|
+
sprec: "sprec",
|
|
3152
|
+
spsuggestion: "sprec",
|
|
3153
|
+
// deezer
|
|
3154
|
+
deezer: "dzsearch",
|
|
3155
|
+
dz: "dzsearch",
|
|
3156
|
+
dzsearch: "dzsearch",
|
|
3157
|
+
dzisrc: "dzsearch",
|
|
3158
|
+
// NodeLink doesn't expose `dzisrc` as a prefix string
|
|
3159
|
+
dzrec: "dzrec",
|
|
3160
|
+
// yandexmusic
|
|
3161
|
+
"yandex music": "ymsearch",
|
|
3162
|
+
yandexmusic: "ymsearch",
|
|
3163
|
+
yandex: "ymsearch",
|
|
3164
|
+
ymsearch: "ymsearch",
|
|
3165
|
+
ymrec: "ymsearch",
|
|
3166
|
+
// VK Music
|
|
3167
|
+
vksearch: "vksearch",
|
|
3168
|
+
vkmusic: "vksearch",
|
|
3169
|
+
"vk music": "vksearch",
|
|
3170
|
+
vkrec: "vkrec",
|
|
3171
|
+
vk: "vksearch",
|
|
3172
|
+
// Qobuz
|
|
3173
|
+
qbsearch: "qbsearch",
|
|
3174
|
+
qobuz: "qbsearch",
|
|
3175
|
+
qbisrc: "qbsearch",
|
|
3176
|
+
// NodeLink doesn't expose `qbisrc` as a prefix string
|
|
3177
|
+
qbrec: "qbsearch",
|
|
3178
|
+
// NodeLink doesn't expose `qbrec` as a prefix string
|
|
3179
|
+
// pandora
|
|
3180
|
+
pandora: "pdsearch",
|
|
3181
|
+
pd: "pdsearch",
|
|
3182
|
+
pdsearch: "pdsearch",
|
|
3183
|
+
"pandora music": "pdsearch",
|
|
3184
|
+
pandoramusic: "pdsearch",
|
|
3185
|
+
// speak PLUGIN
|
|
3186
|
+
speak: "speak",
|
|
3187
|
+
// Map Lavalink's `tts` prefix to NodeLink's `gtts`
|
|
3188
|
+
tts: "gtts",
|
|
3189
|
+
ftts: "ftts",
|
|
3190
|
+
flowery: "flowery",
|
|
3191
|
+
"flowery.tts": "flowery",
|
|
3192
|
+
flowerytts: "flowery",
|
|
3193
|
+
// Client sided search platforms
|
|
3194
|
+
bandcamp: "bcsearch",
|
|
3195
|
+
bc: "bcsearch",
|
|
3196
|
+
bcsearch: "bcsearch",
|
|
3197
|
+
// other searches (not supported explicitly in NodeLink prefixes)
|
|
3198
|
+
phsearch: "search",
|
|
3199
|
+
pornhub: "search",
|
|
3200
|
+
porn: "search",
|
|
3201
|
+
// local files
|
|
3202
|
+
local: "local",
|
|
3203
|
+
// http requests
|
|
3204
|
+
http: "http",
|
|
3205
|
+
https: "https",
|
|
3206
|
+
link: "link",
|
|
3207
|
+
uri: "uri",
|
|
3208
|
+
// tidal
|
|
3209
|
+
tidal: "tdsearch",
|
|
3210
|
+
td: "tdsearch",
|
|
3211
|
+
"tidal music": "tdsearch",
|
|
3212
|
+
tdsearch: "tdsearch",
|
|
3213
|
+
tdrec: "tdrec",
|
|
3214
|
+
// jiosaavn
|
|
3215
|
+
jiosaavn: "jssearch",
|
|
3216
|
+
js: "jssearch",
|
|
3217
|
+
jssearch: "jssearch",
|
|
3218
|
+
jsrec: "jsrec",
|
|
3219
|
+
amzsearch: "amsearch",
|
|
3220
|
+
// amazon music (falls back to Apple Music search on NodeLink)
|
|
3221
|
+
// audiomack
|
|
3222
|
+
admsearch: "admsearch",
|
|
3223
|
+
// gaana
|
|
3224
|
+
gnsearch: "gaanasearch",
|
|
3225
|
+
// shazam
|
|
3226
|
+
szsearch: "szsearch"
|
|
3227
|
+
};
|
|
3098
3228
|
var NodeLinkNode = class extends LavalinkNode {
|
|
3099
3229
|
nodeType = "NodeLink" /* NodeLink */;
|
|
3100
3230
|
constructor(options, manager) {
|
|
@@ -6297,6 +6427,7 @@ var LavalinkManager = class _LavalinkManager extends EventEmitter2 {
|
|
|
6297
6427
|
queueChangesWatcher: options?.queueOptions?.queueChangesWatcher ?? null,
|
|
6298
6428
|
queueStore: options?.queueOptions?.queueStore ?? new DefaultQueueStore()
|
|
6299
6429
|
},
|
|
6430
|
+
httpHeaders: options?.httpHeaders ?? {},
|
|
6300
6431
|
advancedOptions: {
|
|
6301
6432
|
enableDebugEvents: options?.advancedOptions?.enableDebugEvents ?? false,
|
|
6302
6433
|
maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 6e5,
|
|
@@ -6350,6 +6481,19 @@ var LavalinkManager = class _LavalinkManager extends EventEmitter2 {
|
|
|
6350
6481
|
}
|
|
6351
6482
|
if (typeof options?.queueOptions?.maxPreviousTracks !== "number" || options?.queueOptions?.maxPreviousTracks < 0)
|
|
6352
6483
|
options.queueOptions.maxPreviousTracks = 25;
|
|
6484
|
+
if (options?.httpHeaders) {
|
|
6485
|
+
if (typeof options.httpHeaders !== "object" || Array.isArray(options.httpHeaders))
|
|
6486
|
+
throw new SyntaxError("ManagerOption.httpHeaders must be an object with string keys and string values");
|
|
6487
|
+
const forbiddenHeaders = ["authorization", "user-id", "client-name", "session-id"];
|
|
6488
|
+
for (const header in options.httpHeaders) {
|
|
6489
|
+
if (forbiddenHeaders.includes(header.toLowerCase()))
|
|
6490
|
+
throw new SyntaxError(
|
|
6491
|
+
`ManagerOption.httpHeaders cannot have the following headers: ${forbiddenHeaders.join(", ")}`
|
|
6492
|
+
);
|
|
6493
|
+
if (typeof options.httpHeaders[header] !== "string")
|
|
6494
|
+
throw new SyntaxError(`ManagerOption.httpHeaders values must be of type string :: ${header}`);
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6353
6497
|
}
|
|
6354
6498
|
/**
|
|
6355
6499
|
* Emits a debug event to the LavalinkManager
|
|
@@ -6833,6 +6977,7 @@ export {
|
|
|
6833
6977
|
LavalinkPlugins,
|
|
6834
6978
|
ManagerUtils,
|
|
6835
6979
|
MiniMap,
|
|
6980
|
+
NodeLinkDefaultSources,
|
|
6836
6981
|
NodeLinkExclusiveEvents,
|
|
6837
6982
|
NodeLinkNode,
|
|
6838
6983
|
NodeManager,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lavalink-client",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients. - Supports NodeLink@v3 too.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"advanced",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"tslib": "^2.8.1",
|
|
62
|
-
"ws": "^8.
|
|
62
|
+
"ws": "^8.20.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/bun": "latest",
|
|
66
|
-
"@types/node": "^24.
|
|
66
|
+
"@types/node": "^24.12.3",
|
|
67
67
|
"@types/ws": "^8.18.1",
|
|
68
68
|
"oxfmt": "^0.28.0",
|
|
69
|
-
"oxlint": "^1.
|
|
69
|
+
"oxlint": "^1.63.0",
|
|
70
70
|
"tsup": "^8.5.1",
|
|
71
71
|
"typescript": "^5.9.3"
|
|
72
72
|
},
|