lavalink-client 2.2.2 → 2.3.0
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 +95 -1
- package/dist/cjs/index.d.ts +7 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/structures/Constants.d.ts +40 -0
- package/dist/cjs/structures/Constants.js +244 -0
- package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/cjs/structures/Filters.d.ts +2 -217
- package/dist/cjs/structures/Filters.js +8 -232
- package/dist/cjs/structures/LavalinkManager.d.ts +31 -166
- package/dist/cjs/structures/LavalinkManager.js +59 -7
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/cjs/structures/Node.d.ts +15 -156
- package/dist/cjs/structures/Node.js +131 -49
- package/dist/cjs/structures/NodeManager.d.ts +54 -52
- package/dist/cjs/structures/NodeManager.js +74 -4
- package/dist/cjs/structures/Player.d.ts +31 -124
- package/dist/cjs/structures/Player.js +77 -43
- package/dist/cjs/structures/Queue.d.ts +66 -42
- package/dist/cjs/structures/Queue.js +69 -11
- package/dist/cjs/structures/Types/Filters.d.ts +190 -0
- package/dist/cjs/structures/Types/Manager.d.ts +184 -0
- package/dist/cjs/structures/Types/Manager.js +2 -0
- package/dist/cjs/structures/Types/Node.d.ts +216 -0
- package/dist/cjs/structures/Types/Node.js +2 -0
- package/dist/cjs/structures/Types/Player.d.ts +108 -0
- package/dist/cjs/structures/Types/Player.js +2 -0
- package/dist/cjs/structures/Types/Queue.d.ts +34 -0
- package/dist/cjs/structures/Types/Queue.js +2 -0
- package/dist/cjs/structures/{Track.d.ts → Types/Track.d.ts} +3 -2
- package/dist/cjs/structures/Types/Track.js +2 -0
- package/dist/cjs/structures/Types/Utils.d.ts +367 -0
- package/dist/cjs/structures/Types/Utils.js +2 -0
- package/dist/cjs/structures/Utils.d.ts +13 -369
- package/dist/cjs/structures/Utils.js +35 -14
- package/dist/esm/index.d.ts +7 -1
- package/dist/esm/index.js +7 -1
- package/dist/esm/structures/Constants.d.ts +40 -0
- package/dist/esm/structures/Constants.js +241 -0
- package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/esm/structures/Filters.d.ts +2 -217
- package/dist/esm/structures/Filters.js +3 -227
- package/dist/esm/structures/LavalinkManager.d.ts +31 -166
- package/dist/esm/structures/LavalinkManager.js +57 -5
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/esm/structures/Node.d.ts +15 -156
- package/dist/esm/structures/Node.js +122 -40
- package/dist/esm/structures/NodeManager.d.ts +54 -52
- package/dist/esm/structures/NodeManager.js +71 -1
- package/dist/esm/structures/Player.d.ts +31 -124
- package/dist/esm/structures/Player.js +76 -42
- package/dist/esm/structures/Queue.d.ts +66 -42
- package/dist/esm/structures/Queue.js +69 -11
- package/dist/esm/structures/Types/Filters.d.ts +190 -0
- package/dist/esm/structures/Types/Manager.d.ts +184 -0
- package/dist/esm/structures/Types/Manager.js +1 -0
- package/dist/esm/structures/Types/Node.d.ts +216 -0
- package/dist/esm/structures/Types/Node.js +1 -0
- package/dist/esm/structures/Types/Player.d.ts +108 -0
- package/dist/esm/structures/Types/Player.js +1 -0
- package/dist/esm/structures/Types/Queue.d.ts +34 -0
- package/dist/esm/structures/Types/Queue.js +1 -0
- package/dist/{types/structures → esm/structures/Types}/Track.d.ts +3 -2
- package/dist/esm/structures/Types/Track.js +1 -0
- package/dist/esm/structures/Types/Utils.d.ts +367 -0
- package/dist/esm/structures/Types/Utils.js +1 -0
- package/dist/esm/structures/Utils.d.ts +13 -369
- package/dist/esm/structures/Utils.js +35 -14
- package/dist/types/index.d.ts +7 -1
- package/dist/types/structures/Constants.d.ts +40 -0
- package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +2 -2
- package/dist/types/structures/Filters.d.ts +2 -217
- package/dist/types/structures/LavalinkManager.d.ts +31 -166
- package/dist/types/structures/LavalinkManagerStatics.d.ts +1 -1
- package/dist/types/structures/Node.d.ts +15 -156
- package/dist/types/structures/NodeManager.d.ts +54 -52
- package/dist/types/structures/Player.d.ts +31 -124
- package/dist/types/structures/Queue.d.ts +66 -42
- package/dist/types/structures/Types/Filters.d.ts +190 -0
- package/dist/types/structures/Types/Manager.d.ts +184 -0
- package/dist/types/structures/Types/Node.d.ts +216 -0
- package/dist/types/structures/Types/Player.d.ts +108 -0
- package/dist/types/structures/Types/Queue.d.ts +34 -0
- package/dist/{esm/structures → types/structures/Types}/Track.d.ts +3 -2
- package/dist/types/structures/Types/Utils.d.ts +367 -0
- package/dist/types/structures/Utils.d.ts +13 -369
- package/package.json +1 -1
- /package/dist/cjs/structures/{Track.js → Types/Filters.js} +0 -0
- /package/dist/esm/structures/{Track.js → Types/Filters.js} +0 -0
|
@@ -1,68 +1,56 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "stream";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export interface NodeManagerEvents {
|
|
3
|
+
import { LavalinkNode } from "./Node";
|
|
4
|
+
import { MiniMap } from "./Utils";
|
|
5
|
+
import type { LavalinkNodeIdentifier, LavalinkNodeOptions, NodeManagerEvents } from "./Types/Node";
|
|
6
|
+
import type { LavalinkManager } from "./LavalinkManager";
|
|
7
|
+
export declare class NodeManager extends EventEmitter {
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @event
|
|
9
|
+
* Emit an event
|
|
10
|
+
* @param event The event to emit
|
|
11
|
+
* @param args The arguments to pass to the event
|
|
12
|
+
* @returns
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
emit<Event extends keyof NodeManagerEvents>(event: Event, ...args: Parameters<NodeManagerEvents[Event]>): boolean;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @event
|
|
16
|
+
* Add an event listener
|
|
17
|
+
* @param event The event to listen to
|
|
18
|
+
* @param listener The listener to add
|
|
19
|
+
* @returns
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
on<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
19
22
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @event
|
|
23
|
+
* Add an event listener that only fires once
|
|
24
|
+
* @param event The event to listen to
|
|
25
|
+
* @param listener The listener to add
|
|
26
|
+
* @returns
|
|
22
27
|
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Emitted when a Node is reconnecting.
|
|
26
|
-
* @event Manager.nodeManager#reconnecting
|
|
27
|
-
*/
|
|
28
|
-
"reconnecting": (node: LavalinkNode) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Emitted when a Node is disconnects.
|
|
31
|
-
* @event Manager.nodeManager#disconnect
|
|
32
|
-
*/
|
|
33
|
-
"disconnect": (node: LavalinkNode, reason: {
|
|
34
|
-
code?: number;
|
|
35
|
-
reason?: string;
|
|
36
|
-
}) => void;
|
|
28
|
+
once<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
37
29
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @event
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
* Remove an event listener
|
|
31
|
+
* @param event The event to remove the listener from
|
|
32
|
+
* @param listener The listener to remove
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
off<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
42
36
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @event
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
* Remove an event listener
|
|
38
|
+
* @param event The event to remove the listener from
|
|
39
|
+
* @param listener The listener to remove
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
removeListener<Event extends keyof NodeManagerEvents>(event: Event, listener: NodeManagerEvents[Event]): this;
|
|
47
43
|
/**
|
|
48
|
-
*
|
|
49
|
-
* Aka for that you need to be able to save player data like vc channel + text channel in a db and then sync it again
|
|
50
|
-
* @event Manager.nodeManager#nodeResumed
|
|
44
|
+
* The LavalinkManager that created this NodeManager
|
|
51
45
|
*/
|
|
52
|
-
"resumed": (node: LavalinkNode, paylaod: {
|
|
53
|
-
resumed: true;
|
|
54
|
-
sessionId: string;
|
|
55
|
-
op: "ready";
|
|
56
|
-
}, players: LavalinkPlayer[]) => void;
|
|
57
|
-
}
|
|
58
|
-
export declare interface NodeManager {
|
|
59
|
-
on<U extends keyof NodeManagerEvents>(event: U, listener: NodeManagerEvents[U]): this;
|
|
60
|
-
emit<U extends keyof NodeManagerEvents>(event: U, ...args: Parameters<NodeManagerEvents[U]>): boolean;
|
|
61
|
-
/** @private */
|
|
62
46
|
LavalinkManager: LavalinkManager;
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
/**
|
|
48
|
+
* A map of all nodes in the nodeManager
|
|
49
|
+
*/
|
|
65
50
|
nodes: MiniMap<string, LavalinkNode>;
|
|
51
|
+
/**
|
|
52
|
+
* @param LavalinkManager The LavalinkManager that created this NodeManager
|
|
53
|
+
*/
|
|
66
54
|
constructor(LavalinkManager: LavalinkManager);
|
|
67
55
|
/**
|
|
68
56
|
* Disconnects all Nodes from lavalink ws sockets
|
|
@@ -80,8 +68,22 @@ export declare class NodeManager extends EventEmitter {
|
|
|
80
68
|
* @returns amount of nodes
|
|
81
69
|
*/
|
|
82
70
|
reconnectAll(): Promise<number>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a node and add it to the nodeManager
|
|
73
|
+
* @param options The options for the node
|
|
74
|
+
* @returns The node that was created
|
|
75
|
+
*/
|
|
83
76
|
createNode(options: LavalinkNodeOptions): LavalinkNode;
|
|
77
|
+
/**
|
|
78
|
+
* Get the nodes sorted for the least usage, by a sorttype
|
|
79
|
+
* @param sortType The type of sorting to use
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
84
82
|
leastUsedNodes(sortType?: "memory" | "cpuLavalink" | "cpuSystem" | "calls" | "playingPlayers" | "players"): LavalinkNode[];
|
|
83
|
+
/**
|
|
84
|
+
* Delete a node from the nodeManager and destroy it
|
|
85
|
+
* @param node The node to delete
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
85
88
|
deleteNode(node: LavalinkNodeIdentifier | LavalinkNode): void;
|
|
86
89
|
}
|
|
87
|
-
export {};
|
|
@@ -1,123 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LavalinkManager } from "./LavalinkManager";
|
|
3
|
-
import { LavalinkNode, SponsorBlockSegment } from "./Node";
|
|
1
|
+
import { FilterManager } from "./Filters";
|
|
4
2
|
import { Queue } from "./Queue";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
NodeReconnectFail = "NodeReconnectFail",
|
|
13
|
-
Disconnected = "Disconnected",
|
|
14
|
-
PlayerReconnectFail = "PlayerReconnectFail",
|
|
15
|
-
ChannelDeleted = "ChannelDeleted",
|
|
16
|
-
DisconnectAllNodes = "DisconnectAllNodes",
|
|
17
|
-
ReconnectAllNodes = "ReconnectAllNodes"
|
|
18
|
-
}
|
|
19
|
-
export type DestroyReasonsType = keyof typeof DestroyReasons | string;
|
|
20
|
-
export interface PlayerJson {
|
|
21
|
-
/** Guild Id where the player was playing in */
|
|
22
|
-
guildId: string;
|
|
23
|
-
/** Options provided to the player */
|
|
24
|
-
options: PlayerOptions;
|
|
25
|
-
/** Voice Channel Id the player was playing in */
|
|
26
|
-
voiceChannelId: string;
|
|
27
|
-
/** Text Channel Id the player was synced to */
|
|
28
|
-
textChannelId?: string;
|
|
29
|
-
/** Position the player was at */
|
|
30
|
-
position: number;
|
|
31
|
-
/** Lavalink's position the player was at */
|
|
32
|
-
lastPosition: number;
|
|
33
|
-
/** Last time the position was sent from lavalink */
|
|
34
|
-
lastPositionChange: number;
|
|
35
|
-
/** Volume in % from the player (without volumeDecrementer) */
|
|
36
|
-
volume: number;
|
|
37
|
-
/** Real Volume used in lavalink (with the volumeDecrementer) */
|
|
38
|
-
lavalinkVolume: number;
|
|
39
|
-
/** The repeatmode from the player */
|
|
40
|
-
repeatMode: RepeatMode;
|
|
41
|
-
/** Pause state */
|
|
42
|
-
paused: boolean;
|
|
43
|
-
/** Wether the player was playing or not */
|
|
44
|
-
playing: boolean;
|
|
45
|
-
/** When the player was created */
|
|
46
|
-
createdTimeStamp?: number;
|
|
47
|
-
/** All current used fitlers Data */
|
|
48
|
-
filters: FilterData;
|
|
49
|
-
/** The player's ping object */
|
|
50
|
-
ping: {
|
|
51
|
-
/** Ping to the voice websocket server */
|
|
52
|
-
ws: number;
|
|
53
|
-
/** Avg. calc. Ping to the lavalink server */
|
|
54
|
-
lavalink: number;
|
|
55
|
-
};
|
|
56
|
-
/** Equalizer Bands used in lavalink */
|
|
57
|
-
equalizer: EQBand[];
|
|
58
|
-
/** The Id of the last used node */
|
|
59
|
-
nodeId?: string;
|
|
60
|
-
}
|
|
61
|
-
export type RepeatMode = "queue" | "track" | "off";
|
|
62
|
-
export interface PlayerOptions {
|
|
63
|
-
/** Guild id of the player */
|
|
64
|
-
guildId: string;
|
|
65
|
-
/** The Voice Channel Id */
|
|
66
|
-
voiceChannelId: string;
|
|
67
|
-
/** The Text Channel Id of the Player */
|
|
68
|
-
textChannelId?: string;
|
|
69
|
-
/** instantly change volume with the one play request */
|
|
70
|
-
volume?: number;
|
|
71
|
-
/** VC Region for node selections */
|
|
72
|
-
vcRegion?: string;
|
|
73
|
-
/** if it should join deafened */
|
|
74
|
-
selfDeaf?: boolean;
|
|
75
|
-
/** If it should join muted */
|
|
76
|
-
selfMute?: boolean;
|
|
77
|
-
/** If it should use a specific lavalink node */
|
|
78
|
-
node?: LavalinkNode | string;
|
|
79
|
-
/** If when applying filters, it should use the insta apply filters fix */
|
|
80
|
-
instaUpdateFiltersFix?: boolean;
|
|
81
|
-
/** If a volume should be applied via filters instead of lavalink-volume */
|
|
82
|
-
applyVolumeAsFilter?: boolean;
|
|
83
|
-
}
|
|
84
|
-
export type anyObject = {
|
|
85
|
-
[key: string | number]: string | number | null | anyObject;
|
|
86
|
-
};
|
|
87
|
-
export interface BasePlayOptions {
|
|
88
|
-
/** The position to start the track. */
|
|
89
|
-
position?: number;
|
|
90
|
-
/** The position to end the track. */
|
|
91
|
-
endTime?: number;
|
|
92
|
-
/** If to start "paused" */
|
|
93
|
-
paused?: boolean;
|
|
94
|
-
/** The Volume to start with */
|
|
95
|
-
volume?: number;
|
|
96
|
-
/** The Lavalink Filters to use | only with the new REST API */
|
|
97
|
-
filters?: Partial<LavalinkFilterData>;
|
|
98
|
-
/** Voice Update for Lavalink */
|
|
99
|
-
voice?: LavalinkPlayerVoiceOptions;
|
|
100
|
-
}
|
|
101
|
-
export interface LavalinkPlayOptions extends BasePlayOptions {
|
|
102
|
-
/** Which Track to play | don't provide, if it should pick from the Queue */
|
|
103
|
-
track?: {
|
|
104
|
-
/** The track encoded base64 string to use instead of the one from the queue system */
|
|
105
|
-
encoded?: Base64 | null;
|
|
106
|
-
/** The identifier of the track to use */
|
|
107
|
-
identifier?: string;
|
|
108
|
-
/** Custom User Data for the track to provide, will then be on the userData object from the track */
|
|
109
|
-
userData?: anyObject;
|
|
110
|
-
/** The Track requester for when u provide encodedTrack / identifer */
|
|
111
|
-
requester?: unknown;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
export interface PlayOptions extends LavalinkPlayOptions {
|
|
115
|
-
/** Whether to not replace the track if a play payload is sent. */
|
|
116
|
-
noReplace?: boolean;
|
|
117
|
-
/** Adds track on queue and skips to it */
|
|
118
|
-
clientTrack?: Track | UnresolvedTrack;
|
|
119
|
-
}
|
|
120
|
-
export interface Player {
|
|
3
|
+
import type { DestroyReasons } from "./Constants";
|
|
4
|
+
import type { LavalinkNode } from "./Node";
|
|
5
|
+
import type { SponsorBlockSegment } from "./Types/Node";
|
|
6
|
+
import type { PlayerJson, PlayerOptions, PlayOptions, RepeatMode } from "./Types/Player";
|
|
7
|
+
import type { LavalinkManager } from "./LavalinkManager";
|
|
8
|
+
import type { LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Types/Utils";
|
|
9
|
+
export declare class Player {
|
|
121
10
|
/** Filter Manager per player */
|
|
122
11
|
filterManager: FilterManager;
|
|
123
12
|
/** circular reference to the lavalink Manager from the Player for easier use */
|
|
@@ -128,8 +17,6 @@ export interface Player {
|
|
|
128
17
|
node: LavalinkNode;
|
|
129
18
|
/** The queue from the player */
|
|
130
19
|
queue: Queue;
|
|
131
|
-
}
|
|
132
|
-
export declare class Player {
|
|
133
20
|
/** The Guild Id of the Player */
|
|
134
21
|
guildId: string;
|
|
135
22
|
/** The Voice Channel Id of the Player */
|
|
@@ -157,12 +44,14 @@ export declare class Player {
|
|
|
157
44
|
lastPositionChange: number;
|
|
158
45
|
/** The current Positin of the player (from Lavalink) */
|
|
159
46
|
lastPosition: number;
|
|
47
|
+
lastSavedPosition: number;
|
|
160
48
|
/** When the player was created [Timestamp in Ms] (from lavalink) */
|
|
161
49
|
createdTimeStamp: number;
|
|
162
50
|
/** The Player Connection's State (from Lavalink) */
|
|
163
51
|
connected: boolean | undefined;
|
|
164
52
|
/** Voice Server Data (from Lavalink) */
|
|
165
53
|
voice: LavalinkPlayerVoiceOptions;
|
|
54
|
+
/** Custom data for the player */
|
|
166
55
|
private readonly data;
|
|
167
56
|
/**
|
|
168
57
|
* Create a new Player
|
|
@@ -200,16 +89,33 @@ export declare class Player {
|
|
|
200
89
|
* @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
|
|
201
90
|
*/
|
|
202
91
|
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
|
|
203
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Search for a track
|
|
94
|
+
* @param query The query to search for
|
|
95
|
+
* @param requestUser The user that requested the track
|
|
96
|
+
* @param throwOnEmpty If an error should be thrown if no track is found
|
|
97
|
+
* @returns The search result
|
|
98
|
+
*/
|
|
99
|
+
lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").SearchResult | import("./Types/Utils").LavaSearchResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* Set the SponsorBlock
|
|
102
|
+
* @param segments The segments to set
|
|
103
|
+
*/
|
|
204
104
|
setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Get the SponsorBlock
|
|
107
|
+
*/
|
|
205
108
|
getSponsorBlock(): Promise<SponsorBlockSegment[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Delete the SponsorBlock
|
|
111
|
+
*/
|
|
206
112
|
deleteSponsorBlock(): Promise<void>;
|
|
207
113
|
/**
|
|
208
114
|
*
|
|
209
115
|
* @param query Query for your data
|
|
210
116
|
* @param requestUser
|
|
211
117
|
*/
|
|
212
|
-
search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Utils").
|
|
118
|
+
search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Types/Utils").UnresolvedSearchResult | import("./Types/Utils").SearchResult>;
|
|
213
119
|
/**
|
|
214
120
|
* Pause the player
|
|
215
121
|
*/
|
|
@@ -228,11 +134,12 @@ export declare class Player {
|
|
|
228
134
|
* @param repeatMode
|
|
229
135
|
*/
|
|
230
136
|
setRepeatMode(repeatMode: RepeatMode): Promise<this>;
|
|
137
|
+
1: any;
|
|
231
138
|
/**
|
|
232
139
|
* Skip the current song, or a specific amount of songs
|
|
233
140
|
* @param amount provide the index of the next track to skip to
|
|
234
141
|
*/
|
|
235
|
-
skip(skipTo?: number, throwError?: boolean):
|
|
142
|
+
skip(skipTo?: number, throwError?: boolean): Promise<this>;
|
|
236
143
|
/**
|
|
237
144
|
* Clears the queue and stops playing. Does not destroy the Player and not leave the channel
|
|
238
145
|
* @returns
|
|
@@ -1,62 +1,79 @@
|
|
|
1
|
-
import { Track, UnresolvedTrack } from "./Track";
|
|
2
1
|
import { MiniMap } from "./Utils";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** @async Delete a Database Value based of it's guildId */
|
|
14
|
-
delete: (guildId: unknown) => Promise<unknown>;
|
|
15
|
-
/** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
16
|
-
stringify: (value: unknown) => Promise<unknown>;
|
|
17
|
-
/** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
18
|
-
parse: (value: unknown) => Promise<Partial<StoredQueue>>;
|
|
19
|
-
}
|
|
20
|
-
export interface ManagerQueueOptions {
|
|
21
|
-
/** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
|
|
22
|
-
maxPreviousTracks?: number;
|
|
23
|
-
/** Custom Queue Store option */
|
|
24
|
-
queueStore?: QueueStoreManager;
|
|
25
|
-
/** Custom Queue Watcher class */
|
|
26
|
-
queueChangesWatcher?: QueueChangesWatcher;
|
|
27
|
-
}
|
|
28
|
-
export interface QueueSaver {
|
|
29
|
-
/** @private */
|
|
30
|
-
_: QueueStoreManager;
|
|
31
|
-
/** @private */
|
|
2
|
+
import type { Track, UnresolvedTrack } from "./Types/Track";
|
|
3
|
+
import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue";
|
|
4
|
+
export declare class QueueSaver {
|
|
5
|
+
/**
|
|
6
|
+
* The queue store manager
|
|
7
|
+
*/
|
|
8
|
+
private _;
|
|
9
|
+
/**
|
|
10
|
+
* The options for the queue saver
|
|
11
|
+
*/
|
|
32
12
|
options: {
|
|
33
13
|
maxPreviousTracks: number;
|
|
34
14
|
};
|
|
35
|
-
}
|
|
36
|
-
export declare class QueueSaver {
|
|
37
15
|
constructor(options: ManagerQueueOptions);
|
|
16
|
+
/**
|
|
17
|
+
* Get the queue for a guild
|
|
18
|
+
* @param guildId The guild ID
|
|
19
|
+
* @returns The queue for the guild
|
|
20
|
+
*/
|
|
38
21
|
get(guildId: string): Promise<Partial<StoredQueue>>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete the queue for a guild
|
|
24
|
+
* @param guildId The guild ID
|
|
25
|
+
* @returns The queue for the guild
|
|
26
|
+
*/
|
|
39
27
|
delete(guildId: string): Promise<unknown>;
|
|
40
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Set the queue for a guild
|
|
30
|
+
* @param guildId The guild ID
|
|
31
|
+
* @param valueToStringify The queue to set
|
|
32
|
+
* @returns The queue for the guild
|
|
33
|
+
*/
|
|
34
|
+
set(guildId: string, valueToStringify: StoredQueue): Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Sync the queue for a guild
|
|
37
|
+
* @param guildId The guild ID
|
|
38
|
+
* @returns The queue for the guild
|
|
39
|
+
*/
|
|
41
40
|
sync(guildId: string): Promise<Partial<StoredQueue>>;
|
|
42
41
|
}
|
|
43
42
|
export declare class DefaultQueueStore implements QueueStoreManager {
|
|
44
43
|
private data;
|
|
45
44
|
constructor();
|
|
45
|
+
/**
|
|
46
|
+
* Get the queue for a guild
|
|
47
|
+
* @param guildId The guild ID
|
|
48
|
+
* @returns The queue for the guild
|
|
49
|
+
*/
|
|
46
50
|
get(guildId: any): Promise<unknown>;
|
|
47
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Set the queue for a guild
|
|
53
|
+
* @param guildId The guild ID
|
|
54
|
+
* @param valueToStringify The queue to set
|
|
55
|
+
* @returns The queue for the guild
|
|
56
|
+
*/
|
|
57
|
+
set(guildId: any, valueToStringify: any): Promise<MiniMap<unknown, unknown>>;
|
|
58
|
+
/**
|
|
59
|
+
* Delete the queue for a guild
|
|
60
|
+
* @param guildId The guild ID
|
|
61
|
+
* @returns The queue for the guild
|
|
62
|
+
*/
|
|
48
63
|
delete(guildId: any): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Stringify the queue for a guild
|
|
66
|
+
* @param value The queue to stringify
|
|
67
|
+
* @returns The stringified queue
|
|
68
|
+
*/
|
|
49
69
|
stringify(value: any): Promise<any>;
|
|
70
|
+
/**
|
|
71
|
+
* Parse the queue for a guild
|
|
72
|
+
* @param value The queue to parse
|
|
73
|
+
* @returns The parsed queue
|
|
74
|
+
*/
|
|
50
75
|
parse(value: any): Promise<Partial<StoredQueue>>;
|
|
51
76
|
}
|
|
52
|
-
export interface QueueChangesWatcher {
|
|
53
|
-
/** get a Value (MUST RETURN UNPARSED!) */
|
|
54
|
-
tracksAdd: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => any;
|
|
55
|
-
/** Set a value inside a guildId (MUST BE UNPARSED) */
|
|
56
|
-
tracksRemoved: (guildId: string, tracks: (Track | UnresolvedTrack)[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => any;
|
|
57
|
-
/** Set a value inside a guildId (MUST BE UNPARSED) */
|
|
58
|
-
shuffled: (guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue) => any;
|
|
59
|
-
}
|
|
60
77
|
export declare class Queue {
|
|
61
78
|
readonly tracks: (Track | UnresolvedTrack)[];
|
|
62
79
|
readonly previous: Track[];
|
|
@@ -68,6 +85,13 @@ export declare class Queue {
|
|
|
68
85
|
private readonly QueueSaver;
|
|
69
86
|
private managerUtils;
|
|
70
87
|
private queueChanges;
|
|
88
|
+
/**
|
|
89
|
+
* Create a new Queue
|
|
90
|
+
* @param guildId The guild ID
|
|
91
|
+
* @param data The data to initialize the queue with
|
|
92
|
+
* @param QueueSaver The queue saver to use
|
|
93
|
+
* @param queueOptions
|
|
94
|
+
*/
|
|
71
95
|
constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions);
|
|
72
96
|
/**
|
|
73
97
|
* Utils for a Queue
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { FloatNumber, IntegerNumber } from "./Utils";
|
|
2
|
+
/** The Audio Outputs type */
|
|
3
|
+
export type AudioOutputs = "mono" | "stereo" | "left" | "right";
|
|
4
|
+
/** The "active" / "disabled" Player Filters */
|
|
5
|
+
export interface PlayerFilters {
|
|
6
|
+
/** Sets nightcore to false, and vaporwave to false */
|
|
7
|
+
custom: boolean;
|
|
8
|
+
/** Sets custom to false, and vaporwave to false */
|
|
9
|
+
nightcore: boolean;
|
|
10
|
+
/** Sets custom to false, and nightcore to false */
|
|
11
|
+
vaporwave: boolean;
|
|
12
|
+
/** If rotation filter is enabled / not */
|
|
13
|
+
rotation: boolean;
|
|
14
|
+
/** if karaoke filter is enabled / not */
|
|
15
|
+
karaoke: boolean;
|
|
16
|
+
/** if tremolo filter is enabled / not */
|
|
17
|
+
tremolo: boolean;
|
|
18
|
+
/** if vibrato filter is enabled / not */
|
|
19
|
+
vibrato: boolean;
|
|
20
|
+
lowPass: boolean;
|
|
21
|
+
/** audio Output (default stereo, mono sounds the fullest and best for not-stereo tracks) */
|
|
22
|
+
audioOutput: AudioOutputs;
|
|
23
|
+
/** Lavalink Volume FILTER (not player Volume, think of it as a gain booster) */
|
|
24
|
+
volume: boolean;
|
|
25
|
+
/** Filters for the Lavalink Filter Plugin */
|
|
26
|
+
lavalinkFilterPlugin: {
|
|
27
|
+
/** if echo filter is enabled / not */
|
|
28
|
+
echo: boolean;
|
|
29
|
+
/** if reverb filter is enabled / not */
|
|
30
|
+
reverb: boolean;
|
|
31
|
+
};
|
|
32
|
+
lavalinkLavaDspxPlugin: {
|
|
33
|
+
/** if lowPass filter is enabled / not */
|
|
34
|
+
lowPass: boolean;
|
|
35
|
+
/** if highPass filter is enabled / not */
|
|
36
|
+
highPass: boolean;
|
|
37
|
+
/** if normalization filter is enabled / not */
|
|
38
|
+
normalization: boolean;
|
|
39
|
+
/** if echo filter is enabled / not */
|
|
40
|
+
echo: boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* There are 15 bands (0-14) that can be changed.
|
|
45
|
+
* "gain" is the multiplier for the given band.
|
|
46
|
+
* The default value is 0.
|
|
47
|
+
* Valid values range from -0.25 to 1.0, where -0.25 means the given band is completely muted, and 0.25 means it is doubled.
|
|
48
|
+
* Modifying the gain could also change the volume of the output.
|
|
49
|
+
*/
|
|
50
|
+
export interface EQBand {
|
|
51
|
+
/** On what band position (0-14) it should work */
|
|
52
|
+
band: IntegerNumber | number;
|
|
53
|
+
/** The gain (-0.25 to 1.0) */
|
|
54
|
+
gain: FloatNumber | number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Uses equalization to eliminate part of a band, usually targeting vocals.
|
|
58
|
+
*/
|
|
59
|
+
export interface KaraokeFilter {
|
|
60
|
+
/** The level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
61
|
+
level?: number;
|
|
62
|
+
/** The mono level (0 to 1.0 where 0.0 is no effect and 1.0 is full effect) */
|
|
63
|
+
monoLevel?: number;
|
|
64
|
+
/** The filter band (in Hz) */
|
|
65
|
+
filterBand?: number;
|
|
66
|
+
/** The filter width */
|
|
67
|
+
filterWidth?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Changes the speed, pitch, and rate
|
|
71
|
+
*/
|
|
72
|
+
export interface TimescaleFilter {
|
|
73
|
+
/** The playback speed 0.0 ≤ x */
|
|
74
|
+
speed?: number;
|
|
75
|
+
/** The pitch 0.0 ≤ x */
|
|
76
|
+
pitch?: number;
|
|
77
|
+
/** The rate 0.0 ≤ x */
|
|
78
|
+
rate?: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Uses amplification to create a shuddering effect, where the volume quickly oscillates.
|
|
82
|
+
* Demo: https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv
|
|
83
|
+
*/
|
|
84
|
+
export interface TremoloFilter {
|
|
85
|
+
/** The frequency 0.0 < x */
|
|
86
|
+
frequency?: number;
|
|
87
|
+
/** The tremolo depth 0.0 < x ≤ 1.0 */
|
|
88
|
+
depth?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Similar to tremolo. While tremolo oscillates the volume, vibrato oscillates the pitch.
|
|
92
|
+
*/
|
|
93
|
+
export interface VibratoFilter {
|
|
94
|
+
/** The frequency 0.0 < x ≤ 14.0 */
|
|
95
|
+
frequency?: number;
|
|
96
|
+
/** The vibrato depth 0.0 < x ≤ 1.0 */
|
|
97
|
+
depth?: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Rotates the sound around the stereo channels/user headphones (aka Audio Panning).
|
|
101
|
+
* It can produce an effect similar to https://youtu.be/QB9EB8mTKcc (without the reverb).
|
|
102
|
+
*/
|
|
103
|
+
export interface RotationFilter {
|
|
104
|
+
/** The frequency of the audio rotating around the listener in Hz. 0.2 is similar to the example video above */
|
|
105
|
+
rotationHz?: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Distortion effect. It can generate some pretty unique audio effects.
|
|
109
|
+
*/
|
|
110
|
+
export interface DistortionFilter {
|
|
111
|
+
sinOffset?: number;
|
|
112
|
+
sinScale?: number;
|
|
113
|
+
cosOffset?: number;
|
|
114
|
+
cosScale?: number;
|
|
115
|
+
tanOffset?: number;
|
|
116
|
+
tanScale?: number;
|
|
117
|
+
offset?: number;
|
|
118
|
+
scale?: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
|
|
122
|
+
* With the defaults, both channels are kept independent of each other.
|
|
123
|
+
* Setting all factors to 0.5 means both channels get the same audio.
|
|
124
|
+
*/
|
|
125
|
+
export interface ChannelMixFilter {
|
|
126
|
+
/** The left to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
127
|
+
leftToLeft?: number;
|
|
128
|
+
/** The left to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
129
|
+
leftToRight?: number;
|
|
130
|
+
/** The right to left channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
131
|
+
rightToLeft?: number;
|
|
132
|
+
/** The right to right channel mix factor (0.0 ≤ x ≤ 1.0) */
|
|
133
|
+
rightToRight?: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Higher frequencies get suppressed, while lower frequencies pass through this filter, thus the name low pass.
|
|
137
|
+
* Any smoothing values equal to or less than 1.0 will disable the filter.
|
|
138
|
+
*/
|
|
139
|
+
export interface LowPassFilter {
|
|
140
|
+
/** The smoothing factor (1.0 < x) */
|
|
141
|
+
smoothing?: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Filter Data stored in the Client and partially sent to Lavalink
|
|
145
|
+
*/
|
|
146
|
+
export interface FilterData {
|
|
147
|
+
volume?: number;
|
|
148
|
+
karaoke?: KaraokeFilter;
|
|
149
|
+
timescale?: TimescaleFilter;
|
|
150
|
+
tremolo?: TremoloFilter;
|
|
151
|
+
vibrato?: VibratoFilter;
|
|
152
|
+
rotation?: RotationFilter;
|
|
153
|
+
distortion?: DistortionFilter;
|
|
154
|
+
channelMix?: ChannelMixFilter;
|
|
155
|
+
lowPass?: LowPassFilter;
|
|
156
|
+
pluginFilters?: {
|
|
157
|
+
"lavalink-filter-plugin"?: {
|
|
158
|
+
"echo"?: {
|
|
159
|
+
delay?: number;
|
|
160
|
+
decay?: number;
|
|
161
|
+
};
|
|
162
|
+
"reverb"?: {
|
|
163
|
+
delays?: number[];
|
|
164
|
+
gains?: number[];
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
"high-pass"?: {
|
|
168
|
+
cutoffFrequency?: number;
|
|
169
|
+
boostFactor?: number;
|
|
170
|
+
};
|
|
171
|
+
"low-pass"?: {
|
|
172
|
+
cutoffFrequency?: number;
|
|
173
|
+
boostFactor?: number;
|
|
174
|
+
};
|
|
175
|
+
normalization?: {
|
|
176
|
+
maxAmplitude?: number;
|
|
177
|
+
adaptive?: boolean;
|
|
178
|
+
};
|
|
179
|
+
echo?: {
|
|
180
|
+
echoLength?: number;
|
|
181
|
+
decay?: number;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Actual Filter Data sent to Lavalink
|
|
187
|
+
*/
|
|
188
|
+
export interface LavalinkFilterData extends FilterData {
|
|
189
|
+
equalizer?: EQBand[];
|
|
190
|
+
}
|