magmastream 2.9.0-dev.46 → 2.9.0-dev.48
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/index.d.ts +1055 -1017
- package/dist/statestorage/JsonQueue.js +242 -236
- package/dist/statestorage/MemoryQueue.js +207 -202
- package/dist/statestorage/RedisQueue.js +230 -210
- package/dist/structures/Enums.js +4 -0
- package/dist/structures/Filters.js +149 -99
- package/dist/structures/Player.js +3 -4
- package/dist/structures/Utils.js +7 -6
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ class Filters {
|
|
|
7
7
|
distortion;
|
|
8
8
|
equalizer;
|
|
9
9
|
karaoke;
|
|
10
|
+
manager;
|
|
10
11
|
player;
|
|
11
12
|
rotation;
|
|
12
13
|
timescale;
|
|
@@ -15,10 +16,11 @@ class Filters {
|
|
|
15
16
|
volume;
|
|
16
17
|
bassBoostlevel;
|
|
17
18
|
filtersStatus;
|
|
18
|
-
constructor(player) {
|
|
19
|
+
constructor(player, manager) {
|
|
19
20
|
this.distortion = null;
|
|
20
21
|
this.equalizer = [];
|
|
21
22
|
this.karaoke = null;
|
|
23
|
+
this.manager = manager;
|
|
22
24
|
this.player = player;
|
|
23
25
|
this.rotation = null;
|
|
24
26
|
this.timescale = null;
|
|
@@ -78,6 +80,12 @@ class Filters {
|
|
|
78
80
|
}
|
|
79
81
|
return this;
|
|
80
82
|
}
|
|
83
|
+
emitPlayersTasteUpdate(oldState) {
|
|
84
|
+
this.manager.emit(Enums_1.ManagerEventTypes.PlayerStateUpdate, oldState, this, {
|
|
85
|
+
changeType: Enums_1.PlayerStateEventTypes.FilterChange,
|
|
86
|
+
details: { action: "change" },
|
|
87
|
+
});
|
|
88
|
+
}
|
|
81
89
|
/**
|
|
82
90
|
* Sets the status of a specific filter.
|
|
83
91
|
*
|
|
@@ -112,11 +120,12 @@ class Filters {
|
|
|
112
120
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
113
121
|
*/
|
|
114
122
|
async clearFilters() {
|
|
123
|
+
const oldPlayer = { ...this };
|
|
115
124
|
this.filtersStatus = Object.values(Enums_1.AvailableFilters).reduce((acc, filter) => {
|
|
116
125
|
acc[filter] = false;
|
|
117
126
|
return acc;
|
|
118
127
|
}, {});
|
|
119
|
-
this.player.filters = new Filters(this.player);
|
|
128
|
+
this.player.filters = new Filters(this.player, this.manager);
|
|
120
129
|
await this.setEqualizer([]);
|
|
121
130
|
await this.setDistortion(null);
|
|
122
131
|
await this.setKaraoke(null);
|
|
@@ -124,6 +133,7 @@ class Filters {
|
|
|
124
133
|
await this.setTimescale(null);
|
|
125
134
|
await this.setVibrato(null);
|
|
126
135
|
await this.updateFilters();
|
|
136
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
127
137
|
return this;
|
|
128
138
|
}
|
|
129
139
|
/**
|
|
@@ -136,7 +146,10 @@ class Filters {
|
|
|
136
146
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
137
147
|
*/
|
|
138
148
|
async setEqualizer(bands) {
|
|
139
|
-
|
|
149
|
+
const oldPlayer = { ...this };
|
|
150
|
+
await this.applyFilter({ property: "equalizer", value: bands });
|
|
151
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
152
|
+
return this;
|
|
140
153
|
}
|
|
141
154
|
/**
|
|
142
155
|
* Sets the own karaoke options to the audio.
|
|
@@ -149,10 +162,11 @@ class Filters {
|
|
|
149
162
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
150
163
|
*/
|
|
151
164
|
async setKaraoke(karaoke) {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
165
|
+
const oldPlayer = { ...this };
|
|
166
|
+
await this.applyFilter({ property: "karaoke", value: karaoke ?? null });
|
|
167
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetKaraoke, !!karaoke);
|
|
168
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
169
|
+
return this;
|
|
156
170
|
}
|
|
157
171
|
/**
|
|
158
172
|
* Sets the own timescale options to the audio.
|
|
@@ -163,10 +177,11 @@ class Filters {
|
|
|
163
177
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
164
178
|
*/
|
|
165
179
|
async setTimescale(timescale) {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
180
|
+
const oldPlayer = { ...this };
|
|
181
|
+
await this.applyFilter({ property: "timescale", value: timescale ?? null });
|
|
182
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetTimescale, !!timescale);
|
|
183
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
184
|
+
return this;
|
|
170
185
|
}
|
|
171
186
|
/**
|
|
172
187
|
* Sets the own vibrato options to the audio.
|
|
@@ -179,10 +194,11 @@ class Filters {
|
|
|
179
194
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
180
195
|
*/
|
|
181
196
|
async setVibrato(vibrato) {
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
197
|
+
const oldPlayer = { ...this };
|
|
198
|
+
await this.applyFilter({ property: "vibrato", value: vibrato ?? null });
|
|
199
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Vibrato, !!vibrato);
|
|
200
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
201
|
+
return this;
|
|
186
202
|
}
|
|
187
203
|
/**
|
|
188
204
|
* Sets the own rotation options effect to the audio.
|
|
@@ -195,10 +211,11 @@ class Filters {
|
|
|
195
211
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
196
212
|
*/
|
|
197
213
|
async setRotation(rotation) {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
214
|
+
const oldPlayer = { ...this };
|
|
215
|
+
await this.applyFilter({ property: "rotation", value: rotation ?? null });
|
|
216
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetRotation, !!rotation);
|
|
217
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
218
|
+
return this;
|
|
202
219
|
}
|
|
203
220
|
/**
|
|
204
221
|
* Sets the own distortion options effect to the audio.
|
|
@@ -211,10 +228,11 @@ class Filters {
|
|
|
211
228
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
212
229
|
*/
|
|
213
230
|
async setDistortion(distortion) {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
231
|
+
const oldPlayer = { ...this };
|
|
232
|
+
await this.applyFilter({ property: "distortion", value: distortion ?? null });
|
|
233
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetDistortion, !!distortion);
|
|
234
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
235
|
+
return this;
|
|
218
236
|
}
|
|
219
237
|
/**
|
|
220
238
|
* Sets the bass boost level on the audio.
|
|
@@ -239,6 +257,7 @@ class Filters {
|
|
|
239
257
|
* await player.bassBoost(-3); // Maximum Bass Removal
|
|
240
258
|
*/
|
|
241
259
|
async bassBoost(stage) {
|
|
260
|
+
const oldPlayer = { ...this };
|
|
242
261
|
// Ensure stage is between -3 and 3
|
|
243
262
|
stage = Math.max(-3, Math.min(3, stage));
|
|
244
263
|
// Map stage (-3 to 3) to range (-1.0 to 1.0)
|
|
@@ -246,11 +265,12 @@ class Filters {
|
|
|
246
265
|
// Generate a dynamic equalizer by scaling bassBoostEqualizer
|
|
247
266
|
const equalizer = filtersEqualizers_1.bassBoostEqualizer.map((band) => ({
|
|
248
267
|
band: band.band,
|
|
249
|
-
gain: band.gain * level,
|
|
268
|
+
gain: band.gain * level,
|
|
250
269
|
}));
|
|
251
270
|
await this.applyFilter({ property: "equalizer", value: equalizer });
|
|
252
|
-
this.setFilterStatus(Enums_1.AvailableFilters.BassBoost, stage !== 0);
|
|
271
|
+
this.setFilterStatus(Enums_1.AvailableFilters.BassBoost, stage !== 0);
|
|
253
272
|
this.bassBoostlevel = stage;
|
|
273
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
254
274
|
return this;
|
|
255
275
|
}
|
|
256
276
|
/**
|
|
@@ -264,10 +284,11 @@ class Filters {
|
|
|
264
284
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
265
285
|
*/
|
|
266
286
|
async chipmunk(status) {
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
287
|
+
const oldPlayer = { ...this };
|
|
288
|
+
await this.applyFilter({ property: "timescale", value: status ? { speed: 1.5, pitch: 1.5, rate: 1.5 } : null });
|
|
289
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Chipmunk, status);
|
|
290
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
291
|
+
return this;
|
|
271
292
|
}
|
|
272
293
|
/**
|
|
273
294
|
* Toggles the "China" effect on the audio.
|
|
@@ -279,10 +300,11 @@ class Filters {
|
|
|
279
300
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
280
301
|
*/
|
|
281
302
|
async china(status) {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
303
|
+
const oldPlayer = { ...this };
|
|
304
|
+
await this.applyFilter({ property: "timescale", value: status ? { speed: 1.0, pitch: 0.5, rate: 1.0 } : null });
|
|
305
|
+
this.setFilterStatus(Enums_1.AvailableFilters.China, status);
|
|
306
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
307
|
+
return this;
|
|
286
308
|
}
|
|
287
309
|
/**
|
|
288
310
|
* Toggles the 8D audio effect on the audio.
|
|
@@ -295,10 +317,11 @@ class Filters {
|
|
|
295
317
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
296
318
|
*/
|
|
297
319
|
async eightD(status) {
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
320
|
+
const oldPlayer = { ...this };
|
|
321
|
+
await this.applyFilter({ property: "rotation", value: status ? { rotationHz: 0.2 } : null });
|
|
322
|
+
this.setFilterStatus(Enums_1.AvailableFilters.EightD, status);
|
|
323
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
324
|
+
return this;
|
|
302
325
|
}
|
|
303
326
|
/**
|
|
304
327
|
* Toggles the nightcore effect on the audio.
|
|
@@ -311,10 +334,11 @@ class Filters {
|
|
|
311
334
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
312
335
|
*/
|
|
313
336
|
async nightcore(status) {
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
337
|
+
const oldPlayer = { ...this };
|
|
338
|
+
await this.applyFilter({ property: "timescale", value: status ? { speed: 1.1, pitch: 1.125, rate: 1.05 } : null });
|
|
339
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Nightcore, status);
|
|
340
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
341
|
+
return this;
|
|
318
342
|
}
|
|
319
343
|
/**
|
|
320
344
|
* Toggles the slowmo effect on the audio.
|
|
@@ -327,10 +351,11 @@ class Filters {
|
|
|
327
351
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
328
352
|
*/
|
|
329
353
|
async slowmo(status) {
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
354
|
+
const oldPlayer = { ...this };
|
|
355
|
+
await this.applyFilter({ property: "timescale", value: status ? { speed: 0.7, pitch: 1.0, rate: 0.8 } : null });
|
|
356
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Slowmo, status);
|
|
357
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
358
|
+
return this;
|
|
334
359
|
}
|
|
335
360
|
/**
|
|
336
361
|
* Toggles a soft equalizer effect to the audio.
|
|
@@ -343,10 +368,11 @@ class Filters {
|
|
|
343
368
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
344
369
|
*/
|
|
345
370
|
async soft(status) {
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
371
|
+
const oldPlayer = { ...this };
|
|
372
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.softEqualizer : [] });
|
|
373
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Soft, status);
|
|
374
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
375
|
+
return this;
|
|
350
376
|
}
|
|
351
377
|
/**
|
|
352
378
|
* Toggles the TV equalizer effect on the audio.
|
|
@@ -359,10 +385,11 @@ class Filters {
|
|
|
359
385
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
360
386
|
*/
|
|
361
387
|
async tv(status) {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
388
|
+
const oldPlayer = { ...this };
|
|
389
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.tvEqualizer : [] });
|
|
390
|
+
this.setFilterStatus(Enums_1.AvailableFilters.TV, status);
|
|
391
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
392
|
+
return this;
|
|
366
393
|
}
|
|
367
394
|
/**
|
|
368
395
|
* Toggles the treble/bass equalizer effect on the audio.
|
|
@@ -374,10 +401,11 @@ class Filters {
|
|
|
374
401
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
375
402
|
*/
|
|
376
403
|
async trebleBass(status) {
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
404
|
+
const oldPlayer = { ...this };
|
|
405
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.trebleBassEqualizer : [] });
|
|
406
|
+
this.setFilterStatus(Enums_1.AvailableFilters.TrebleBass, status);
|
|
407
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
408
|
+
return this;
|
|
381
409
|
}
|
|
382
410
|
/**
|
|
383
411
|
* Toggles the vaporwave effect on the audio.
|
|
@@ -389,10 +417,11 @@ class Filters {
|
|
|
389
417
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
390
418
|
*/
|
|
391
419
|
async vaporwave(status) {
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
420
|
+
const oldPlayer = { ...this };
|
|
421
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.vaporwaveEqualizer : [] });
|
|
422
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Vaporwave, status);
|
|
423
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
424
|
+
return this;
|
|
396
425
|
}
|
|
397
426
|
/**
|
|
398
427
|
* Toggles the distortion effect on the audio.
|
|
@@ -405,8 +434,9 @@ class Filters {
|
|
|
405
434
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
406
435
|
*/
|
|
407
436
|
async distort(status) {
|
|
408
|
-
|
|
409
|
-
|
|
437
|
+
const oldPlayer = { ...this };
|
|
438
|
+
if (status) {
|
|
439
|
+
await this.setDistortion({
|
|
410
440
|
sinOffset: 0,
|
|
411
441
|
sinScale: 0.2,
|
|
412
442
|
cosOffset: 0,
|
|
@@ -415,8 +445,15 @@ class Filters {
|
|
|
415
445
|
tanScale: 0.2,
|
|
416
446
|
offset: 0,
|
|
417
447
|
scale: 1.2,
|
|
418
|
-
})
|
|
419
|
-
|
|
448
|
+
});
|
|
449
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Distort, true);
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
await this.setDistortion();
|
|
453
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Distort, false);
|
|
454
|
+
}
|
|
455
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
456
|
+
return this;
|
|
420
457
|
}
|
|
421
458
|
/**
|
|
422
459
|
* Toggles the party effect on the audio.
|
|
@@ -428,10 +465,11 @@ class Filters {
|
|
|
428
465
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
429
466
|
*/
|
|
430
467
|
async pop(status) {
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
468
|
+
const oldPlayer = { ...this };
|
|
469
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.popEqualizer : [] });
|
|
470
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Pop, status);
|
|
471
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
472
|
+
return this;
|
|
435
473
|
}
|
|
436
474
|
/**
|
|
437
475
|
* Toggles a party effect on the audio.
|
|
@@ -441,10 +479,11 @@ class Filters {
|
|
|
441
479
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
442
480
|
*/
|
|
443
481
|
async party(status) {
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
482
|
+
const oldPlayer = { ...this };
|
|
483
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.popEqualizer : [] });
|
|
484
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Party, status);
|
|
485
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
486
|
+
return this;
|
|
448
487
|
}
|
|
449
488
|
/**
|
|
450
489
|
* Toggles earrape effect on the audio.
|
|
@@ -454,14 +493,17 @@ class Filters {
|
|
|
454
493
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
455
494
|
*/
|
|
456
495
|
async earrape(status) {
|
|
496
|
+
const oldPlayer = { ...this };
|
|
457
497
|
if (status) {
|
|
458
498
|
await this.player.setVolume(200);
|
|
459
|
-
|
|
499
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Earrape, true);
|
|
460
500
|
}
|
|
461
501
|
else {
|
|
462
502
|
await this.player.setVolume(100);
|
|
463
|
-
|
|
503
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Earrape, false);
|
|
464
504
|
}
|
|
505
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
506
|
+
return this;
|
|
465
507
|
}
|
|
466
508
|
/**
|
|
467
509
|
* Toggles electronic effect on the audio.
|
|
@@ -471,10 +513,11 @@ class Filters {
|
|
|
471
513
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
472
514
|
*/
|
|
473
515
|
async electronic(status) {
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
516
|
+
const oldPlayer = { ...this };
|
|
517
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.electronicEqualizer : [] });
|
|
518
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Electronic, status);
|
|
519
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
520
|
+
return this;
|
|
478
521
|
}
|
|
479
522
|
/**
|
|
480
523
|
* Toggles radio effect on the audio.
|
|
@@ -484,10 +527,11 @@ class Filters {
|
|
|
484
527
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
485
528
|
*/
|
|
486
529
|
async radio(status) {
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
530
|
+
const oldPlayer = { ...this };
|
|
531
|
+
await this.applyFilter({ property: "equalizer", value: status ? filtersEqualizers_1.radioEqualizer : [] });
|
|
532
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Radio, status);
|
|
533
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
534
|
+
return this;
|
|
491
535
|
}
|
|
492
536
|
/**
|
|
493
537
|
* Toggles a tremolo effect on the audio.
|
|
@@ -497,10 +541,11 @@ class Filters {
|
|
|
497
541
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
498
542
|
*/
|
|
499
543
|
async tremolo(status) {
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
544
|
+
const oldPlayer = { ...this };
|
|
545
|
+
await this.applyFilter({ property: "vibrato", value: status ? { frequency: 5, depth: 0.5 } : null });
|
|
546
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Tremolo, status);
|
|
547
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
548
|
+
return this;
|
|
504
549
|
}
|
|
505
550
|
/**
|
|
506
551
|
* Toggless a darthvader effect on the audio.
|
|
@@ -510,10 +555,11 @@ class Filters {
|
|
|
510
555
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
511
556
|
*/
|
|
512
557
|
async darthvader(status) {
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
558
|
+
const oldPlayer = { ...this };
|
|
559
|
+
await this.applyFilter({ property: "timescale", value: status ? { speed: 1.0, pitch: 0.5, rate: 1.0 } : null });
|
|
560
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Darthvader, status);
|
|
561
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
562
|
+
return this;
|
|
517
563
|
}
|
|
518
564
|
/**
|
|
519
565
|
* Toggles a daycore effect on the audio.
|
|
@@ -523,10 +569,11 @@ class Filters {
|
|
|
523
569
|
* @returns {this} - Returns the current instance of the Filters class for method chaining.
|
|
524
570
|
*/
|
|
525
571
|
async daycore(status) {
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
572
|
+
const oldPlayer = { ...this };
|
|
573
|
+
await this.applyFilter({ property: "timescale", value: status ? { speed: 0.7, pitch: 0.8, rate: 0.8 } : null });
|
|
574
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Daycore, status);
|
|
575
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
576
|
+
return this;
|
|
530
577
|
}
|
|
531
578
|
/**
|
|
532
579
|
* Toggles a doubletime effect on the audio.
|
|
@@ -536,10 +583,11 @@ class Filters {
|
|
|
536
583
|
* @returns {this} - Returns the current instance of the Filters class for method chaining
|
|
537
584
|
*/
|
|
538
585
|
async doubletime(status) {
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
586
|
+
const oldPlayer = { ...this };
|
|
587
|
+
await this.applyFilter({ property: "timescale", value: status ? { speed: 2.0, pitch: 1.0, rate: 2.0 } : null });
|
|
588
|
+
this.setFilterStatus(Enums_1.AvailableFilters.Doubletime, status);
|
|
589
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
590
|
+
return this;
|
|
543
591
|
}
|
|
544
592
|
/**
|
|
545
593
|
* Toggles the demon effect on the audio.
|
|
@@ -552,6 +600,7 @@ class Filters {
|
|
|
552
600
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
553
601
|
*/
|
|
554
602
|
async demon(status) {
|
|
603
|
+
const oldPlayer = { ...this };
|
|
555
604
|
const filters = status
|
|
556
605
|
? {
|
|
557
606
|
equalizer: filtersEqualizers_1.demonEqualizer,
|
|
@@ -565,6 +614,7 @@ class Filters {
|
|
|
565
614
|
};
|
|
566
615
|
await Promise.all(Object.entries(filters).map(([property, value]) => this.applyFilter({ property: property, value })));
|
|
567
616
|
this.setFilterStatus(Enums_1.AvailableFilters.Demon, status);
|
|
617
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
568
618
|
return this;
|
|
569
619
|
}
|
|
570
620
|
}
|
|
@@ -109,15 +109,12 @@ class Player {
|
|
|
109
109
|
this.queue = new JsonQueue_1.JsonQueue(this.guildId, this.manager);
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
|
-
// if (this.queue instanceof MemoryQueue) {
|
|
113
|
-
// this.queue.previous = [];
|
|
114
|
-
// }
|
|
115
112
|
// Add the player to the manager's player collection.
|
|
116
113
|
this.manager.players.set(options.guildId, this);
|
|
117
114
|
// Set the initial volume.
|
|
118
115
|
this.setVolume(options.volume ?? 100);
|
|
119
116
|
// Initialize the filters.
|
|
120
|
-
this.filters = new Filters_1.Filters(this);
|
|
117
|
+
this.filters = new Filters_1.Filters(this, this.manager);
|
|
121
118
|
// Emit the playerCreate event.
|
|
122
119
|
this.manager.emit(Enums_1.ManagerEventTypes.PlayerCreate, this);
|
|
123
120
|
}
|
|
@@ -270,6 +267,7 @@ class Player {
|
|
|
270
267
|
const oldPlayer = this ? { ...this } : null;
|
|
271
268
|
// Update the player voice channel
|
|
272
269
|
this.voiceChannelId = channel;
|
|
270
|
+
this.options.voiceChannelId = channel;
|
|
273
271
|
this.connect();
|
|
274
272
|
// Emit a player state update event
|
|
275
273
|
this.manager.emit(Enums_1.ManagerEventTypes.PlayerStateUpdate, oldPlayer, this, {
|
|
@@ -301,6 +299,7 @@ class Player {
|
|
|
301
299
|
const oldPlayer = this ? { ...this } : null;
|
|
302
300
|
// Update the text channel property
|
|
303
301
|
this.textChannelId = channel;
|
|
302
|
+
this.options.textChannelId = channel;
|
|
304
303
|
// Emit a player state update event with channel change details
|
|
305
304
|
this.manager.emit(Enums_1.ManagerEventTypes.PlayerStateUpdate, oldPlayer, this, {
|
|
306
305
|
changeType: Enums_1.PlayerStateEventTypes.ChannelChange,
|
package/dist/structures/Utils.js
CHANGED
|
@@ -274,12 +274,13 @@ class AutoPlayUtils {
|
|
|
274
274
|
return [];
|
|
275
275
|
track = resolvedTrack;
|
|
276
276
|
}
|
|
277
|
-
const extractSpotifyArtistID = (url) => {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
};
|
|
282
|
-
const identifier = `sprec:seed_artists=${extractSpotifyArtistID(track.pluginInfo.artistUrl)}&seed_tracks=${track.identifier}`;
|
|
277
|
+
// const extractSpotifyArtistID = (url: string): string | null => {
|
|
278
|
+
// const regex = /https:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)/;
|
|
279
|
+
// const match = url.match(regex);
|
|
280
|
+
// return match ? match[1] : null;
|
|
281
|
+
// };
|
|
282
|
+
// const identifier = `sprec:seed_artists=${extractSpotifyArtistID(track.pluginInfo.artistUrl)}&seed_tracks=${track.identifier}`;
|
|
283
|
+
const identifier = `sprec:mix:track:${track.identifier}`;
|
|
283
284
|
const recommendedResult = (await this.manager.useableNode.rest.get(`/v4/loadtracks?identifier=${encodeURIComponent(identifier)}`));
|
|
284
285
|
const tracks = this.buildTracksFromResponse(recommendedResult, requester);
|
|
285
286
|
return tracks;
|