lavalink-client 2.1.3 → 2.1.5
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 +92 -2
- package/dist/cjs/structures/Filters.d.ts +8 -8
- package/dist/cjs/structures/Filters.js +12 -12
- package/dist/cjs/structures/LavalinkManager.d.ts +160 -9
- package/dist/cjs/structures/LavalinkManager.js +160 -7
- package/dist/cjs/structures/Player.d.ts +3 -3
- package/dist/cjs/structures/Player.js +12 -6
- package/dist/esm/structures/Filters.d.ts +8 -8
- package/dist/esm/structures/Filters.js +12 -12
- package/dist/esm/structures/LavalinkManager.d.ts +160 -9
- package/dist/esm/structures/LavalinkManager.js +160 -7
- package/dist/esm/structures/Player.d.ts +3 -3
- package/dist/esm/structures/Player.js +12 -6
- package/dist/types/structures/Filters.d.ts +8 -8
- package/dist/types/structures/LavalinkManager.d.ts +160 -9
- package/dist/types/structures/Player.d.ts +3 -3
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Profi
|
|
|
24
24
|
|
|
25
25
|
# Install
|
|
26
26
|
|
|
27
|
-
Latest stable Version:
|
|
27
|
+
Latest stable Version: **`v2.1.3`**
|
|
28
28
|
|
|
29
29
|
<details><summary>👉 via NPM</summary>
|
|
30
30
|
|
|
@@ -57,7 +57,12 @@ yarn add tomato6966/lavalink-client
|
|
|
57
57
|
|
|
58
58
|
# Documentation
|
|
59
59
|
|
|
60
|
-
Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) for **Examples**, and **__detailled__ Docs**, and to figure out **how to get started**. *note: it's not fully done yet (see the docs)*
|
|
60
|
+
Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) | or the [TSDocumentation](https://tomato6966.github.io/lavalink-client/) for **Examples**, and **__detailled__ Docs**, and to figure out **how to get started**. *note: it's not fully done yet (see the docs)*
|
|
61
|
+
|
|
62
|
+
# Used in:
|
|
63
|
+
|
|
64
|
+
- [Betty](https://betty.cx/)
|
|
65
|
+
- [Mivator](https://discord.gg/5dUb7M2qCj)
|
|
61
66
|
|
|
62
67
|
# Features
|
|
63
68
|
|
|
@@ -97,6 +102,91 @@ Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) for **Exam
|
|
|
97
102
|
|
|
98
103
|
- 😁 Much much more!
|
|
99
104
|
|
|
105
|
+
***
|
|
106
|
+
|
|
107
|
+
# All Events:
|
|
108
|
+
|
|
109
|
+
## On **Lavalink-Manager**:
|
|
110
|
+
> *Player related logs*
|
|
111
|
+
- `playerCreate` ➡️ `(player) => {}`
|
|
112
|
+
- `playerDestroy` ➡️ `(player, reason) => {}`
|
|
113
|
+
- `playerDisconnect` ➡️ `(player, voiceChannelId) => {}`
|
|
114
|
+
- `playerMove` ➡️ `(player, oldChannelId, newChannelId) => {}`
|
|
115
|
+
- Updating the voice channel is handled by the client automatically
|
|
116
|
+
- `playerSocketClosed` ➡️ `(player, payload) => {}`
|
|
117
|
+
|
|
118
|
+
> *Track / Manager related logs*
|
|
119
|
+
- `trackStart` ➡️ `(player, track, payload) => {}`
|
|
120
|
+
- `trackStuck` ➡️ `(player, track, payload) => {}`
|
|
121
|
+
- `trackError` ➡️ `(player, track, payload) => {}`
|
|
122
|
+
- `trackEnd` ➡️ `(player, track, payload) => {}`
|
|
123
|
+
- `queueEnd` ➡️ `(player, track, payload) => {}`
|
|
124
|
+
- `playerUpdate` ➡️ `(player) => {}`
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
client.lavalink.on("create", (node, payload) => {
|
|
128
|
+
console.log(`The Lavalink Node #${node.id} connected`);
|
|
129
|
+
});
|
|
130
|
+
// for all node based errors:
|
|
131
|
+
client.lavalink.on("error", (node, error, payload) => {
|
|
132
|
+
console.error(`The Lavalink Node #${node.id} errored: `, error);
|
|
133
|
+
console.error(`Error-Payload: `, payload)
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## On **Node-Manager**:
|
|
138
|
+
- `raw` ➡️ `(node, payload) => {}`
|
|
139
|
+
- `disconnect` ➡️ `(node, reason) => {}`
|
|
140
|
+
- `connect` ➡️ `(node) => {}`
|
|
141
|
+
- `reconnecting` ➡️ `(node) => {}`
|
|
142
|
+
- `create` ➡️ `(node) => {}`
|
|
143
|
+
- `destroy` ➡️ `(node) => {}`
|
|
144
|
+
- `error` ➡️ `(node, error, payload) => {}`
|
|
145
|
+
- `resumed` ➡️ `(node, payload, players) => {}`
|
|
146
|
+
- Resuming needs to be handled manually by you *(aka add the players to the manager)*
|
|
147
|
+
- e.g.:
|
|
148
|
+
```js
|
|
149
|
+
client.lavalink.nodeManager.on("create", (node, payload) => {
|
|
150
|
+
console.log(`The Lavalink Node #${node.id} connected`);
|
|
151
|
+
});
|
|
152
|
+
// for all node based errors:
|
|
153
|
+
client.lavalink.nodeManager.on("error", (node, error, payload) => {
|
|
154
|
+
console.error(`The Lavalink Node #${node.id} errored: `, error);
|
|
155
|
+
console.error(`Error-Payload: `, payload)
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## How to log queue logs?
|
|
160
|
+
> When creating the manager, add the option: `queueOptions.queueChangesWatcher: new myCustomWatcher(botClient)`
|
|
161
|
+
> E.g:
|
|
162
|
+
```js
|
|
163
|
+
import { QueueChangesWatcher, LavalinkManager } from "lavalink-client";
|
|
164
|
+
|
|
165
|
+
class myCustomWatcher implements QueueChangesWatcher {
|
|
166
|
+
constructor(client) {
|
|
167
|
+
this.client = client;
|
|
168
|
+
}
|
|
169
|
+
shuffled(guildId, oldStoredQueue, newStoredQueue) {
|
|
170
|
+
console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: Queue got shuffled`)
|
|
171
|
+
}
|
|
172
|
+
tracksAdd(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
|
|
173
|
+
console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got added into the Queue at position #${position}`);
|
|
174
|
+
}
|
|
175
|
+
tracksRemoved(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
|
|
176
|
+
console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got removed from the Queue at position #${position}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
client.lavalink = new LavalinkManager({
|
|
181
|
+
// ... other options
|
|
182
|
+
queueOptions: {
|
|
183
|
+
queueChangesWatcher: new myCustomWatcher(client)
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
***
|
|
189
|
+
|
|
100
190
|
# UpdateLog
|
|
101
191
|
|
|
102
192
|
## **Version 1.2.0**
|
|
@@ -61,27 +61,27 @@ export declare class FilterManager {
|
|
|
61
61
|
*/
|
|
62
62
|
setRate(rate?: number): Promise<boolean>;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Enables / Disables the rotation effect, (Optional: provide your Own Data)
|
|
65
65
|
* @param rotationHz
|
|
66
66
|
* @returns
|
|
67
67
|
*/
|
|
68
68
|
toggleRotation(rotationHz?: number): Promise<boolean>;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
|
|
71
71
|
* @param frequency
|
|
72
72
|
* @param depth
|
|
73
73
|
* @returns
|
|
74
74
|
*/
|
|
75
75
|
toggleVibrato(frequency?: number, depth?: number): Promise<boolean>;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
|
|
78
78
|
* @param frequency
|
|
79
79
|
* @param depth
|
|
80
80
|
* @returns
|
|
81
81
|
*/
|
|
82
82
|
toggleTremolo(frequency?: number, depth?: number): Promise<boolean>;
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* Enables / Disables the LowPass effect, (Optional: provide your Own Data)
|
|
85
85
|
* @param smoothing
|
|
86
86
|
* @returns
|
|
87
87
|
*/
|
|
@@ -94,14 +94,14 @@ export declare class FilterManager {
|
|
|
94
94
|
};
|
|
95
95
|
lavalinkFilterPlugin: {
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
|
|
98
98
|
* @param delay
|
|
99
99
|
* @param decay
|
|
100
100
|
* @returns
|
|
101
101
|
*/
|
|
102
102
|
toggleEcho: (delay?: number, decay?: number) => Promise<boolean>;
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
|
|
105
105
|
* @param delays
|
|
106
106
|
* @param gains
|
|
107
107
|
* @returns
|
|
@@ -109,7 +109,7 @@ export declare class FilterManager {
|
|
|
109
109
|
toggleReverb: (delays?: number[], gains?: number[]) => Promise<boolean>;
|
|
110
110
|
};
|
|
111
111
|
/**
|
|
112
|
-
* Enables /
|
|
112
|
+
* Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
|
|
113
113
|
* @param speed
|
|
114
114
|
* @param pitch
|
|
115
115
|
* @param rate
|
|
@@ -117,7 +117,7 @@ export declare class FilterManager {
|
|
|
117
117
|
*/
|
|
118
118
|
toggleNightcore(speed?: number, pitch?: number, rate?: number): Promise<boolean>;
|
|
119
119
|
/**
|
|
120
|
-
* Enables /
|
|
120
|
+
* Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
|
|
121
121
|
* @param speed
|
|
122
122
|
* @param pitch
|
|
123
123
|
* @param rate
|
|
@@ -266,12 +266,12 @@ class FilterManager {
|
|
|
266
266
|
rotationHz: 0
|
|
267
267
|
},
|
|
268
268
|
tremolo: {
|
|
269
|
-
frequency:
|
|
270
|
-
depth: 0
|
|
269
|
+
frequency: 0,
|
|
270
|
+
depth: 0 // 0 < x = 1
|
|
271
271
|
},
|
|
272
272
|
vibrato: {
|
|
273
|
-
frequency:
|
|
274
|
-
depth: 0
|
|
273
|
+
frequency: 0,
|
|
274
|
+
depth: 0 // 0 < x = 1
|
|
275
275
|
},
|
|
276
276
|
channelMix: exports.audioOutputsData.stereo,
|
|
277
277
|
})) {
|
|
@@ -374,7 +374,7 @@ class FilterManager {
|
|
|
374
374
|
return this.filters.custom;
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
|
-
*
|
|
377
|
+
* Enables / Disables the rotation effect, (Optional: provide your Own Data)
|
|
378
378
|
* @param rotationHz
|
|
379
379
|
* @returns
|
|
380
380
|
*/
|
|
@@ -386,7 +386,7 @@ class FilterManager {
|
|
|
386
386
|
return await this.applyPlayerFilters(), this.filters.rotation;
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
|
-
*
|
|
389
|
+
* Enables / Disables the Vibrato effect, (Optional: provide your Own Data)
|
|
390
390
|
* @param frequency
|
|
391
391
|
* @param depth
|
|
392
392
|
* @returns
|
|
@@ -401,7 +401,7 @@ class FilterManager {
|
|
|
401
401
|
return this.filters.vibrato;
|
|
402
402
|
}
|
|
403
403
|
/**
|
|
404
|
-
*
|
|
404
|
+
* Enables / Disables the Tremolo effect, (Optional: provide your Own Data)
|
|
405
405
|
* @param frequency
|
|
406
406
|
* @param depth
|
|
407
407
|
* @returns
|
|
@@ -416,7 +416,7 @@ class FilterManager {
|
|
|
416
416
|
return this.filters.tremolo;
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
|
-
*
|
|
419
|
+
* Enables / Disables the LowPass effect, (Optional: provide your Own Data)
|
|
420
420
|
* @param smoothing
|
|
421
421
|
* @returns
|
|
422
422
|
*/
|
|
@@ -528,7 +528,7 @@ class FilterManager {
|
|
|
528
528
|
};
|
|
529
529
|
lavalinkFilterPlugin = {
|
|
530
530
|
/**
|
|
531
|
-
*
|
|
531
|
+
* Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
|
|
532
532
|
* @param delay
|
|
533
533
|
* @param decay
|
|
534
534
|
* @returns
|
|
@@ -553,7 +553,7 @@ class FilterManager {
|
|
|
553
553
|
return this.filters.lavalinkFilterPlugin.echo;
|
|
554
554
|
},
|
|
555
555
|
/**
|
|
556
|
-
*
|
|
556
|
+
* Enables / Disables the Echo effect, IMPORTANT! Only works with the correct Lavalink Plugin installed. (Optional: provide your Own Data)
|
|
557
557
|
* @param delays
|
|
558
558
|
* @param gains
|
|
559
559
|
* @returns
|
|
@@ -579,7 +579,7 @@ class FilterManager {
|
|
|
579
579
|
}
|
|
580
580
|
};
|
|
581
581
|
/**
|
|
582
|
-
* Enables /
|
|
582
|
+
* Enables / Disables a Nightcore-like filter Effect. Disables/Overrides both: custom and Vaporwave Filter
|
|
583
583
|
* @param speed
|
|
584
584
|
* @param pitch
|
|
585
585
|
* @param rate
|
|
@@ -598,7 +598,7 @@ class FilterManager {
|
|
|
598
598
|
return this.filters.nightcore;
|
|
599
599
|
}
|
|
600
600
|
/**
|
|
601
|
-
* Enables /
|
|
601
|
+
* Enables / Disables a Vaporwave-like filter Effect. Disables/Overrides both: custom and nightcore Filter
|
|
602
602
|
* @param speed
|
|
603
603
|
* @param pitch
|
|
604
604
|
* @param rate
|
|
@@ -6,10 +6,6 @@ import { DestroyReasonsType, Player, PlayerJson, PlayerOptions } from "./Player"
|
|
|
6
6
|
import { ManagerQueueOptions } from "./Queue";
|
|
7
7
|
import { Track, UnresolvedTrack } from "./Track";
|
|
8
8
|
import { ChannelDeletePacket, GuildShardPayload, ManagerUtils, MiniMap, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent, VoicePacket, VoiceServer, VoiceState, WebSocketClosedEvent } from "./Utils";
|
|
9
|
-
export interface LavalinkManager {
|
|
10
|
-
nodeManager: NodeManager;
|
|
11
|
-
utils: ManagerUtils;
|
|
12
|
-
}
|
|
13
9
|
export interface BotClientOptions {
|
|
14
10
|
/** Bot Client Id */
|
|
15
11
|
id: string;
|
|
@@ -168,31 +164,186 @@ interface LavalinkManagerEvents {
|
|
|
168
164
|
"ChaptersLoaded": (player: Player, track: Track | UnresolvedTrack, payload: SponsorBlockChaptersLoaded) => void;
|
|
169
165
|
}
|
|
170
166
|
export interface LavalinkManager {
|
|
171
|
-
|
|
167
|
+
/** @private */
|
|
172
168
|
on<U extends keyof LavalinkManagerEvents>(event: U, listener: LavalinkManagerEvents[U]): this;
|
|
169
|
+
/** @private */
|
|
173
170
|
emit<U extends keyof LavalinkManagerEvents>(event: U, ...args: Parameters<LavalinkManagerEvents[U]>): boolean;
|
|
174
171
|
}
|
|
175
172
|
export declare class LavalinkManager extends EventEmitter {
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
/** The Options of LavalinkManager (changeable) */
|
|
174
|
+
options: ManagerOptions;
|
|
175
|
+
/** LavalinkManager's NodeManager to manage all Nodes */
|
|
176
|
+
nodeManager: NodeManager;
|
|
177
|
+
/** LavalinkManager's Utils Class */
|
|
178
|
+
utils: ManagerUtils;
|
|
179
|
+
/** Wether the manager was initiated or not */
|
|
178
180
|
initiated: boolean;
|
|
181
|
+
/** All Players stored in a MiniMap */
|
|
179
182
|
readonly players: MiniMap<string, Player>;
|
|
183
|
+
/**
|
|
184
|
+
* Applies the options provided by the User
|
|
185
|
+
* @param options
|
|
186
|
+
* @returns
|
|
187
|
+
*/
|
|
180
188
|
private applyOptions;
|
|
189
|
+
/**
|
|
190
|
+
* Validates the current manager's options
|
|
191
|
+
* @param options
|
|
192
|
+
*/
|
|
181
193
|
private validateOptions;
|
|
194
|
+
/**
|
|
195
|
+
* Create the Lavalink Manager
|
|
196
|
+
* @param options
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* //const client = new Client({...}); // create your BOT Client (e.g. via discord.js)
|
|
201
|
+
* client.lavalink = new LavalinkManager({
|
|
202
|
+
* nodes: [
|
|
203
|
+
* {
|
|
204
|
+
* authorization: "yourverystrongpassword",
|
|
205
|
+
* host: "localhost",
|
|
206
|
+
* port: 2333,
|
|
207
|
+
* id: "testnode"
|
|
208
|
+
* },
|
|
209
|
+
* sendToShard(guildId, payload) => client.guilds.cache.get(guildId)?.shard?.send(payload),
|
|
210
|
+
* client: {
|
|
211
|
+
* id: process.env.CLIENT_ID,
|
|
212
|
+
* username: "TESTBOT"
|
|
213
|
+
* },
|
|
214
|
+
* // optional Options:
|
|
215
|
+
* autoSkip: true,
|
|
216
|
+
* playerOptions: {
|
|
217
|
+
* applyVolumeAsFilter: false,
|
|
218
|
+
* clientBasedPositionUpdateInterval: 150,
|
|
219
|
+
* defaultSearchPlatform: "ytmsearch",
|
|
220
|
+
* volumeDecrementer: 0.75,
|
|
221
|
+
* //requesterTransformer: YourRequesterTransformerFunction,
|
|
222
|
+
* onDisconnect: {
|
|
223
|
+
* autoReconnect: true,
|
|
224
|
+
* destroyPlayer: false
|
|
225
|
+
* },
|
|
226
|
+
* onEmptyQueue: {
|
|
227
|
+
* destroyAfterMs: 30_000,
|
|
228
|
+
* //autoPlayFunction: YourAutoplayFunction,
|
|
229
|
+
* },
|
|
230
|
+
* useUnresolvedData: true
|
|
231
|
+
* },
|
|
232
|
+
* queueOptions: {
|
|
233
|
+
* maxPreviousTracks: 25,
|
|
234
|
+
* //queueStore: yourCustomQueueStoreManagerClass,
|
|
235
|
+
* //queueChangesWatcher: yourCustomQueueChangesWatcherClass
|
|
236
|
+
* },
|
|
237
|
+
* linksBlacklist: [],
|
|
238
|
+
* linksWhitelist: [],
|
|
239
|
+
* advancedOptions: {
|
|
240
|
+
* debugOptions: {
|
|
241
|
+
* noAudio: false,
|
|
242
|
+
* playerDestroy: {
|
|
243
|
+
* dontThrowError: false,
|
|
244
|
+
* debugLogs: false
|
|
245
|
+
* }
|
|
246
|
+
* }
|
|
247
|
+
* }
|
|
248
|
+
* ]
|
|
249
|
+
* })
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
182
252
|
constructor(options: ManagerOptions);
|
|
183
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Get a Player from Lava
|
|
255
|
+
* @param guildId The guildId of the player
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* const player = client.lavalink.getPlayer(interaction.guildId);
|
|
260
|
+
* ```
|
|
261
|
+
* A quicker and easier way than doing:
|
|
262
|
+
* ```ts
|
|
263
|
+
* const player = client.lavalink.players.get(interaction.guildId);
|
|
264
|
+
* ```
|
|
265
|
+
* @returns
|
|
266
|
+
*/
|
|
184
267
|
getPlayer(guildId: string): Player;
|
|
268
|
+
/**
|
|
269
|
+
* Create a Music-Player. If a player exists, then it returns it before creating a new one
|
|
270
|
+
* @param options
|
|
271
|
+
* @returns
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* const player = client.lavalink.createPlayer({
|
|
276
|
+
* guildId: interaction.guildId,
|
|
277
|
+
* voiceChannelId: interaction.member.voice.channelId,
|
|
278
|
+
* // everything below is optional
|
|
279
|
+
* textChannelId: interaction.channelId,
|
|
280
|
+
* volume: 100,
|
|
281
|
+
* selfDeaf: true,
|
|
282
|
+
* selfMute: false,
|
|
283
|
+
* instaUpdateFiltersFix: true,
|
|
284
|
+
* applyVolumeAsFilter: false
|
|
285
|
+
* //only needed if you want to autopick node by region (configured by you)
|
|
286
|
+
* // vcRegion: interaction.member.voice.rtcRegion,
|
|
287
|
+
* // provide a specific node
|
|
288
|
+
* // node: client.lavalink.nodeManager.leastUsedNodes("memory")[0]
|
|
289
|
+
* });
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
createPlayer(options: PlayerOptions): Player;
|
|
293
|
+
/**
|
|
294
|
+
* Destroy a player with optional destroy reason and disconnect it from the voice channel
|
|
295
|
+
* @param guildId
|
|
296
|
+
* @param destroyReason
|
|
297
|
+
* @returns
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* client.lavalink.destroyPlayer(interaction.guildId, "forcefully destroyed the player");
|
|
302
|
+
* // recommend to do it on the player tho: player.destroy("forcefully destroyed the player");
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
185
305
|
destroyPlayer(guildId: string, destroyReason?: string): Promise<Player>;
|
|
306
|
+
/**
|
|
307
|
+
* Delete's a player from the cache without destroying it on lavalink (only works when it's disconnected)
|
|
308
|
+
* @param guildId
|
|
309
|
+
* @returns
|
|
310
|
+
*/
|
|
186
311
|
deletePlayer(guildId: string): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Checks wether the the lib is useable based on if any node is connected
|
|
314
|
+
*/
|
|
187
315
|
get useable(): boolean;
|
|
188
316
|
/**
|
|
189
|
-
* Initiates the Manager
|
|
317
|
+
* Initiates the Manager, creates all nodes and connects all of them
|
|
190
318
|
* @param clientData
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
*
|
|
322
|
+
* ```ts
|
|
323
|
+
* // on the bot ready event
|
|
324
|
+
* client.on("ready", () => {
|
|
325
|
+
* client.lavalink.init({
|
|
326
|
+
* id: client.user.id,
|
|
327
|
+
* username: client.user.username
|
|
328
|
+
* });
|
|
329
|
+
* });
|
|
330
|
+
* ```
|
|
191
331
|
*/
|
|
192
332
|
init(clientData: BotClientOptions): Promise<this>;
|
|
193
333
|
/**
|
|
194
334
|
* Sends voice data to the Lavalink server.
|
|
335
|
+
* ! Without this the library won't work
|
|
195
336
|
* @param data
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
*
|
|
340
|
+
* ```ts
|
|
341
|
+
* // on the bot "raw" event
|
|
342
|
+
* client.on("raw", (d) => {
|
|
343
|
+
* // required in order to send audio updates and register channel deletion etc.
|
|
344
|
+
* client.lavalink.sendRawData(d)
|
|
345
|
+
* })
|
|
346
|
+
* ```
|
|
196
347
|
*/
|
|
197
348
|
sendRawData(data: VoicePacket | VoiceServer | VoiceState | ChannelDeletePacket): Promise<void>;
|
|
198
349
|
}
|