lavalink-client 1.1.21 → 1.1.22
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/Filters.d.ts +3 -3
- package/dist/cjs/structures/LavalinkManager.d.ts +4 -4
- package/dist/cjs/structures/LavalinkManager.js +7 -7
- package/dist/cjs/structures/LavalinkManagerStatics.js +7 -0
- package/dist/cjs/structures/Player.d.ts +22 -12
- package/dist/cjs/structures/Player.js +14 -12
- package/dist/cjs/structures/Utils.d.ts +9 -2
- package/dist/cjs/structures/Utils.js +7 -3
- package/dist/esm/structures/Filters.d.ts +3 -3
- package/dist/esm/structures/LavalinkManager.d.ts +4 -4
- package/dist/esm/structures/LavalinkManager.js +7 -7
- package/dist/esm/structures/LavalinkManagerStatics.js +7 -0
- package/dist/esm/structures/Player.d.ts +22 -12
- package/dist/esm/structures/Player.js +14 -12
- package/dist/esm/structures/Utils.d.ts +9 -2
- package/dist/esm/structures/Utils.js +7 -3
- package/dist/types/structures/Filters.d.ts +3 -3
- package/dist/types/structures/LavalinkManager.d.ts +4 -4
- package/dist/types/structures/Player.d.ts +22 -12
- package/dist/types/structures/Utils.d.ts +9 -2
- package/package.json +1 -1
|
@@ -296,11 +296,11 @@ export interface FilterData {
|
|
|
296
296
|
}
|
|
297
297
|
export type PluginFiltersKey = "lavalink-filter-plugin" | string;
|
|
298
298
|
export interface PluginFiltersValues extends LavalinkFiltersPlugin {
|
|
299
|
-
[key: string]:
|
|
299
|
+
[key: string]: string | number | string[] | number[] | EchoFilter | ReverbFilter;
|
|
300
300
|
}
|
|
301
301
|
export interface LavalinkFiltersPlugin {
|
|
302
|
-
echo: EchoFilter;
|
|
303
|
-
reverb: ReverbFilter;
|
|
302
|
+
"echo": EchoFilter;
|
|
303
|
+
"reverb": ReverbFilter;
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* Actual Filter Data sent to Lavalink
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
|
-
import { NodeManager } from "./NodeManager";
|
|
4
|
-
import { ManagerQueueOptions } from "./Queue";
|
|
5
|
-
import { GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
6
3
|
import { LavalinkNodeOptions } from "./Node";
|
|
4
|
+
import { NodeManager } from "./NodeManager";
|
|
7
5
|
import { DestroyReasonsType, Player, PlayerJson, PlayerOptions } from "./Player";
|
|
6
|
+
import { ManagerQueueOptions } from "./Queue";
|
|
8
7
|
import { Track, UnresolvedTrack } from "./Track";
|
|
8
|
+
import { ChannelDeletePacket, GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
9
9
|
export interface LavalinkManager {
|
|
10
10
|
nodeManager: NodeManager;
|
|
11
11
|
utils: ManagerUtils;
|
|
@@ -145,6 +145,6 @@ export declare class LavalinkManager extends EventEmitter {
|
|
|
145
145
|
* Sends voice data to the Lavalink server.
|
|
146
146
|
* @param data
|
|
147
147
|
*/
|
|
148
|
-
sendRawData(data: VoicePacket | VoiceServer | VoiceState |
|
|
148
|
+
sendRawData(data: VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket): Promise<void>;
|
|
149
149
|
}
|
|
150
150
|
export {};
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LavalinkManager = void 0;
|
|
4
4
|
const events_1 = require("events");
|
|
5
|
+
const LavalinkManagerStatics_1 = require("./LavalinkManagerStatics");
|
|
5
6
|
const NodeManager_1 = require("./NodeManager");
|
|
7
|
+
const Player_1 = require("./Player");
|
|
6
8
|
const Queue_1 = require("./Queue");
|
|
7
9
|
const Utils_1 = require("./Utils");
|
|
8
|
-
const LavalinkManagerStatics_1 = require("./LavalinkManagerStatics");
|
|
9
|
-
const Player_1 = require("./Player");
|
|
10
10
|
class LavalinkManager extends events_1.EventEmitter {
|
|
11
11
|
static DefaultSources = LavalinkManagerStatics_1.DefaultSources;
|
|
12
12
|
static SourceLinksRegexes = LavalinkManagerStatics_1.SourceLinksRegexes;
|
|
@@ -156,11 +156,11 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
156
156
|
return;
|
|
157
157
|
const player = this.getPlayer(update.guild_id);
|
|
158
158
|
if (player && player.voiceChannelId === update.id)
|
|
159
|
-
return player.destroy(Player_1.DestroyReasons.ChannelDeleted);
|
|
159
|
+
return void player.destroy(Player_1.DestroyReasons.ChannelDeleted);
|
|
160
160
|
}
|
|
161
161
|
// for voice updates
|
|
162
162
|
if (["VOICE_STATE_UPDATE", "VOICE_SERVER_UPDATE"].includes(data.t)) {
|
|
163
|
-
const update = "d" in data ? data.d : data;
|
|
163
|
+
const update = ("d" in data ? data.d : data);
|
|
164
164
|
if (!update) {
|
|
165
165
|
if (this.options?.debugOptions?.noAudio === true)
|
|
166
166
|
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, no update data found in payload:", data);
|
|
@@ -208,7 +208,7 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
208
208
|
}
|
|
209
209
|
else {
|
|
210
210
|
if (this.options?.playerOptions?.onDisconnect?.destroyPlayer === true) {
|
|
211
|
-
return await player.destroy(Player_1.DestroyReasons.Disconnected);
|
|
211
|
+
return void await player.destroy(Player_1.DestroyReasons.Disconnected);
|
|
212
212
|
}
|
|
213
213
|
this.emit("playerDisconnect", player, player.voiceChannelId);
|
|
214
214
|
if (!player.paused)
|
|
@@ -218,9 +218,9 @@ class LavalinkManager extends events_1.EventEmitter {
|
|
|
218
218
|
await player.connect();
|
|
219
219
|
}
|
|
220
220
|
catch {
|
|
221
|
-
return await player.destroy(Player_1.DestroyReasons.PlayerReconnectFail);
|
|
221
|
+
return void await player.destroy(Player_1.DestroyReasons.PlayerReconnectFail);
|
|
222
222
|
}
|
|
223
|
-
return player.paused && await player.resume();
|
|
223
|
+
return void player.paused && await player.resume();
|
|
224
224
|
}
|
|
225
225
|
player.voiceChannelId = null;
|
|
226
226
|
player.voice = Object.assign({});
|
|
@@ -7,6 +7,8 @@ exports.DefaultSources = {
|
|
|
7
7
|
"youtubemusic": "ytmsearch",
|
|
8
8
|
"ytmsearch": "ytmsearch",
|
|
9
9
|
"ytm": "ytmsearch",
|
|
10
|
+
"musicyoutube": "ytmsearch",
|
|
11
|
+
"music youtube": "ytmsearch",
|
|
10
12
|
// youtube
|
|
11
13
|
"youtube": "ytsearch",
|
|
12
14
|
"yt": "ytsearch",
|
|
@@ -21,10 +23,14 @@ exports.DefaultSources = {
|
|
|
21
23
|
"applemusic": "amsearch",
|
|
22
24
|
"amsearch": "amsearch",
|
|
23
25
|
"am": "amsearch",
|
|
26
|
+
"musicapple": "amsearch",
|
|
27
|
+
"music apple": "amsearch",
|
|
24
28
|
// spotify
|
|
25
29
|
"spotify": "spsearch",
|
|
26
30
|
"spsearch": "spsearch",
|
|
27
31
|
"sp": "spsearch",
|
|
32
|
+
"spotify.com": "spsearch",
|
|
33
|
+
"spotifycom": "spsearch",
|
|
28
34
|
"sprec": "sprec",
|
|
29
35
|
"spsuggestion": "sprec",
|
|
30
36
|
// deezer
|
|
@@ -43,6 +49,7 @@ exports.DefaultSources = {
|
|
|
43
49
|
"ftts": "ftts",
|
|
44
50
|
// Client sided search platforms
|
|
45
51
|
"bandcamp": "bcsearch",
|
|
52
|
+
"bc": "bcsearch",
|
|
46
53
|
"bcsearch": "bcsearch",
|
|
47
54
|
};
|
|
48
55
|
exports.LavalinkPlugins = {
|
|
@@ -30,15 +30,25 @@ export interface PlayerJson {
|
|
|
30
30
|
}
|
|
31
31
|
export type RepeatMode = "queue" | "track" | "off";
|
|
32
32
|
export interface PlayerOptions {
|
|
33
|
+
/** Guild id of the player */
|
|
33
34
|
guildId: string;
|
|
35
|
+
/** The Voice Channel Id */
|
|
34
36
|
voiceChannelId: string;
|
|
37
|
+
/** The Text Channel Id of the Player */
|
|
38
|
+
textChannelId?: string;
|
|
39
|
+
/** instantly change volume with the one play request */
|
|
35
40
|
volume?: number;
|
|
41
|
+
/** VC Region for node selections */
|
|
36
42
|
vcRegion?: string;
|
|
43
|
+
/** if it should join deafened */
|
|
37
44
|
selfDeaf?: boolean;
|
|
45
|
+
/** If it should join muted */
|
|
38
46
|
selfMute?: boolean;
|
|
39
|
-
|
|
47
|
+
/** If it should use a specific lavalink node */
|
|
40
48
|
node?: LavalinkNode | string;
|
|
49
|
+
/** If when applying filters, it should use the insta apply filters fix */
|
|
41
50
|
instaUpdateFiltersFix?: boolean;
|
|
51
|
+
/** If a volume should be applied via filters instead of lavalink-volume */
|
|
42
52
|
applyVolumeAsFilter?: boolean;
|
|
43
53
|
}
|
|
44
54
|
export interface PlayOptions {
|
|
@@ -113,7 +123,7 @@ export declare class Player {
|
|
|
113
123
|
* @param key
|
|
114
124
|
* @param value
|
|
115
125
|
*/
|
|
116
|
-
set(key: string, value: unknown):
|
|
126
|
+
set(key: string, value: unknown): this;
|
|
117
127
|
/**
|
|
118
128
|
* Get custom data.
|
|
119
129
|
* @param key
|
|
@@ -122,7 +132,7 @@ export declare class Player {
|
|
|
122
132
|
/**
|
|
123
133
|
* CLears all the custom data.
|
|
124
134
|
*/
|
|
125
|
-
clearData():
|
|
135
|
+
clearData(): this;
|
|
126
136
|
/**
|
|
127
137
|
* Get all custom Data
|
|
128
138
|
*/
|
|
@@ -137,32 +147,32 @@ export declare class Player {
|
|
|
137
147
|
* @param volume The Volume in percent
|
|
138
148
|
* @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
|
|
139
149
|
*/
|
|
140
|
-
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<
|
|
150
|
+
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
|
|
141
151
|
lavaSearch(query: LavaSearchQuery, requestUser: unknown): Promise<import("./Utils").SearchResult | import("./Utils").LavaSearchResponse>;
|
|
142
152
|
/**
|
|
143
153
|
*
|
|
144
154
|
* @param query Query for your data
|
|
145
155
|
* @param requestUser
|
|
146
156
|
*/
|
|
147
|
-
search(query: SearchQuery, requestUser: unknown): Promise<import("./Utils").
|
|
157
|
+
search(query: SearchQuery, requestUser: unknown): Promise<import("./Utils").UnresolvedSearchResult | import("./Utils").SearchResult>;
|
|
148
158
|
/**
|
|
149
159
|
* Pause the player
|
|
150
160
|
*/
|
|
151
|
-
pause(): Promise<
|
|
161
|
+
pause(): Promise<this>;
|
|
152
162
|
/**
|
|
153
163
|
* Resume the Player
|
|
154
164
|
*/
|
|
155
|
-
resume(): Promise<
|
|
165
|
+
resume(): Promise<this>;
|
|
156
166
|
/**
|
|
157
167
|
* Seek to a specific Position
|
|
158
168
|
* @param position
|
|
159
169
|
*/
|
|
160
|
-
seek(position: number): Promise<
|
|
170
|
+
seek(position: number): Promise<this>;
|
|
161
171
|
/**
|
|
162
172
|
* Set the Repeatmode of the Player
|
|
163
173
|
* @param repeatMode
|
|
164
174
|
*/
|
|
165
|
-
setRepeatMode(repeatMode: RepeatMode): Promise<
|
|
175
|
+
setRepeatMode(repeatMode: RepeatMode): Promise<this>;
|
|
166
176
|
/**
|
|
167
177
|
* Skip the current song, or a specific amount of songs
|
|
168
178
|
* @param amount provide the index of the next track to skip to
|
|
@@ -172,17 +182,17 @@ export declare class Player {
|
|
|
172
182
|
* Connects the Player to the Voice Channel
|
|
173
183
|
* @returns
|
|
174
184
|
*/
|
|
175
|
-
connect(): Promise<
|
|
185
|
+
connect(): Promise<this>;
|
|
176
186
|
/**
|
|
177
187
|
* Disconnects the Player from the Voice Channel, but keeps the player in the cache
|
|
178
188
|
* @param force If false it throws an error, if player thinks it's already disconnected
|
|
179
189
|
* @returns
|
|
180
190
|
*/
|
|
181
|
-
disconnect(force?: boolean): Promise<
|
|
191
|
+
disconnect(force?: boolean): Promise<this>;
|
|
182
192
|
/**
|
|
183
193
|
* Destroy the player and disconnect from the voice channel
|
|
184
194
|
*/
|
|
185
|
-
destroy(reason?: string): Promise<
|
|
195
|
+
destroy(reason?: string): Promise<this>;
|
|
186
196
|
/**
|
|
187
197
|
* Move the player on a different Audio-Node
|
|
188
198
|
* @param newNode New Node / New Node Id
|
|
@@ -91,7 +91,7 @@ class Player {
|
|
|
91
91
|
*/
|
|
92
92
|
set(key, value) {
|
|
93
93
|
this.data[key] = value;
|
|
94
|
-
return;
|
|
94
|
+
return this;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Get custom data.
|
|
@@ -110,7 +110,7 @@ class Player {
|
|
|
110
110
|
continue;
|
|
111
111
|
delete this.data[key];
|
|
112
112
|
}
|
|
113
|
-
return;
|
|
113
|
+
return this;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Get all custom Data
|
|
@@ -148,7 +148,7 @@ class Player {
|
|
|
148
148
|
delete options.encodedTrack;
|
|
149
149
|
if (this.queue.tracks[0])
|
|
150
150
|
return this.play(options);
|
|
151
|
-
return;
|
|
151
|
+
return this;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
const track = this.queue.current;
|
|
@@ -187,6 +187,7 @@ class Player {
|
|
|
187
187
|
playerOptions: finalOptions,
|
|
188
188
|
});
|
|
189
189
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
190
|
+
return this;
|
|
190
191
|
}
|
|
191
192
|
/**
|
|
192
193
|
* Set the Volume for the Player
|
|
@@ -209,7 +210,7 @@ class Player {
|
|
|
209
210
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { volume: this.lavalinkVolume } });
|
|
210
211
|
}
|
|
211
212
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
212
|
-
return;
|
|
213
|
+
return this;
|
|
213
214
|
}
|
|
214
215
|
async lavaSearch(query, requestUser) {
|
|
215
216
|
return this.node.lavaSearch(query, requestUser);
|
|
@@ -239,7 +240,7 @@ class Player {
|
|
|
239
240
|
const now = performance.now();
|
|
240
241
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { paused: true } });
|
|
241
242
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
242
|
-
return;
|
|
243
|
+
return this;
|
|
243
244
|
}
|
|
244
245
|
/**
|
|
245
246
|
* Resume the Player
|
|
@@ -251,7 +252,7 @@ class Player {
|
|
|
251
252
|
const now = performance.now();
|
|
252
253
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { paused: false } });
|
|
253
254
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
254
|
-
return;
|
|
255
|
+
return this;
|
|
255
256
|
}
|
|
256
257
|
/**
|
|
257
258
|
* Seek to a specific Position
|
|
@@ -272,7 +273,7 @@ class Player {
|
|
|
272
273
|
const now = performance.now();
|
|
273
274
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { position } });
|
|
274
275
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
275
|
-
return;
|
|
276
|
+
return this;
|
|
276
277
|
}
|
|
277
278
|
/**
|
|
278
279
|
* Set the Repeatmode of the Player
|
|
@@ -281,7 +282,8 @@ class Player {
|
|
|
281
282
|
async setRepeatMode(repeatMode) {
|
|
282
283
|
if (!["off", "track", "queue"].includes(repeatMode))
|
|
283
284
|
throw new RangeError("Repeatmode must be either 'off', 'track', or 'queue'");
|
|
284
|
-
|
|
285
|
+
this.repeatMode = repeatMode;
|
|
286
|
+
return this;
|
|
285
287
|
}
|
|
286
288
|
/**
|
|
287
289
|
* Skip the current song, or a specific amount of songs
|
|
@@ -300,7 +302,7 @@ class Player {
|
|
|
300
302
|
const now = performance.now();
|
|
301
303
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { encodedTrack: null } });
|
|
302
304
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
303
|
-
return
|
|
305
|
+
return this;
|
|
304
306
|
}
|
|
305
307
|
/**
|
|
306
308
|
* Connects the Player to the Voice Channel
|
|
@@ -318,7 +320,7 @@ class Player {
|
|
|
318
320
|
self_deaf: this.options.selfDeaf ?? true,
|
|
319
321
|
}
|
|
320
322
|
});
|
|
321
|
-
return;
|
|
323
|
+
return this;
|
|
322
324
|
}
|
|
323
325
|
/**
|
|
324
326
|
* Disconnects the Player from the Voice Channel, but keeps the player in the cache
|
|
@@ -338,7 +340,7 @@ class Player {
|
|
|
338
340
|
}
|
|
339
341
|
});
|
|
340
342
|
this.voiceChannelId = null;
|
|
341
|
-
return;
|
|
343
|
+
return this;
|
|
342
344
|
}
|
|
343
345
|
/**
|
|
344
346
|
* Destroy the player and disconnect from the voice channel
|
|
@@ -349,7 +351,7 @@ class Player {
|
|
|
349
351
|
this.LavalinkManager.deletePlayer(this.guildId);
|
|
350
352
|
await this.node.destroyPlayer(this.guildId);
|
|
351
353
|
this.LavalinkManager.emit("playerDestroy", this, reason);
|
|
352
|
-
return;
|
|
354
|
+
return this;
|
|
353
355
|
}
|
|
354
356
|
/**
|
|
355
357
|
* Move the player on a different Audio-Node
|
|
@@ -16,9 +16,9 @@ export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzs
|
|
|
16
16
|
export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
|
|
17
17
|
export type DuncteSearchPlatform = "speak" | "tts";
|
|
18
18
|
export type LavalinkClientSearchPlatform = "bcsearch";
|
|
19
|
-
export type LavalinkClientSearchPlatformResolve = "bandcamp";
|
|
19
|
+
export type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
|
|
20
20
|
export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | LavalinkClientSearchPlatform;
|
|
21
|
-
export type ClientSearchPlatform = "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "sp" | "spsuggestion" | "spotify" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
|
|
21
|
+
export type ClientSearchPlatform = "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" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
|
|
22
22
|
export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
23
23
|
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";
|
|
24
24
|
export interface PlaylistInfo {
|
|
@@ -283,6 +283,13 @@ export interface LavalinkPlayer {
|
|
|
283
283
|
voice: LavalinkPlayerVoice;
|
|
284
284
|
filters: Partial<LavalinkFilterData>;
|
|
285
285
|
}
|
|
286
|
+
export interface ChannelDeletePacket {
|
|
287
|
+
t: "CHANNEL_DELETE";
|
|
288
|
+
d: {
|
|
289
|
+
guild_id: string;
|
|
290
|
+
id: string;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
286
293
|
export interface VoiceState {
|
|
287
294
|
op: "voiceUpdate";
|
|
288
295
|
guildId: string;
|
|
@@ -66,9 +66,13 @@ class ManagerUtils {
|
|
|
66
66
|
const closest = await getClosestTrack(this, player);
|
|
67
67
|
if (!closest)
|
|
68
68
|
throw new SyntaxError("No closest Track found");
|
|
69
|
-
Object.getOwnPropertyNames(this)
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
for (const prop of Object.getOwnPropertyNames(this))
|
|
70
|
+
delete this[prop];
|
|
71
|
+
// delete symbol
|
|
72
|
+
delete this[exports.UnresolvedTrackSymbol];
|
|
73
|
+
// assign new symbol
|
|
74
|
+
Object.defineProperty(this, exports.TrackSymbol, { configurable: true, value: true });
|
|
75
|
+
return Object.assign(this, closest);
|
|
72
76
|
}
|
|
73
77
|
};
|
|
74
78
|
if (!this.isUnresolvedTrack(unresolvedTrack))
|
|
@@ -296,11 +296,11 @@ export interface FilterData {
|
|
|
296
296
|
}
|
|
297
297
|
export type PluginFiltersKey = "lavalink-filter-plugin" | string;
|
|
298
298
|
export interface PluginFiltersValues extends LavalinkFiltersPlugin {
|
|
299
|
-
[key: string]:
|
|
299
|
+
[key: string]: string | number | string[] | number[] | EchoFilter | ReverbFilter;
|
|
300
300
|
}
|
|
301
301
|
export interface LavalinkFiltersPlugin {
|
|
302
|
-
echo: EchoFilter;
|
|
303
|
-
reverb: ReverbFilter;
|
|
302
|
+
"echo": EchoFilter;
|
|
303
|
+
"reverb": ReverbFilter;
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* Actual Filter Data sent to Lavalink
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
|
-
import { NodeManager } from "./NodeManager";
|
|
4
|
-
import { ManagerQueueOptions } from "./Queue";
|
|
5
|
-
import { GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
6
3
|
import { LavalinkNodeOptions } from "./Node";
|
|
4
|
+
import { NodeManager } from "./NodeManager";
|
|
7
5
|
import { DestroyReasonsType, Player, PlayerJson, PlayerOptions } from "./Player";
|
|
6
|
+
import { ManagerQueueOptions } from "./Queue";
|
|
8
7
|
import { Track, UnresolvedTrack } from "./Track";
|
|
8
|
+
import { ChannelDeletePacket, GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
9
9
|
export interface LavalinkManager {
|
|
10
10
|
nodeManager: NodeManager;
|
|
11
11
|
utils: ManagerUtils;
|
|
@@ -145,6 +145,6 @@ export declare class LavalinkManager extends EventEmitter {
|
|
|
145
145
|
* Sends voice data to the Lavalink server.
|
|
146
146
|
* @param data
|
|
147
147
|
*/
|
|
148
|
-
sendRawData(data: VoicePacket | VoiceServer | VoiceState |
|
|
148
|
+
sendRawData(data: VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket): Promise<void>;
|
|
149
149
|
}
|
|
150
150
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
+
import { DefaultSources, SourceLinksRegexes } from "./LavalinkManagerStatics";
|
|
2
3
|
import { NodeManager } from "./NodeManager";
|
|
4
|
+
import { DestroyReasons, Player } from "./Player";
|
|
3
5
|
import { DefaultQueueStore } from "./Queue";
|
|
4
6
|
import { ManagerUtils, MiniMap } from "./Utils";
|
|
5
|
-
import { DefaultSources, SourceLinksRegexes } from "./LavalinkManagerStatics";
|
|
6
|
-
import { DestroyReasons, Player } from "./Player";
|
|
7
7
|
export class LavalinkManager extends EventEmitter {
|
|
8
8
|
static DefaultSources = DefaultSources;
|
|
9
9
|
static SourceLinksRegexes = SourceLinksRegexes;
|
|
@@ -153,11 +153,11 @@ export class LavalinkManager extends EventEmitter {
|
|
|
153
153
|
return;
|
|
154
154
|
const player = this.getPlayer(update.guild_id);
|
|
155
155
|
if (player && player.voiceChannelId === update.id)
|
|
156
|
-
return player.destroy(DestroyReasons.ChannelDeleted);
|
|
156
|
+
return void player.destroy(DestroyReasons.ChannelDeleted);
|
|
157
157
|
}
|
|
158
158
|
// for voice updates
|
|
159
159
|
if (["VOICE_STATE_UPDATE", "VOICE_SERVER_UPDATE"].includes(data.t)) {
|
|
160
|
-
const update = "d" in data ? data.d : data;
|
|
160
|
+
const update = ("d" in data ? data.d : data);
|
|
161
161
|
if (!update) {
|
|
162
162
|
if (this.options?.debugOptions?.noAudio === true)
|
|
163
163
|
console.debug("Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, no update data found in payload:", data);
|
|
@@ -205,7 +205,7 @@ export class LavalinkManager extends EventEmitter {
|
|
|
205
205
|
}
|
|
206
206
|
else {
|
|
207
207
|
if (this.options?.playerOptions?.onDisconnect?.destroyPlayer === true) {
|
|
208
|
-
return await player.destroy(DestroyReasons.Disconnected);
|
|
208
|
+
return void await player.destroy(DestroyReasons.Disconnected);
|
|
209
209
|
}
|
|
210
210
|
this.emit("playerDisconnect", player, player.voiceChannelId);
|
|
211
211
|
if (!player.paused)
|
|
@@ -215,9 +215,9 @@ export class LavalinkManager extends EventEmitter {
|
|
|
215
215
|
await player.connect();
|
|
216
216
|
}
|
|
217
217
|
catch {
|
|
218
|
-
return await player.destroy(DestroyReasons.PlayerReconnectFail);
|
|
218
|
+
return void await player.destroy(DestroyReasons.PlayerReconnectFail);
|
|
219
219
|
}
|
|
220
|
-
return player.paused && await player.resume();
|
|
220
|
+
return void player.paused && await player.resume();
|
|
221
221
|
}
|
|
222
222
|
player.voiceChannelId = null;
|
|
223
223
|
player.voice = Object.assign({});
|
|
@@ -4,6 +4,8 @@ export const DefaultSources = {
|
|
|
4
4
|
"youtubemusic": "ytmsearch",
|
|
5
5
|
"ytmsearch": "ytmsearch",
|
|
6
6
|
"ytm": "ytmsearch",
|
|
7
|
+
"musicyoutube": "ytmsearch",
|
|
8
|
+
"music youtube": "ytmsearch",
|
|
7
9
|
// youtube
|
|
8
10
|
"youtube": "ytsearch",
|
|
9
11
|
"yt": "ytsearch",
|
|
@@ -18,10 +20,14 @@ export const DefaultSources = {
|
|
|
18
20
|
"applemusic": "amsearch",
|
|
19
21
|
"amsearch": "amsearch",
|
|
20
22
|
"am": "amsearch",
|
|
23
|
+
"musicapple": "amsearch",
|
|
24
|
+
"music apple": "amsearch",
|
|
21
25
|
// spotify
|
|
22
26
|
"spotify": "spsearch",
|
|
23
27
|
"spsearch": "spsearch",
|
|
24
28
|
"sp": "spsearch",
|
|
29
|
+
"spotify.com": "spsearch",
|
|
30
|
+
"spotifycom": "spsearch",
|
|
25
31
|
"sprec": "sprec",
|
|
26
32
|
"spsuggestion": "sprec",
|
|
27
33
|
// deezer
|
|
@@ -40,6 +46,7 @@ export const DefaultSources = {
|
|
|
40
46
|
"ftts": "ftts",
|
|
41
47
|
// Client sided search platforms
|
|
42
48
|
"bandcamp": "bcsearch",
|
|
49
|
+
"bc": "bcsearch",
|
|
43
50
|
"bcsearch": "bcsearch",
|
|
44
51
|
};
|
|
45
52
|
export const LavalinkPlugins = {
|
|
@@ -30,15 +30,25 @@ export interface PlayerJson {
|
|
|
30
30
|
}
|
|
31
31
|
export type RepeatMode = "queue" | "track" | "off";
|
|
32
32
|
export interface PlayerOptions {
|
|
33
|
+
/** Guild id of the player */
|
|
33
34
|
guildId: string;
|
|
35
|
+
/** The Voice Channel Id */
|
|
34
36
|
voiceChannelId: string;
|
|
37
|
+
/** The Text Channel Id of the Player */
|
|
38
|
+
textChannelId?: string;
|
|
39
|
+
/** instantly change volume with the one play request */
|
|
35
40
|
volume?: number;
|
|
41
|
+
/** VC Region for node selections */
|
|
36
42
|
vcRegion?: string;
|
|
43
|
+
/** if it should join deafened */
|
|
37
44
|
selfDeaf?: boolean;
|
|
45
|
+
/** If it should join muted */
|
|
38
46
|
selfMute?: boolean;
|
|
39
|
-
|
|
47
|
+
/** If it should use a specific lavalink node */
|
|
40
48
|
node?: LavalinkNode | string;
|
|
49
|
+
/** If when applying filters, it should use the insta apply filters fix */
|
|
41
50
|
instaUpdateFiltersFix?: boolean;
|
|
51
|
+
/** If a volume should be applied via filters instead of lavalink-volume */
|
|
42
52
|
applyVolumeAsFilter?: boolean;
|
|
43
53
|
}
|
|
44
54
|
export interface PlayOptions {
|
|
@@ -113,7 +123,7 @@ export declare class Player {
|
|
|
113
123
|
* @param key
|
|
114
124
|
* @param value
|
|
115
125
|
*/
|
|
116
|
-
set(key: string, value: unknown):
|
|
126
|
+
set(key: string, value: unknown): this;
|
|
117
127
|
/**
|
|
118
128
|
* Get custom data.
|
|
119
129
|
* @param key
|
|
@@ -122,7 +132,7 @@ export declare class Player {
|
|
|
122
132
|
/**
|
|
123
133
|
* CLears all the custom data.
|
|
124
134
|
*/
|
|
125
|
-
clearData():
|
|
135
|
+
clearData(): this;
|
|
126
136
|
/**
|
|
127
137
|
* Get all custom Data
|
|
128
138
|
*/
|
|
@@ -137,32 +147,32 @@ export declare class Player {
|
|
|
137
147
|
* @param volume The Volume in percent
|
|
138
148
|
* @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
|
|
139
149
|
*/
|
|
140
|
-
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<
|
|
150
|
+
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
|
|
141
151
|
lavaSearch(query: LavaSearchQuery, requestUser: unknown): Promise<import("./Utils").SearchResult | import("./Utils").LavaSearchResponse>;
|
|
142
152
|
/**
|
|
143
153
|
*
|
|
144
154
|
* @param query Query for your data
|
|
145
155
|
* @param requestUser
|
|
146
156
|
*/
|
|
147
|
-
search(query: SearchQuery, requestUser: unknown): Promise<import("./Utils").
|
|
157
|
+
search(query: SearchQuery, requestUser: unknown): Promise<import("./Utils").UnresolvedSearchResult | import("./Utils").SearchResult>;
|
|
148
158
|
/**
|
|
149
159
|
* Pause the player
|
|
150
160
|
*/
|
|
151
|
-
pause(): Promise<
|
|
161
|
+
pause(): Promise<this>;
|
|
152
162
|
/**
|
|
153
163
|
* Resume the Player
|
|
154
164
|
*/
|
|
155
|
-
resume(): Promise<
|
|
165
|
+
resume(): Promise<this>;
|
|
156
166
|
/**
|
|
157
167
|
* Seek to a specific Position
|
|
158
168
|
* @param position
|
|
159
169
|
*/
|
|
160
|
-
seek(position: number): Promise<
|
|
170
|
+
seek(position: number): Promise<this>;
|
|
161
171
|
/**
|
|
162
172
|
* Set the Repeatmode of the Player
|
|
163
173
|
* @param repeatMode
|
|
164
174
|
*/
|
|
165
|
-
setRepeatMode(repeatMode: RepeatMode): Promise<
|
|
175
|
+
setRepeatMode(repeatMode: RepeatMode): Promise<this>;
|
|
166
176
|
/**
|
|
167
177
|
* Skip the current song, or a specific amount of songs
|
|
168
178
|
* @param amount provide the index of the next track to skip to
|
|
@@ -172,17 +182,17 @@ export declare class Player {
|
|
|
172
182
|
* Connects the Player to the Voice Channel
|
|
173
183
|
* @returns
|
|
174
184
|
*/
|
|
175
|
-
connect(): Promise<
|
|
185
|
+
connect(): Promise<this>;
|
|
176
186
|
/**
|
|
177
187
|
* Disconnects the Player from the Voice Channel, but keeps the player in the cache
|
|
178
188
|
* @param force If false it throws an error, if player thinks it's already disconnected
|
|
179
189
|
* @returns
|
|
180
190
|
*/
|
|
181
|
-
disconnect(force?: boolean): Promise<
|
|
191
|
+
disconnect(force?: boolean): Promise<this>;
|
|
182
192
|
/**
|
|
183
193
|
* Destroy the player and disconnect from the voice channel
|
|
184
194
|
*/
|
|
185
|
-
destroy(reason?: string): Promise<
|
|
195
|
+
destroy(reason?: string): Promise<this>;
|
|
186
196
|
/**
|
|
187
197
|
* Move the player on a different Audio-Node
|
|
188
198
|
* @param newNode New Node / New Node Id
|
|
@@ -88,7 +88,7 @@ export class Player {
|
|
|
88
88
|
*/
|
|
89
89
|
set(key, value) {
|
|
90
90
|
this.data[key] = value;
|
|
91
|
-
return;
|
|
91
|
+
return this;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Get custom data.
|
|
@@ -107,7 +107,7 @@ export class Player {
|
|
|
107
107
|
continue;
|
|
108
108
|
delete this.data[key];
|
|
109
109
|
}
|
|
110
|
-
return;
|
|
110
|
+
return this;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* Get all custom Data
|
|
@@ -145,7 +145,7 @@ export class Player {
|
|
|
145
145
|
delete options.encodedTrack;
|
|
146
146
|
if (this.queue.tracks[0])
|
|
147
147
|
return this.play(options);
|
|
148
|
-
return;
|
|
148
|
+
return this;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
const track = this.queue.current;
|
|
@@ -184,6 +184,7 @@ export class Player {
|
|
|
184
184
|
playerOptions: finalOptions,
|
|
185
185
|
});
|
|
186
186
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
187
|
+
return this;
|
|
187
188
|
}
|
|
188
189
|
/**
|
|
189
190
|
* Set the Volume for the Player
|
|
@@ -206,7 +207,7 @@ export class Player {
|
|
|
206
207
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { volume: this.lavalinkVolume } });
|
|
207
208
|
}
|
|
208
209
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
209
|
-
return;
|
|
210
|
+
return this;
|
|
210
211
|
}
|
|
211
212
|
async lavaSearch(query, requestUser) {
|
|
212
213
|
return this.node.lavaSearch(query, requestUser);
|
|
@@ -236,7 +237,7 @@ export class Player {
|
|
|
236
237
|
const now = performance.now();
|
|
237
238
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { paused: true } });
|
|
238
239
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
239
|
-
return;
|
|
240
|
+
return this;
|
|
240
241
|
}
|
|
241
242
|
/**
|
|
242
243
|
* Resume the Player
|
|
@@ -248,7 +249,7 @@ export class Player {
|
|
|
248
249
|
const now = performance.now();
|
|
249
250
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { paused: false } });
|
|
250
251
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
251
|
-
return;
|
|
252
|
+
return this;
|
|
252
253
|
}
|
|
253
254
|
/**
|
|
254
255
|
* Seek to a specific Position
|
|
@@ -269,7 +270,7 @@ export class Player {
|
|
|
269
270
|
const now = performance.now();
|
|
270
271
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { position } });
|
|
271
272
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
272
|
-
return;
|
|
273
|
+
return this;
|
|
273
274
|
}
|
|
274
275
|
/**
|
|
275
276
|
* Set the Repeatmode of the Player
|
|
@@ -278,7 +279,8 @@ export class Player {
|
|
|
278
279
|
async setRepeatMode(repeatMode) {
|
|
279
280
|
if (!["off", "track", "queue"].includes(repeatMode))
|
|
280
281
|
throw new RangeError("Repeatmode must be either 'off', 'track', or 'queue'");
|
|
281
|
-
|
|
282
|
+
this.repeatMode = repeatMode;
|
|
283
|
+
return this;
|
|
282
284
|
}
|
|
283
285
|
/**
|
|
284
286
|
* Skip the current song, or a specific amount of songs
|
|
@@ -297,7 +299,7 @@ export class Player {
|
|
|
297
299
|
const now = performance.now();
|
|
298
300
|
await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { encodedTrack: null } });
|
|
299
301
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
300
|
-
return
|
|
302
|
+
return this;
|
|
301
303
|
}
|
|
302
304
|
/**
|
|
303
305
|
* Connects the Player to the Voice Channel
|
|
@@ -315,7 +317,7 @@ export class Player {
|
|
|
315
317
|
self_deaf: this.options.selfDeaf ?? true,
|
|
316
318
|
}
|
|
317
319
|
});
|
|
318
|
-
return;
|
|
320
|
+
return this;
|
|
319
321
|
}
|
|
320
322
|
/**
|
|
321
323
|
* Disconnects the Player from the Voice Channel, but keeps the player in the cache
|
|
@@ -335,7 +337,7 @@ export class Player {
|
|
|
335
337
|
}
|
|
336
338
|
});
|
|
337
339
|
this.voiceChannelId = null;
|
|
338
|
-
return;
|
|
340
|
+
return this;
|
|
339
341
|
}
|
|
340
342
|
/**
|
|
341
343
|
* Destroy the player and disconnect from the voice channel
|
|
@@ -346,7 +348,7 @@ export class Player {
|
|
|
346
348
|
this.LavalinkManager.deletePlayer(this.guildId);
|
|
347
349
|
await this.node.destroyPlayer(this.guildId);
|
|
348
350
|
this.LavalinkManager.emit("playerDestroy", this, reason);
|
|
349
|
-
return;
|
|
351
|
+
return this;
|
|
350
352
|
}
|
|
351
353
|
/**
|
|
352
354
|
* Move the player on a different Audio-Node
|
|
@@ -16,9 +16,9 @@ export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzs
|
|
|
16
16
|
export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
|
|
17
17
|
export type DuncteSearchPlatform = "speak" | "tts";
|
|
18
18
|
export type LavalinkClientSearchPlatform = "bcsearch";
|
|
19
|
-
export type LavalinkClientSearchPlatformResolve = "bandcamp";
|
|
19
|
+
export type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
|
|
20
20
|
export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | LavalinkClientSearchPlatform;
|
|
21
|
-
export type ClientSearchPlatform = "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "sp" | "spsuggestion" | "spotify" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
|
|
21
|
+
export type ClientSearchPlatform = "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" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
|
|
22
22
|
export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
23
23
|
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";
|
|
24
24
|
export interface PlaylistInfo {
|
|
@@ -283,6 +283,13 @@ export interface LavalinkPlayer {
|
|
|
283
283
|
voice: LavalinkPlayerVoice;
|
|
284
284
|
filters: Partial<LavalinkFilterData>;
|
|
285
285
|
}
|
|
286
|
+
export interface ChannelDeletePacket {
|
|
287
|
+
t: "CHANNEL_DELETE";
|
|
288
|
+
d: {
|
|
289
|
+
guild_id: string;
|
|
290
|
+
id: string;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
286
293
|
export interface VoiceState {
|
|
287
294
|
op: "voiceUpdate";
|
|
288
295
|
guildId: string;
|
|
@@ -63,9 +63,13 @@ export class ManagerUtils {
|
|
|
63
63
|
const closest = await getClosestTrack(this, player);
|
|
64
64
|
if (!closest)
|
|
65
65
|
throw new SyntaxError("No closest Track found");
|
|
66
|
-
Object.getOwnPropertyNames(this)
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
for (const prop of Object.getOwnPropertyNames(this))
|
|
67
|
+
delete this[prop];
|
|
68
|
+
// delete symbol
|
|
69
|
+
delete this[UnresolvedTrackSymbol];
|
|
70
|
+
// assign new symbol
|
|
71
|
+
Object.defineProperty(this, TrackSymbol, { configurable: true, value: true });
|
|
72
|
+
return Object.assign(this, closest);
|
|
69
73
|
}
|
|
70
74
|
};
|
|
71
75
|
if (!this.isUnresolvedTrack(unresolvedTrack))
|
|
@@ -296,11 +296,11 @@ export interface FilterData {
|
|
|
296
296
|
}
|
|
297
297
|
export type PluginFiltersKey = "lavalink-filter-plugin" | string;
|
|
298
298
|
export interface PluginFiltersValues extends LavalinkFiltersPlugin {
|
|
299
|
-
[key: string]:
|
|
299
|
+
[key: string]: string | number | string[] | number[] | EchoFilter | ReverbFilter;
|
|
300
300
|
}
|
|
301
301
|
export interface LavalinkFiltersPlugin {
|
|
302
|
-
echo: EchoFilter;
|
|
303
|
-
reverb: ReverbFilter;
|
|
302
|
+
"echo": EchoFilter;
|
|
303
|
+
"reverb": ReverbFilter;
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* Actual Filter Data sent to Lavalink
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
|
-
import { NodeManager } from "./NodeManager";
|
|
4
|
-
import { ManagerQueueOptions } from "./Queue";
|
|
5
|
-
import { GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
6
3
|
import { LavalinkNodeOptions } from "./Node";
|
|
4
|
+
import { NodeManager } from "./NodeManager";
|
|
7
5
|
import { DestroyReasonsType, Player, PlayerJson, PlayerOptions } from "./Player";
|
|
6
|
+
import { ManagerQueueOptions } from "./Queue";
|
|
8
7
|
import { Track, UnresolvedTrack } from "./Track";
|
|
8
|
+
import { ChannelDeletePacket, GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
9
9
|
export interface LavalinkManager {
|
|
10
10
|
nodeManager: NodeManager;
|
|
11
11
|
utils: ManagerUtils;
|
|
@@ -145,6 +145,6 @@ export declare class LavalinkManager extends EventEmitter {
|
|
|
145
145
|
* Sends voice data to the Lavalink server.
|
|
146
146
|
* @param data
|
|
147
147
|
*/
|
|
148
|
-
sendRawData(data: VoicePacket | VoiceServer | VoiceState |
|
|
148
|
+
sendRawData(data: VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket): Promise<void>;
|
|
149
149
|
}
|
|
150
150
|
export {};
|
|
@@ -30,15 +30,25 @@ export interface PlayerJson {
|
|
|
30
30
|
}
|
|
31
31
|
export type RepeatMode = "queue" | "track" | "off";
|
|
32
32
|
export interface PlayerOptions {
|
|
33
|
+
/** Guild id of the player */
|
|
33
34
|
guildId: string;
|
|
35
|
+
/** The Voice Channel Id */
|
|
34
36
|
voiceChannelId: string;
|
|
37
|
+
/** The Text Channel Id of the Player */
|
|
38
|
+
textChannelId?: string;
|
|
39
|
+
/** instantly change volume with the one play request */
|
|
35
40
|
volume?: number;
|
|
41
|
+
/** VC Region for node selections */
|
|
36
42
|
vcRegion?: string;
|
|
43
|
+
/** if it should join deafened */
|
|
37
44
|
selfDeaf?: boolean;
|
|
45
|
+
/** If it should join muted */
|
|
38
46
|
selfMute?: boolean;
|
|
39
|
-
|
|
47
|
+
/** If it should use a specific lavalink node */
|
|
40
48
|
node?: LavalinkNode | string;
|
|
49
|
+
/** If when applying filters, it should use the insta apply filters fix */
|
|
41
50
|
instaUpdateFiltersFix?: boolean;
|
|
51
|
+
/** If a volume should be applied via filters instead of lavalink-volume */
|
|
42
52
|
applyVolumeAsFilter?: boolean;
|
|
43
53
|
}
|
|
44
54
|
export interface PlayOptions {
|
|
@@ -113,7 +123,7 @@ export declare class Player {
|
|
|
113
123
|
* @param key
|
|
114
124
|
* @param value
|
|
115
125
|
*/
|
|
116
|
-
set(key: string, value: unknown):
|
|
126
|
+
set(key: string, value: unknown): this;
|
|
117
127
|
/**
|
|
118
128
|
* Get custom data.
|
|
119
129
|
* @param key
|
|
@@ -122,7 +132,7 @@ export declare class Player {
|
|
|
122
132
|
/**
|
|
123
133
|
* CLears all the custom data.
|
|
124
134
|
*/
|
|
125
|
-
clearData():
|
|
135
|
+
clearData(): this;
|
|
126
136
|
/**
|
|
127
137
|
* Get all custom Data
|
|
128
138
|
*/
|
|
@@ -137,32 +147,32 @@ export declare class Player {
|
|
|
137
147
|
* @param volume The Volume in percent
|
|
138
148
|
* @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
|
|
139
149
|
*/
|
|
140
|
-
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<
|
|
150
|
+
setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
|
|
141
151
|
lavaSearch(query: LavaSearchQuery, requestUser: unknown): Promise<import("./Utils").SearchResult | import("./Utils").LavaSearchResponse>;
|
|
142
152
|
/**
|
|
143
153
|
*
|
|
144
154
|
* @param query Query for your data
|
|
145
155
|
* @param requestUser
|
|
146
156
|
*/
|
|
147
|
-
search(query: SearchQuery, requestUser: unknown): Promise<import("./Utils").
|
|
157
|
+
search(query: SearchQuery, requestUser: unknown): Promise<import("./Utils").UnresolvedSearchResult | import("./Utils").SearchResult>;
|
|
148
158
|
/**
|
|
149
159
|
* Pause the player
|
|
150
160
|
*/
|
|
151
|
-
pause(): Promise<
|
|
161
|
+
pause(): Promise<this>;
|
|
152
162
|
/**
|
|
153
163
|
* Resume the Player
|
|
154
164
|
*/
|
|
155
|
-
resume(): Promise<
|
|
165
|
+
resume(): Promise<this>;
|
|
156
166
|
/**
|
|
157
167
|
* Seek to a specific Position
|
|
158
168
|
* @param position
|
|
159
169
|
*/
|
|
160
|
-
seek(position: number): Promise<
|
|
170
|
+
seek(position: number): Promise<this>;
|
|
161
171
|
/**
|
|
162
172
|
* Set the Repeatmode of the Player
|
|
163
173
|
* @param repeatMode
|
|
164
174
|
*/
|
|
165
|
-
setRepeatMode(repeatMode: RepeatMode): Promise<
|
|
175
|
+
setRepeatMode(repeatMode: RepeatMode): Promise<this>;
|
|
166
176
|
/**
|
|
167
177
|
* Skip the current song, or a specific amount of songs
|
|
168
178
|
* @param amount provide the index of the next track to skip to
|
|
@@ -172,17 +182,17 @@ export declare class Player {
|
|
|
172
182
|
* Connects the Player to the Voice Channel
|
|
173
183
|
* @returns
|
|
174
184
|
*/
|
|
175
|
-
connect(): Promise<
|
|
185
|
+
connect(): Promise<this>;
|
|
176
186
|
/**
|
|
177
187
|
* Disconnects the Player from the Voice Channel, but keeps the player in the cache
|
|
178
188
|
* @param force If false it throws an error, if player thinks it's already disconnected
|
|
179
189
|
* @returns
|
|
180
190
|
*/
|
|
181
|
-
disconnect(force?: boolean): Promise<
|
|
191
|
+
disconnect(force?: boolean): Promise<this>;
|
|
182
192
|
/**
|
|
183
193
|
* Destroy the player and disconnect from the voice channel
|
|
184
194
|
*/
|
|
185
|
-
destroy(reason?: string): Promise<
|
|
195
|
+
destroy(reason?: string): Promise<this>;
|
|
186
196
|
/**
|
|
187
197
|
* Move the player on a different Audio-Node
|
|
188
198
|
* @param newNode New Node / New Node Id
|
|
@@ -16,9 +16,9 @@ export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzs
|
|
|
16
16
|
export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
|
|
17
17
|
export type DuncteSearchPlatform = "speak" | "tts";
|
|
18
18
|
export type LavalinkClientSearchPlatform = "bcsearch";
|
|
19
|
-
export type LavalinkClientSearchPlatformResolve = "bandcamp";
|
|
19
|
+
export type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
|
|
20
20
|
export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | LavalinkClientSearchPlatform;
|
|
21
|
-
export type ClientSearchPlatform = "youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "sp" | "spsuggestion" | "spotify" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
|
|
21
|
+
export type ClientSearchPlatform = "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" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
|
|
22
22
|
export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
23
23
|
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";
|
|
24
24
|
export interface PlaylistInfo {
|
|
@@ -283,6 +283,13 @@ export interface LavalinkPlayer {
|
|
|
283
283
|
voice: LavalinkPlayerVoice;
|
|
284
284
|
filters: Partial<LavalinkFilterData>;
|
|
285
285
|
}
|
|
286
|
+
export interface ChannelDeletePacket {
|
|
287
|
+
t: "CHANNEL_DELETE";
|
|
288
|
+
d: {
|
|
289
|
+
guild_id: string;
|
|
290
|
+
id: string;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
286
293
|
export interface VoiceState {
|
|
287
294
|
op: "voiceUpdate";
|
|
288
295
|
guildId: string;
|
package/package.json
CHANGED