lavalink-client 2.1.7 → 2.2.1
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 +87 -1
- package/dist/cjs/structures/CustomSearches/BandCampSearch.js +3 -2
- package/dist/cjs/structures/Filters.d.ts +1 -1
- package/dist/cjs/structures/Filters.js +5 -5
- package/dist/cjs/structures/LavalinkManager.d.ts +23 -5
- package/dist/cjs/structures/LavalinkManager.js +15 -1
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +3 -0
- package/dist/cjs/structures/LavalinkManagerStatics.js +8 -1
- package/dist/cjs/structures/Node.d.ts +317 -35
- package/dist/cjs/structures/Node.js +330 -85
- package/dist/cjs/structures/NodeManager.d.ts +1 -1
- package/dist/cjs/structures/Player.d.ts +44 -8
- package/dist/cjs/structures/Player.js +35 -27
- package/dist/cjs/structures/Queue.js +1 -1
- package/dist/cjs/structures/Utils.d.ts +5 -2
- package/dist/cjs/structures/Utils.js +7 -4
- package/dist/esm/structures/CustomSearches/BandCampSearch.js +2 -1
- package/dist/esm/structures/Filters.d.ts +1 -1
- package/dist/esm/structures/Filters.js +5 -5
- package/dist/esm/structures/LavalinkManager.d.ts +23 -5
- package/dist/esm/structures/LavalinkManager.js +15 -1
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +3 -0
- package/dist/esm/structures/LavalinkManagerStatics.js +8 -1
- package/dist/esm/structures/Node.d.ts +317 -35
- package/dist/esm/structures/Node.js +330 -85
- package/dist/esm/structures/NodeManager.d.ts +1 -1
- package/dist/esm/structures/Player.d.ts +44 -8
- package/dist/esm/structures/Player.js +35 -27
- package/dist/esm/structures/Queue.js +1 -1
- package/dist/esm/structures/Utils.d.ts +5 -2
- package/dist/esm/structures/Utils.js +7 -4
- package/dist/types/structures/Filters.d.ts +1 -1
- package/dist/types/structures/LavalinkManager.d.ts +23 -5
- package/dist/types/structures/LavalinkManagerStatics.d.ts +3 -0
- package/dist/types/structures/Node.d.ts +317 -35
- package/dist/types/structures/NodeManager.d.ts +1 -1
- package/dist/types/structures/Player.d.ts +44 -8
- package/dist/types/structures/Utils.d.ts +5 -2
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -59,6 +59,8 @@ yarn add tomato6966/lavalink-client
|
|
|
59
59
|
|
|
60
60
|
Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) | or the [TSDocumentation](https://tomato6966.github.io/lavalink-client/) for **Examples**, and **__detailled__ Docs**, and to figure out **how to get started**. *note: it's not fully done yet (see the docs)*
|
|
61
61
|
|
|
62
|
+
- __**INFO Note**__: Please use the **[TSDocumentation (auto generated, folder `/tsDocs`)](https://tomato6966.github.io/lavalink-client/)** to get the entire information of lavalink-client, *I don't have time to update the [custom written gitbook-documentation](https://lc4.gitbook.io/lavalink-client) (folder `/docs`, feel free to update it)*
|
|
63
|
+
|
|
62
64
|
# Used in:
|
|
63
65
|
|
|
64
66
|
- [Betty](https://betty.cx/)
|
|
@@ -185,10 +187,61 @@ client.lavalink = new LavalinkManager({
|
|
|
185
187
|
})
|
|
186
188
|
```
|
|
187
189
|
|
|
190
|
+
## How to do resuming
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
// 1. while the player is playing, make sure to enable it:
|
|
194
|
+
const durationToKeepPlayingInMS = 600_000;
|
|
195
|
+
await player.node.updateSession(true, durationToKeepPlayingInMS);
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
// 2. make sure to have an eventlistener for resuming events somewhere
|
|
200
|
+
client.lavalink.nodeManager.on("resumed", (node, payload, fetchedPlayers) => {
|
|
201
|
+
// create players:
|
|
202
|
+
for(const fetchedPlayer of fetchedPlayers) {
|
|
203
|
+
const player = client.lavalink.createPlayer({
|
|
204
|
+
guildId: fetchedPlayer.guildId,
|
|
205
|
+
});
|
|
206
|
+
player.setVolume(fetchedPlayer.volume);
|
|
207
|
+
// and apply other things (e.g. paused, voice, filters, state, ...) (stuff like vc channel, text channel you need to store somewhere)
|
|
208
|
+
await player.queue.utils.sync(); // only works with a queuestore
|
|
209
|
+
// you can now overwride the player.queue.current track from the fetchedPlayer, or use the one from the queue.uztils.sync function
|
|
210
|
+
// continue with your resuming code...
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
```
|
|
214
|
+
|
|
188
215
|
***
|
|
189
216
|
|
|
217
|
+
|
|
218
|
+
### How to use flowertts with custom options
|
|
219
|
+
|
|
220
|
+
- First enable flowertts within the lava-src plugin
|
|
221
|
+
- Then make sure to pass through the extraQueryUrlParams object
|
|
222
|
+
|
|
223
|
+
```js
|
|
224
|
+
const query = interaction.options.getString("text");
|
|
225
|
+
const voice = interaction.options.getString("voice");
|
|
226
|
+
|
|
227
|
+
const extraParams = new URLSearchParams();
|
|
228
|
+
if(voice) extraParams.append(`voice`, voice);
|
|
229
|
+
|
|
230
|
+
// all params for flowertts can be found here: https://flowery.pw/docs
|
|
231
|
+
const response = await player.search({
|
|
232
|
+
query: `${query}`,
|
|
233
|
+
extraQueryUrlParams: extraParams, // as of my knowledge this is currently only used for flowertts, adjusting the playback url dynamically mid-request
|
|
234
|
+
source: "ftts"
|
|
235
|
+
}, interaction.user);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
***
|
|
240
|
+
|
|
241
|
+
|
|
190
242
|
# UpdateLog
|
|
191
243
|
|
|
244
|
+
|
|
192
245
|
## **Version 1.2.0**
|
|
193
246
|
- Added `player.stopPlaying()`: When executed it **clears the Queue** and **stops playing**, **without destroying the Player**
|
|
194
247
|
- Adjusted `Player.skip()`
|
|
@@ -240,7 +293,7 @@ client.lavalink = new LavalinkManager({
|
|
|
240
293
|
|
|
241
294
|
# Node Resuming got supported
|
|
242
295
|
# First enable it by doing:
|
|
243
|
-
+ await player.node.
|
|
296
|
+
+ await player.node.updateSession(true, 360_000);
|
|
244
297
|
# then when reconnecting to the node add to the node.createeOptions the sessionId: "" of the previous session
|
|
245
298
|
# and after connecting the nodeManager.on("resumed", (node, payload, players) => {}) will be executed, where you can sync the players!
|
|
246
299
|
|
|
@@ -298,3 +351,36 @@ Most features of this update got tested, but if you encounter any bugs feel free
|
|
|
298
351
|
- Enforce link searches for users with following searchPlatform Options: "http" | "https" | "link" | "uri"
|
|
299
352
|
- Additionally strongend the code behind that
|
|
300
353
|
- Added searchPlatform for local tracks (aka files on the lavalink server...): "local"
|
|
354
|
+
|
|
355
|
+
## **Version 2.2.0**
|
|
356
|
+
- Changed console.error to throw error on queue.utils.sync if no data was provided/found
|
|
357
|
+
- Changed undici.fetch to native fetch, but requires nodejs v18+ to support other runtimes, e.g. bun
|
|
358
|
+
- Added sourceNames for `bandcamp` (from native lavalink) if it's supported it will use lavalink'S search, else the client search on player.search({ source: "bandcamp" }) (you can also use bcsearch or bc)
|
|
359
|
+
- Added sourceName for `phsearch` from the dunktebot plugin, released in v.1.7.0
|
|
360
|
+
- Support for youtube still going via the youtube-source plugin (disable youtube for lavalink, and use the plugin instead)
|
|
361
|
+
- Exporting events
|
|
362
|
+
- Added new debugOption: logCustomSearches
|
|
363
|
+
- *(Next version update i will remove the internal interval for position update, to calculations)*
|
|
364
|
+
|
|
365
|
+
## **Version 2.2.1**
|
|
366
|
+
- Player position is now calculated instead of using intervals
|
|
367
|
+
- Instaplayer fix update now requires quite good internet connection on the lavalink server due to removal of intervals for updating player.position (everything above 300mbps should be good)
|
|
368
|
+
- Internal updates for handling query params and url-requests (url-parsing) to fix quite few bugs and make the code more readable, now you don't have to ever provide stuff encoded via encodeURIComponent anymore.
|
|
369
|
+
- Added a bunch of jsdoc information, to make the autogenerated docs more accurate!
|
|
370
|
+
|
|
371
|
+
- Because of the adjustments from the encoding, you now need to pass url params for stuff like flowery tts like this:
|
|
372
|
+
|
|
373
|
+
```js
|
|
374
|
+
const query = interaction.options.getString("text");
|
|
375
|
+
const voice = interaction.options.getString("voice");
|
|
376
|
+
|
|
377
|
+
const extraParams = new URLSearchParams();
|
|
378
|
+
if(voice) extraParams.append(`voice`, voice);
|
|
379
|
+
|
|
380
|
+
// all params for flowertts can be found here: https://flowery.pw/docs
|
|
381
|
+
const response = await player.search({
|
|
382
|
+
query: `${query}`,
|
|
383
|
+
extraQueryUrlParams: extraParams, // as of my knowledge this is currently only used for flowertts, adjusting the playback url dynamically mid-request
|
|
384
|
+
source: "ftts"
|
|
385
|
+
}, interaction.user);
|
|
386
|
+
```
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bandCampSearch = void 0;
|
|
4
|
-
const undici_1 = require("undici");
|
|
5
4
|
const bandCampSearch = async (player, query, requestUser) => {
|
|
6
5
|
let error = null;
|
|
7
6
|
let tracks = [];
|
|
7
|
+
if (player.LavalinkManager.options.advancedOptions.debugOptions.logCustomSearches)
|
|
8
|
+
console.log(`Lavalink-Client-Debug | SEARCHING | - ${query} on lavalink-client`);
|
|
8
9
|
player.LavalinkManager.utils.validateQueryString(player.node, query);
|
|
9
10
|
try {
|
|
10
|
-
const data = await
|
|
11
|
+
const data = await fetch(`https://bandcamp.com/api/nusearch/2/autocomplete?q=${encodeURIComponent(query)}`, {
|
|
11
12
|
headers: {
|
|
12
13
|
'User-Agent': 'android-async-http/1.4.1 (http://loopj.com/android-async-http)',
|
|
13
14
|
'Cookie': '$Version=1'
|
|
@@ -7,7 +7,7 @@ export declare class FilterManager {
|
|
|
7
7
|
/** The Equalizer bands currently applied to the Lavalink Server */
|
|
8
8
|
equalizerBands: EQBand[];
|
|
9
9
|
/** Private Util for the instaFix Filters option */
|
|
10
|
-
filterUpdatedState:
|
|
10
|
+
filterUpdatedState: boolean;
|
|
11
11
|
/** All "Active" / "disabled" Player Filters */
|
|
12
12
|
filters: PlayerFilters;
|
|
13
13
|
/** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
|
|
@@ -8,7 +8,7 @@ class FilterManager {
|
|
|
8
8
|
/** The Equalizer bands currently applied to the Lavalink Server */
|
|
9
9
|
equalizerBands = [];
|
|
10
10
|
/** Private Util for the instaFix Filters option */
|
|
11
|
-
filterUpdatedState =
|
|
11
|
+
filterUpdatedState = false;
|
|
12
12
|
/** All "Active" / "disabled" Player Filters */
|
|
13
13
|
filters = {
|
|
14
14
|
volume: false,
|
|
@@ -160,6 +160,8 @@ class FilterManager {
|
|
|
160
160
|
delete sendData[key];
|
|
161
161
|
}
|
|
162
162
|
const now = performance.now();
|
|
163
|
+
if (this.player.options.instaUpdateFiltersFix === true)
|
|
164
|
+
this.filterUpdatedState = true;
|
|
163
165
|
await this.player.node.updatePlayer({
|
|
164
166
|
guildId: this.player.guildId,
|
|
165
167
|
playerOptions: {
|
|
@@ -167,8 +169,6 @@ class FilterManager {
|
|
|
167
169
|
}
|
|
168
170
|
});
|
|
169
171
|
this.player.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
170
|
-
if (this.player.options.instaUpdateFiltersFix === true)
|
|
171
|
-
this.filterUpdatedState = 1;
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
@@ -654,6 +654,8 @@ class FilterManager {
|
|
|
654
654
|
if (!this.player.node.sessionId)
|
|
655
655
|
throw new Error("The Lavalink-Node is either not ready or not up to date");
|
|
656
656
|
const now = performance.now();
|
|
657
|
+
if (this.player.options.instaUpdateFiltersFix === true)
|
|
658
|
+
this.filterUpdatedState = true;
|
|
657
659
|
await this.player.node.updatePlayer({
|
|
658
660
|
guildId: this.player.guildId,
|
|
659
661
|
playerOptions: {
|
|
@@ -661,8 +663,6 @@ class FilterManager {
|
|
|
661
663
|
}
|
|
662
664
|
});
|
|
663
665
|
this.player.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
664
|
-
if (this.player.options.instaUpdateFiltersFix === true)
|
|
665
|
-
this.filterUpdatedState = 1;
|
|
666
666
|
return this;
|
|
667
667
|
}
|
|
668
668
|
/** Clears the equalizer bands. */
|
|
@@ -6,6 +6,7 @@ import { DestroyReasonsType, Player, PlayerJson, PlayerOptions } from "./Player"
|
|
|
6
6
|
import { ManagerQueueOptions } from "./Queue";
|
|
7
7
|
import { Track, UnresolvedTrack } from "./Track";
|
|
8
8
|
import { ChannelDeletePacket, GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
9
|
+
/** How the botclient is allowed to be structured */
|
|
9
10
|
export interface BotClientOptions {
|
|
10
11
|
/** Bot Client Id */
|
|
11
12
|
id: string;
|
|
@@ -14,6 +15,7 @@ export interface BotClientOptions {
|
|
|
14
15
|
/** So users can pass entire objects / classes */
|
|
15
16
|
[x: string | number | symbol]: unknown;
|
|
16
17
|
}
|
|
18
|
+
/** Sub Manager Options, for player specific things */
|
|
17
19
|
export interface ManagerPlayerOptions {
|
|
18
20
|
/** If the Lavalink Volume should be decremented by x number */
|
|
19
21
|
volumeDecrementer?: number;
|
|
@@ -39,6 +41,7 @@ export interface ManagerPlayerOptions {
|
|
|
39
41
|
};
|
|
40
42
|
useUnresolvedData?: boolean;
|
|
41
43
|
}
|
|
44
|
+
/** Manager Options used to create the manager */
|
|
42
45
|
export interface ManagerOptions {
|
|
43
46
|
/** The Node Options, for all Nodes! (on init) */
|
|
44
47
|
nodes: LavalinkNodeOptions[];
|
|
@@ -64,8 +67,12 @@ export interface ManagerOptions {
|
|
|
64
67
|
linksAllowed?: boolean;
|
|
65
68
|
/** Advanced Options for the Library, which may or may not be "library breaking" */
|
|
66
69
|
advancedOptions?: {
|
|
70
|
+
/** Max duration for that the filter fix duration works (in ms) - default is 8mins */
|
|
71
|
+
maxFilterFixDuration?: number;
|
|
67
72
|
/** optional */
|
|
68
73
|
debugOptions?: {
|
|
74
|
+
/** For logging custom searches */
|
|
75
|
+
logCustomSearches?: boolean;
|
|
69
76
|
/** logs for debugging the "no-Audio" playing error */
|
|
70
77
|
noAudio?: boolean;
|
|
71
78
|
/** For Logging the Destroy function */
|
|
@@ -78,7 +85,7 @@ export interface ManagerOptions {
|
|
|
78
85
|
};
|
|
79
86
|
};
|
|
80
87
|
}
|
|
81
|
-
interface LavalinkManagerEvents {
|
|
88
|
+
export interface LavalinkManagerEvents {
|
|
82
89
|
/**
|
|
83
90
|
* Emitted when a Track started playing.
|
|
84
91
|
* @event Manager#trackStart
|
|
@@ -93,12 +100,12 @@ interface LavalinkManagerEvents {
|
|
|
93
100
|
* Emitted when a Track got stuck while playing.
|
|
94
101
|
* @event Manager#trackStuck
|
|
95
102
|
*/
|
|
96
|
-
"trackStuck": (player: Player, track: Track, payload: TrackStuckEvent) => void;
|
|
103
|
+
"trackStuck": (player: Player, track: Track | null, payload: TrackStuckEvent) => void;
|
|
97
104
|
/**
|
|
98
105
|
* Emitted when a Track errored.
|
|
99
106
|
* @event Manager#trackError
|
|
100
107
|
*/
|
|
101
|
-
"trackError": (player: Player, track: Track | UnresolvedTrack, payload: TrackExceptionEvent) => void;
|
|
108
|
+
"trackError": (player: Player, track: Track | UnresolvedTrack | null, payload: TrackExceptionEvent) => void;
|
|
102
109
|
/**
|
|
103
110
|
* Emitted when the Playing finished and no more tracks in the queue.
|
|
104
111
|
* @event Manager#queueEnd
|
|
@@ -237,6 +244,7 @@ export declare class LavalinkManager extends EventEmitter {
|
|
|
237
244
|
* linksBlacklist: [],
|
|
238
245
|
* linksWhitelist: [],
|
|
239
246
|
* advancedOptions: {
|
|
247
|
+
* maxFilterFixDuration: 600_000,
|
|
240
248
|
* debugOptions: {
|
|
241
249
|
* noAudio: false,
|
|
242
250
|
* playerDestroy: {
|
|
@@ -307,10 +315,22 @@ export declare class LavalinkManager extends EventEmitter {
|
|
|
307
315
|
* Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
|
|
308
316
|
* @param guildId
|
|
309
317
|
* @returns
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* client.lavalink.deletePlayer(interaction.guildId);
|
|
322
|
+
* // shouldn't be used except you know what you are doing.
|
|
323
|
+
* ```
|
|
310
324
|
*/
|
|
311
325
|
deletePlayer(guildId: string): boolean;
|
|
312
326
|
/**
|
|
313
327
|
* Checks wether the the lib is useable based on if any node is connected
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```ts
|
|
331
|
+
* if(!client.lavalink.useable) return console.error("can'T search yet, because there is no useable lavalink node.")
|
|
332
|
+
* // continue with code e.g. createing a player and searching
|
|
333
|
+
* ```
|
|
314
334
|
*/
|
|
315
335
|
get useable(): boolean;
|
|
316
336
|
/**
|
|
@@ -318,7 +338,6 @@ export declare class LavalinkManager extends EventEmitter {
|
|
|
318
338
|
* @param clientData
|
|
319
339
|
*
|
|
320
340
|
* @example
|
|
321
|
-
*
|
|
322
341
|
* ```ts
|
|
323
342
|
* // on the bot ready event
|
|
324
343
|
* client.on("ready", () => {
|
|
@@ -347,4 +366,3 @@ export declare class LavalinkManager extends EventEmitter {
|
|
|
347
366
|
*/
|
|
348
367
|
sendRawData(data: VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket): Promise<void>;
|
|
349
368
|
}
|
|
350
|
-
export {};
|
|
@@ -58,7 +58,9 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
58
58
|
queueStore: options?.queueOptions?.queueStore ?? new Queue_1.DefaultQueueStore(),
|
|
59
59
|
},
|
|
60
60
|
advancedOptions: {
|
|
61
|
+
maxFilterFixDuration: options?.advancedOptions?.maxFilterFixDuration ?? 600000,
|
|
61
62
|
debugOptions: {
|
|
63
|
+
logCustomSearches: options?.advancedOptions?.debugOptions?.logCustomSearches ?? false,
|
|
62
64
|
noAudio: options?.advancedOptions?.debugOptions?.noAudio ?? false,
|
|
63
65
|
playerDestroy: {
|
|
64
66
|
dontThrowError: options?.advancedOptions?.debugOptions?.playerDestroy?.dontThrowError ?? false,
|
|
@@ -149,6 +151,7 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
149
151
|
* linksBlacklist: [],
|
|
150
152
|
* linksWhitelist: [],
|
|
151
153
|
* advancedOptions: {
|
|
154
|
+
* maxFilterFixDuration: 600_000,
|
|
152
155
|
* debugOptions: {
|
|
153
156
|
* noAudio: false,
|
|
154
157
|
* playerDestroy: {
|
|
@@ -243,6 +246,12 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
243
246
|
* Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
|
|
244
247
|
* @param guildId
|
|
245
248
|
* @returns
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```ts
|
|
252
|
+
* client.lavalink.deletePlayer(interaction.guildId);
|
|
253
|
+
* // shouldn't be used except you know what you are doing.
|
|
254
|
+
* ```
|
|
246
255
|
*/
|
|
247
256
|
deletePlayer(guildId) {
|
|
248
257
|
const oldPlayer = this.getPlayer(guildId);
|
|
@@ -259,6 +268,12 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
259
268
|
}
|
|
260
269
|
/**
|
|
261
270
|
* Checks wether the the lib is useable based on if any node is connected
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```ts
|
|
274
|
+
* if(!client.lavalink.useable) return console.error("can'T search yet, because there is no useable lavalink node.")
|
|
275
|
+
* // continue with code e.g. createing a player and searching
|
|
276
|
+
* ```
|
|
262
277
|
*/
|
|
263
278
|
get useable() {
|
|
264
279
|
return this.nodeManager.nodes.filter(v => v.connected).size > 0;
|
|
@@ -268,7 +283,6 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
268
283
|
* @param clientData
|
|
269
284
|
*
|
|
270
285
|
* @example
|
|
271
|
-
*
|
|
272
286
|
* ```ts
|
|
273
287
|
* // on the bot ready event
|
|
274
288
|
* client.on("ready", () => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ClientCustomSearchPlatformUtils, LavalinkSearchPlatform, SearchPlatform, SourcesRegex } from "./Utils";
|
|
2
|
+
/** Default Sources Record, to allow source parsing with multiple inputs. */
|
|
2
3
|
export declare const DefaultSources: Record<SearchPlatform, LavalinkSearchPlatform | ClientCustomSearchPlatformUtils>;
|
|
4
|
+
/** Lavalink Plugins definiton */
|
|
3
5
|
export declare const LavalinkPlugins: {
|
|
4
6
|
DuncteBot_Plugin: string;
|
|
5
7
|
LavaSrc: string;
|
|
@@ -7,4 +9,5 @@ export declare const LavalinkPlugins: {
|
|
|
7
9
|
LavaSearch: string;
|
|
8
10
|
LavalinkFilterPlugin: string;
|
|
9
11
|
};
|
|
12
|
+
/** Lavalink Sources regexes for url validations */
|
|
10
13
|
export declare const SourceLinksRegexes: Record<SourcesRegex, RegExp>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SourceLinksRegexes = exports.LavalinkPlugins = exports.DefaultSources = void 0;
|
|
4
|
+
/** Default Sources Record, to allow source parsing with multiple inputs. */
|
|
4
5
|
exports.DefaultSources = {
|
|
5
6
|
// youtubemusic
|
|
6
7
|
"youtube music": "ytmsearch",
|
|
@@ -50,10 +51,14 @@ exports.DefaultSources = {
|
|
|
50
51
|
"flowery": "ftts",
|
|
51
52
|
"flowery.tts": "ftts",
|
|
52
53
|
"flowerytts": "ftts",
|
|
53
|
-
// Client sided search platforms
|
|
54
|
+
// Client sided search platforms (after lavalinkv4.0.6 it will search via bcsearch on the node itself)
|
|
54
55
|
"bandcamp": "bcsearch",
|
|
55
56
|
"bc": "bcsearch",
|
|
56
57
|
"bcsearch": "bcsearch",
|
|
58
|
+
// other searches:
|
|
59
|
+
"phsearch": "phsearch",
|
|
60
|
+
"pornhub": "phsearch",
|
|
61
|
+
"porn": "phsearch",
|
|
57
62
|
// local files
|
|
58
63
|
"local": "local",
|
|
59
64
|
// http requests
|
|
@@ -62,6 +67,7 @@ exports.DefaultSources = {
|
|
|
62
67
|
"link": "link",
|
|
63
68
|
"uri": "uri"
|
|
64
69
|
};
|
|
70
|
+
/** Lavalink Plugins definiton */
|
|
65
71
|
exports.LavalinkPlugins = {
|
|
66
72
|
DuncteBot_Plugin: "DuncteBot-plugin",
|
|
67
73
|
LavaSrc: "lavasrc-plugin",
|
|
@@ -69,6 +75,7 @@ exports.LavalinkPlugins = {
|
|
|
69
75
|
LavaSearch: "lavasearch-plugin",
|
|
70
76
|
LavalinkFilterPlugin: "lavalink-filter-plugin"
|
|
71
77
|
};
|
|
78
|
+
/** Lavalink Sources regexes for url validations */
|
|
72
79
|
exports.SourceLinksRegexes = {
|
|
73
80
|
/** DEFAULT SUPPORTED BY LAVALINK */
|
|
74
81
|
YoutubeRegex: /https?:\/\/?(?:www\.)?(?:(m|www)\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|shorts|playlist\?|watch\?v=|watch\?.+(?:&|&);v=))([a-zA-Z0-9\-_]{11})?(?:(?:\?|&|&)index=((?:\d){1,3}))?(?:(?:\?|&|&)?list=([a-zA-Z\-_0-9]{34}))?(?:\S+)?/,
|