lavalink-client 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/structures/LavalinkManager.d.ts +15 -4
- package/dist/cjs/structures/LavalinkManager.js +72 -11
- package/dist/cjs/structures/LavalinkManagerStatics.js +1 -0
- package/dist/cjs/structures/Node.js +17 -10
- package/dist/cjs/structures/NodeManager.d.ts +11 -0
- package/dist/cjs/structures/NodeManager.js +60 -3
- package/dist/cjs/structures/Player.js +7 -4
- package/dist/cjs/structures/Queue.d.ts +4 -2
- package/dist/cjs/structures/Queue.js +7 -6
- package/dist/cjs/structures/Track.d.ts +9 -1
- package/dist/cjs/structures/Utils.d.ts +16 -4
- package/dist/cjs/structures/Utils.js +64 -5
- package/dist/esm/structures/LavalinkManager.d.ts +15 -4
- package/dist/esm/structures/LavalinkManager.js +72 -11
- package/dist/esm/structures/LavalinkManagerStatics.js +1 -0
- package/dist/esm/structures/Node.js +17 -10
- package/dist/esm/structures/NodeManager.d.ts +11 -0
- package/dist/esm/structures/NodeManager.js +60 -3
- package/dist/esm/structures/Player.js +7 -4
- package/dist/esm/structures/Queue.d.ts +4 -2
- package/dist/esm/structures/Queue.js +7 -6
- package/dist/esm/structures/Track.d.ts +9 -1
- package/dist/esm/structures/Utils.d.ts +16 -4
- package/dist/esm/structures/Utils.js +64 -5
- package/dist/structures/LavalinkManager.d.ts +1 -1
- package/dist/types/structures/LavalinkManager.d.ts +15 -4
- package/dist/types/structures/NodeManager.d.ts +11 -0
- package/dist/types/structures/Queue.d.ts +4 -2
- package/dist/types/structures/Track.d.ts +9 -1
- package/dist/types/structures/Utils.d.ts +16 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
3
|
import { NodeManager } from "./NodeManager";
|
|
4
|
-
import {
|
|
4
|
+
import { QueueSaverOptions } from "./Queue";
|
|
5
5
|
import { GuildShardPayload, LavalinkSearchPlatform, ManagerUitls, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
6
6
|
import { LavalinkNodeOptions } from "./Node";
|
|
7
7
|
import { DestroyReasonsType, Player, PlayerOptions } from "./Player";
|
|
@@ -18,26 +18,37 @@ export interface BotClientOptions {
|
|
|
18
18
|
[x: string | number | symbol | undefined]: any;
|
|
19
19
|
}
|
|
20
20
|
export interface LavalinkPlayerOptions {
|
|
21
|
+
/** If the Lavalink Volume should be decremented by x number */
|
|
21
22
|
volumeDecrementer?: number;
|
|
22
|
-
|
|
23
|
+
/** How often it should update the the player Position */
|
|
24
|
+
clientBasedPositionUpdateInterval?: number;
|
|
25
|
+
/** What should be used as a searchPlatform, if no source was provided during the query */
|
|
23
26
|
defaultSearchPlatform?: SearchPlatform;
|
|
27
|
+
/** Applies the volume via a filter, not via the lavalink volume transformer */
|
|
24
28
|
applyVolumeAsFilter?: boolean;
|
|
29
|
+
/** Transforms the saved data of a requested user */
|
|
30
|
+
requesterTransformer?: (requester: unknown) => unknown;
|
|
31
|
+
/** What lavalink-client should do when the player reconnects */
|
|
25
32
|
onDisconnect?: {
|
|
33
|
+
/** Try to reconnect? -> If fails -> Destroy */
|
|
26
34
|
autoReconnect?: boolean;
|
|
35
|
+
/** Instantly destroy player (overrides autoReconnect) */
|
|
27
36
|
destroyPlayer?: boolean;
|
|
28
37
|
};
|
|
29
38
|
onEmptyQueue?: {
|
|
39
|
+
/** Get's executed onEmptyQueue -> You can do any track queue previous transformations, if you add a track to the queue -> it will play it, if not queueEnd will execute! */
|
|
40
|
+
autoPlayFunction?: (player: Player, lastPlayedTrack: Track) => Promise<void>;
|
|
30
41
|
destroyAfterMs?: number;
|
|
31
42
|
};
|
|
32
43
|
}
|
|
33
44
|
export interface ManagerOptions {
|
|
34
45
|
nodes: LavalinkNodeOptions[];
|
|
35
46
|
queueOptions?: QueueSaverOptions;
|
|
36
|
-
queueStore?: StoreManager;
|
|
37
|
-
queueChangesWatcher?: QueueChangesWatcher;
|
|
38
47
|
client?: BotClientOptions;
|
|
39
48
|
playerOptions?: LavalinkPlayerOptions;
|
|
40
49
|
autoSkip?: boolean;
|
|
50
|
+
defaultLeastUsedNodeSortType?: "memory" | "calls" | "players";
|
|
51
|
+
defaultLeastLoadNodeSortType?: "cpu" | "memory";
|
|
41
52
|
/** @async */
|
|
42
53
|
sendToShard: (guildId: string, payload: GuildShardPayload) => void;
|
|
43
54
|
}
|
|
@@ -56,6 +56,17 @@ export declare class NodeManager extends EventEmitter {
|
|
|
56
56
|
constructor(LavalinkManager: LavalinkManager);
|
|
57
57
|
createNode(options: LavalinkNodeOptions): LavalinkNode;
|
|
58
58
|
get leastUsedNodes(): LavalinkNode[];
|
|
59
|
+
/** Returns the least used Nodes sorted by amount of calls. */
|
|
60
|
+
private get leastUsedNodesCalls();
|
|
61
|
+
/** Returns the least used Nodes sorted by amount of players. */
|
|
62
|
+
private get leastUsedNodesPlayers();
|
|
63
|
+
/** Returns the least used Nodes sorted by amount of memory usage. */
|
|
64
|
+
private get leastUsedNodesMemory();
|
|
65
|
+
/** Returns the least system load Nodes. */
|
|
66
|
+
get leastLoadNodes(): LavalinkNode[];
|
|
67
|
+
get leastLoadNodesMemory(): LavalinkNode[];
|
|
68
|
+
/** Returns the least system load Nodes. */
|
|
69
|
+
get leastLoadNodesCpu(): LavalinkNode[];
|
|
59
70
|
deleteNode(node: LavalinkNodeIdentifier | LavalinkNode): void;
|
|
60
71
|
}
|
|
61
72
|
export {};
|
|
@@ -18,6 +18,8 @@ export interface StoreManager extends Record<any, any> {
|
|
|
18
18
|
}
|
|
19
19
|
export interface QueueSaverOptions {
|
|
20
20
|
maxPreviousTracks: number;
|
|
21
|
+
queueStore?: StoreManager;
|
|
22
|
+
queueChangesWatcher?: QueueChangesWatcher;
|
|
21
23
|
}
|
|
22
24
|
export interface QueueSaver {
|
|
23
25
|
/** @private */
|
|
@@ -26,7 +28,7 @@ export interface QueueSaver {
|
|
|
26
28
|
options: QueueSaverOptions;
|
|
27
29
|
}
|
|
28
30
|
export declare class QueueSaver {
|
|
29
|
-
constructor(
|
|
31
|
+
constructor(options: QueueSaverOptions);
|
|
30
32
|
get(guildId: string): Promise<Partial<StoredQueue>>;
|
|
31
33
|
delete(guildId: string): Promise<any>;
|
|
32
34
|
set(guildId: string, value: any): Promise<any>;
|
|
@@ -59,7 +61,7 @@ export declare class Queue {
|
|
|
59
61
|
static readonly StaticSymbol: Symbol;
|
|
60
62
|
private managerUtils;
|
|
61
63
|
private queueChanges;
|
|
62
|
-
constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver,
|
|
64
|
+
constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: QueueSaverOptions);
|
|
63
65
|
/**
|
|
64
66
|
* Utils for a Queue
|
|
65
67
|
*/
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Base64 } from "./Utils";
|
|
2
|
+
type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
|
|
3
|
+
type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
|
|
4
|
+
type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames;
|
|
2
5
|
export interface TrackInfo {
|
|
3
6
|
identifier: string;
|
|
4
7
|
title: string;
|
|
@@ -6,7 +9,7 @@ export interface TrackInfo {
|
|
|
6
9
|
duration: number;
|
|
7
10
|
artworkUrl: string | null;
|
|
8
11
|
uri: string;
|
|
9
|
-
sourceName:
|
|
12
|
+
sourceName: SourceNames;
|
|
10
13
|
isSeekable: boolean;
|
|
11
14
|
isStream: boolean;
|
|
12
15
|
isrc: string | null;
|
|
@@ -24,6 +27,10 @@ export interface PluginInfo {
|
|
|
24
27
|
url?: string;
|
|
25
28
|
/** The Url provided by a Plugin */
|
|
26
29
|
uri?: string;
|
|
30
|
+
/** You can put specific track information here, to transform the tracks... */
|
|
31
|
+
clientData?: {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
27
34
|
}
|
|
28
35
|
export interface LavalinkTrack {
|
|
29
36
|
/** The Base 64 encoded String */
|
|
@@ -45,3 +52,4 @@ export interface UnresolvedQuery {
|
|
|
45
52
|
/** The Track's Requester */
|
|
46
53
|
requester?: unknown;
|
|
47
54
|
}
|
|
55
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LavalinkFilterData } from "./Filters";
|
|
2
2
|
import { LavalinkManager } from "./LavalinkManager";
|
|
3
|
-
import { LavalinkNode, NodeStats } from "./Node";
|
|
3
|
+
import { LavalinkNode, LavalinkNodeOptions, NodeStats } from "./Node";
|
|
4
4
|
import { PlayOptions } from "./Player";
|
|
5
5
|
import { Queue } from "./Queue";
|
|
6
6
|
import { PluginInfo, Track } from "./Track";
|
|
@@ -8,7 +8,7 @@ export declare const TrackSymbol: unique symbol;
|
|
|
8
8
|
export declare const UnresolvedTrackSymbol: unique symbol;
|
|
9
9
|
export declare const QueueSymbol: unique symbol;
|
|
10
10
|
export declare const NodeSymbol: unique symbol;
|
|
11
|
-
export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "sprec" | "ymsearch" | "speak" | "tts";
|
|
11
|
+
export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "sprec" | "ymsearch" | "speak" | "tts" | "ftts";
|
|
12
12
|
export type ClientSearchPlatform = "youtube" | "yt" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "yandex music" | "sp" | "sprec" | "spsuggestion" | "spotify" | "dz" | "deezer" | "yandex" | "yandexmusic";
|
|
13
13
|
export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
14
14
|
export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "appleMusic" | "TwitchTv" | "vimeo";
|
|
@@ -40,10 +40,20 @@ export interface ManagerUitls {
|
|
|
40
40
|
export declare class ManagerUitls {
|
|
41
41
|
constructor(LavalinkManager?: LavalinkManager);
|
|
42
42
|
buildTrack(data: any, requester: any): Track;
|
|
43
|
+
/**
|
|
44
|
+
* Validate if a data is equal to a node
|
|
45
|
+
* @param data
|
|
46
|
+
*/
|
|
47
|
+
isNode(data: LavalinkNode): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Validate if a data is equal to node options
|
|
50
|
+
* @param data
|
|
51
|
+
*/
|
|
52
|
+
isNodeOptions(data: LavalinkNodeOptions | any): boolean;
|
|
43
53
|
/**
|
|
44
54
|
* Validate if a data is euqal to a track
|
|
45
|
-
* @param
|
|
46
|
-
* @returns
|
|
55
|
+
* @param data the Track to validate
|
|
56
|
+
* @returns
|
|
47
57
|
*/
|
|
48
58
|
isTrack(data: Track | any): boolean;
|
|
49
59
|
validatedQuery(queryString: string, node: LavalinkNode): void;
|
|
@@ -85,6 +95,8 @@ export declare class MiniMap<K, V> extends Map<K, V> {
|
|
|
85
95
|
filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
|
|
86
96
|
filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
|
|
87
97
|
filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
|
|
98
|
+
toJSON(): V[];
|
|
99
|
+
private static defaultSort;
|
|
88
100
|
/**
|
|
89
101
|
* Maps each item to another value into an array. Identical in behavior to
|
|
90
102
|
* [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
package/package.json
CHANGED