lavalink-client 2.10.0 → 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 +44 -0
- package/dist/index.cjs +189 -20
- package/dist/index.d.cts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +188 -20
- package/dist/index.mjs +188 -20
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -181,6 +181,8 @@ const node = client.lavalink.lavalinkManager.getNode("id") as NodeLinkNode;
|
|
|
181
181
|
node.addMixerLayer()
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
⚠️ NODELINK does not really require you to run "instaUpdateFiltersFix" on player creation.
|
|
185
|
+
|
|
184
186
|
### NodeLink Specific Methods
|
|
185
187
|
|
|
186
188
|
- **`node.getYoutubeOAUTH(refreshToken)`**: Exchange a Refresh Token for an Access Token. [Docs](https://nodelink.js.org/docs/api/nodelink-features#oauth)
|
|
@@ -198,6 +200,48 @@ node.addMixerLayer()
|
|
|
198
200
|
- **`node.getConnectionMetrics()`**: Get connection metrics. [Docs](https://nodelink.js.org/docs/api/rest#node-information)
|
|
199
201
|
- **`node.loadDirectStream(track, volume, position, filters)`**: Stream raw PCM audio. [Docs](https://nodelink.js.org/docs/api/nodelink-features#loadstream)
|
|
200
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
|
+
|
|
201
245
|
### NodeLink Specififc Events?
|
|
202
246
|
|
|
203
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);
|
|
@@ -1546,10 +1570,8 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1546
1570
|
if (Query.source) this._LManager.utils.validateSourceString(this, Query.source);
|
|
1547
1571
|
if (/^https?:\/\//.test(Query.query))
|
|
1548
1572
|
return this.search({ query: Query.query, source: Query.source }, requestUser);
|
|
1549
|
-
if (!
|
|
1550
|
-
throw new SyntaxError(
|
|
1551
|
-
`Query.source must be a source from LavaSrc: "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "ytmsearch" | "ytsearch"`
|
|
1552
|
-
);
|
|
1573
|
+
if (!this.isLavaSrcSource(Query.source))
|
|
1574
|
+
throw new SyntaxError(`Query.source must be an available source from LavaSrc`);
|
|
1553
1575
|
if (this._checkForPlugins && !this.info?.plugins?.find?.((v) => v.name === "lavasearch-plugin"))
|
|
1554
1576
|
throw new RangeError(`there is no lavasearch-plugin available in the lavalink node: ${this.id}`);
|
|
1555
1577
|
if (this._checkForPlugins && !this.info?.plugins?.find?.((v) => v.name === "lavasrc-plugin"))
|
|
@@ -1670,7 +1692,8 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1670
1692
|
"Client-Name": String(this._LManager.options.client.username || "Lavalink-Client").replace(
|
|
1671
1693
|
/[^\x20-\x7E]/g,
|
|
1672
1694
|
""
|
|
1673
|
-
)
|
|
1695
|
+
),
|
|
1696
|
+
...this.NodeManager.LavalinkManager.options?.httpHeaders
|
|
1674
1697
|
};
|
|
1675
1698
|
if (typeof this.options.sessionId === "string" || typeof sessionId === "string") {
|
|
1676
1699
|
headers["Session-Id"] = this.options.sessionId || sessionId;
|
|
@@ -1975,7 +1998,10 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
1975
1998
|
throw new RangeError(
|
|
1976
1999
|
`there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${this.id}`
|
|
1977
2000
|
);
|
|
1978
|
-
|
|
2001
|
+
let url = `/lyrics?track=${track.encoded}&skipTrackSource=${skipTrackSource}`;
|
|
2002
|
+
if (this.nodeType === "NodeLink" /* NodeLink */) {
|
|
2003
|
+
url = `/loadlyrics?encodedTrack=${track.encoded}`;
|
|
2004
|
+
}
|
|
1979
2005
|
return await this.request(url);
|
|
1980
2006
|
},
|
|
1981
2007
|
/**
|
|
@@ -2001,7 +2027,10 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
2001
2027
|
throw new RangeError(
|
|
2002
2028
|
`there is no lyrics source (via lavasrc-plugin / java-lyrics-plugin) available in the lavalink node (required for lyrics): ${this.id}`
|
|
2003
2029
|
);
|
|
2004
|
-
|
|
2030
|
+
let url = `/sessions/${this.sessionId}/players/${guildId}/track/lyrics?skipTrackSource=${skipTrackSource}`;
|
|
2031
|
+
if (this.nodeType === "NodeLink" /* NodeLink */) {
|
|
2032
|
+
url = `/loadlyrics?encodedTrack=${this._LManager.getPlayer(guildId)?.queue.current?.encoded}`;
|
|
2033
|
+
}
|
|
2005
2034
|
return await this.request(url);
|
|
2006
2035
|
},
|
|
2007
2036
|
/**
|
|
@@ -3134,9 +3163,134 @@ var LavalinkNode = class _LavalinkNode {
|
|
|
3134
3163
|
this._LManager.emit("LyricsNotFound", player, track, payload);
|
|
3135
3164
|
return;
|
|
3136
3165
|
}
|
|
3166
|
+
/**
|
|
3167
|
+
* @private
|
|
3168
|
+
* util function to check if a provided source is valid with current node.
|
|
3169
|
+
* @param {LavalinkSearchPlatform} src
|
|
3170
|
+
* @returns {boolean} True if provided source is valid.
|
|
3171
|
+
*/
|
|
3172
|
+
isLavaSrcSource(src) {
|
|
3173
|
+
const source = /* @__PURE__ */ new Set([]);
|
|
3174
|
+
if (this.info?.sourceManagers.includes("spotify")) source.add("spsearch").add("sprec");
|
|
3175
|
+
if (this.info?.sourceManagers.includes("applemusic")) source.add("amsearch");
|
|
3176
|
+
if (this.info?.sourceManagers.includes("deezer")) source.add("dzsearch").add("dzrec").add("dzisrc");
|
|
3177
|
+
if (this.info?.sourceManagers.includes("yandexmusic")) source.add("ymsearch").add("ymrec");
|
|
3178
|
+
if (this.info?.sourceManagers.includes("vkmusic")) source.add("vksearch").add("vkrec");
|
|
3179
|
+
if (this.info?.sourceManagers.includes("tidal")) source.add("tdsearch").add("tdrec");
|
|
3180
|
+
if (this.info?.sourceManagers.includes("qobuz")) source.add("qbsearch").add("qbisrc").add("qbrec");
|
|
3181
|
+
if (this.info?.sourceManagers.includes("youtube")) source.add("ytsearch").add("ytmsearch");
|
|
3182
|
+
return typeof src === "string" && source.has(src);
|
|
3183
|
+
}
|
|
3137
3184
|
};
|
|
3138
3185
|
|
|
3139
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
|
+
};
|
|
3140
3294
|
var NodeLinkNode = class extends LavalinkNode {
|
|
3141
3295
|
nodeType = "NodeLink" /* NodeLink */;
|
|
3142
3296
|
constructor(options, manager) {
|
|
@@ -6092,7 +6246,7 @@ var Player = class {
|
|
|
6092
6246
|
);
|
|
6093
6247
|
if (this.queue.current || this.queue.tracks.length) {
|
|
6094
6248
|
const trackSources = new Set(
|
|
6095
|
-
[this.queue.current, ...this.queue.tracks].map((track) => track
|
|
6249
|
+
[this.queue.current, ...this.queue.tracks].map((track) => track?.info?.sourceName).filter(Boolean)
|
|
6096
6250
|
);
|
|
6097
6251
|
const missingSources = [...trackSources].filter(
|
|
6098
6252
|
(source) => !updateNode.info?.sourceManagers.includes(source)
|
|
@@ -6339,6 +6493,7 @@ var LavalinkManager = class _LavalinkManager extends import_node_events2.EventEm
|
|
|
6339
6493
|
queueChangesWatcher: options?.queueOptions?.queueChangesWatcher ?? null,
|
|
6340
6494
|
queueStore: options?.queueOptions?.queueStore ?? new DefaultQueueStore()
|
|
6341
6495
|
},
|
|
6496
|
+
httpHeaders: options?.httpHeaders ?? {},
|
|
6342
6497
|
advancedOptions: {
|
|
6343
6498
|
enableDebugEvents: options?.advancedOptions?.enableDebugEvents ?? false,
|
|
6344
6499
|
maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 6e5,
|
|
@@ -6392,6 +6547,19 @@ var LavalinkManager = class _LavalinkManager extends import_node_events2.EventEm
|
|
|
6392
6547
|
}
|
|
6393
6548
|
if (typeof options?.queueOptions?.maxPreviousTracks !== "number" || options?.queueOptions?.maxPreviousTracks < 0)
|
|
6394
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
|
+
}
|
|
6395
6563
|
}
|
|
6396
6564
|
/**
|
|
6397
6565
|
* Emits a debug event to the LavalinkManager
|
|
@@ -6876,6 +7044,7 @@ var LavalinkManager = class _LavalinkManager extends import_node_events2.EventEm
|
|
|
6876
7044
|
LavalinkPlugins,
|
|
6877
7045
|
ManagerUtils,
|
|
6878
7046
|
MiniMap,
|
|
7047
|
+
NodeLinkDefaultSources,
|
|
6879
7048
|
NodeLinkExclusiveEvents,
|
|
6880
7049
|
NodeLinkNode,
|
|
6881
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);
|
|
@@ -3680,6 +3688,13 @@ declare class LavalinkNode {
|
|
|
3680
3688
|
* @param {LyricsNotFoundEvent} payload The payload of the event
|
|
3681
3689
|
*/
|
|
3682
3690
|
private LyricsNotFound;
|
|
3691
|
+
/**
|
|
3692
|
+
* @private
|
|
3693
|
+
* util function to check if a provided source is valid with current node.
|
|
3694
|
+
* @param {LavalinkSearchPlatform} src
|
|
3695
|
+
* @returns {boolean} True if provided source is valid.
|
|
3696
|
+
*/
|
|
3697
|
+
private isLavaSrcSource;
|
|
3683
3698
|
}
|
|
3684
3699
|
|
|
3685
3700
|
declare class NodeManager extends EventEmitter {
|
|
@@ -4066,6 +4081,8 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
|
|
|
4066
4081
|
linksBlacklist?: (RegExp | string)[];
|
|
4067
4082
|
/** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
|
|
4068
4083
|
linksAllowed?: boolean;
|
|
4084
|
+
/** Custom http headers to be sent with every request to lavalink */
|
|
4085
|
+
httpHeaders?: Record<string, string>;
|
|
4069
4086
|
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
4070
4087
|
advancedOptions?: {
|
|
4071
4088
|
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
@@ -4340,8 +4357,9 @@ declare const LavalinkPlugins: {
|
|
|
4340
4357
|
Jiosaavn_Plugin: string;
|
|
4341
4358
|
LavalinkFilterPlugin: string;
|
|
4342
4359
|
JavaTimedLyricsPlugin: string;
|
|
4360
|
+
PulseLinkPlugin: string;
|
|
4343
4361
|
};
|
|
4344
4362
|
/** Lavalink Sources regexes for url validations */
|
|
4345
4363
|
declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
|
|
4346
4364
|
|
|
4347
|
-
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);
|
|
@@ -3680,6 +3688,13 @@ declare class LavalinkNode {
|
|
|
3680
3688
|
* @param {LyricsNotFoundEvent} payload The payload of the event
|
|
3681
3689
|
*/
|
|
3682
3690
|
private LyricsNotFound;
|
|
3691
|
+
/**
|
|
3692
|
+
* @private
|
|
3693
|
+
* util function to check if a provided source is valid with current node.
|
|
3694
|
+
* @param {LavalinkSearchPlatform} src
|
|
3695
|
+
* @returns {boolean} True if provided source is valid.
|
|
3696
|
+
*/
|
|
3697
|
+
private isLavaSrcSource;
|
|
3683
3698
|
}
|
|
3684
3699
|
|
|
3685
3700
|
declare class NodeManager extends EventEmitter {
|
|
@@ -4066,6 +4081,8 @@ interface ManagerOptions<CustomPlayerT extends Player = Player> {
|
|
|
4066
4081
|
linksBlacklist?: (RegExp | string)[];
|
|
4067
4082
|
/** If links should be allowed or not. If set to false, it will throw an error if a link was provided. */
|
|
4068
4083
|
linksAllowed?: boolean;
|
|
4084
|
+
/** Custom http headers to be sent with every request to lavalink */
|
|
4085
|
+
httpHeaders?: Record<string, string>;
|
|
4069
4086
|
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
4070
4087
|
advancedOptions?: {
|
|
4071
4088
|
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
@@ -4340,8 +4357,9 @@ declare const LavalinkPlugins: {
|
|
|
4340
4357
|
Jiosaavn_Plugin: string;
|
|
4341
4358
|
LavalinkFilterPlugin: string;
|
|
4342
4359
|
JavaTimedLyricsPlugin: string;
|
|
4360
|
+
PulseLinkPlugin: string;
|
|
4343
4361
|
};
|
|
4344
4362
|
/** Lavalink Sources regexes for url validations */
|
|
4345
4363
|
declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
|
|
4346
4364
|
|
|
4347
|
-
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 };
|