aqualink 2.16.0 → 2.16.1
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.
|
@@ -31,7 +31,13 @@ const AqualinkEvents = {
|
|
|
31
31
|
PlayerCreate: 'playerCreate',
|
|
32
32
|
PlayerDestroy: 'playerDestroy',
|
|
33
33
|
PlayersRebuilt: 'playersRebuilt',
|
|
34
|
+
VolumeChanged: 'volumeChanged',
|
|
35
|
+
FiltersChanged: 'filtersChanged',
|
|
36
|
+
Seek: 'seek',
|
|
37
|
+
PlayerCreated: 'playerCreated',
|
|
38
|
+
PlayerConnected: 'playerConnected',
|
|
39
|
+
PlayerDestroyed: 'playerDestroyed',
|
|
34
40
|
PlayerMigrated: 'playerMigrated'
|
|
35
41
|
};
|
|
36
42
|
|
|
37
|
-
module.exports = { AqualinkEvents };
|
|
43
|
+
module.exports = { AqualinkEvents };
|
|
@@ -21,6 +21,9 @@ const EVENT_HANDLERS = Object.freeze({
|
|
|
21
21
|
VolumeChangedEvent: 'volumeChanged',
|
|
22
22
|
FiltersChangedEvent: 'filtersChanged',
|
|
23
23
|
SeekEvent: 'seekEvent',
|
|
24
|
+
PlayerCreatedEvent: 'playerCreated',
|
|
25
|
+
PlayerConnectedEvent: 'playerConnected',
|
|
26
|
+
PlayerDestroyedEvent: 'playerDestroyed',
|
|
24
27
|
LyricsNotFoundEvent: 'lyricsNotFound'
|
|
25
28
|
})
|
|
26
29
|
|
|
@@ -459,8 +462,7 @@ class Player extends EventEmitter {
|
|
|
459
462
|
seek(position) {
|
|
460
463
|
if (this.destroyed || !this.playing || !_functions.isNum(position)) return this
|
|
461
464
|
const len = this.current?.info?.length || 0
|
|
462
|
-
const
|
|
463
|
-
const clamped = len ? Math.min(Math.max(pos, 0), len) : Math.max(pos, 0)
|
|
465
|
+
const clamped = len ? Math.min(Math.max(position, 0), len) : Math.max(position, 0)
|
|
464
466
|
this.position = clamped
|
|
465
467
|
this.batchUpdatePlayer({guildId: this.guildId, position: clamped}, true).catch(() => {})
|
|
466
468
|
return this
|
|
@@ -555,6 +557,11 @@ class Player extends EventEmitter {
|
|
|
555
557
|
return null
|
|
556
558
|
}
|
|
557
559
|
|
|
560
|
+
async getLoadLyrics(encodedTrack) {
|
|
561
|
+
if (this.destroyed || !this.nodes?.rest) return null
|
|
562
|
+
return this.nodes.rest.getLoadLyrics(encodedTrack)
|
|
563
|
+
}
|
|
564
|
+
|
|
558
565
|
subscribeLiveLyrics() {
|
|
559
566
|
return this.destroyed ? Promise.reject(new Error('Player destroyed')) : this.nodes?.rest?.subscribeLiveLyrics(this.guildId, false)
|
|
560
567
|
}
|
|
@@ -849,6 +856,20 @@ class Player extends EventEmitter {
|
|
|
849
856
|
this.aqua.emit(AqualinkEvents.LyricsNotFound, this, track, payload)
|
|
850
857
|
}
|
|
851
858
|
|
|
859
|
+
async playerCreated(player, track, payload) {
|
|
860
|
+
if (this.destroyed) return
|
|
861
|
+
this.aqua.emit(AqualinkEvents.PlayerCreated, this, payload)
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
async playerConnected(player, track, payload) {
|
|
865
|
+
if (this.destroyed) return
|
|
866
|
+
this.aqua.emit(AqualinkEvents.PlayerConnected, this, payload)
|
|
867
|
+
}
|
|
868
|
+
async playerDestroyed(player, track, payload) {
|
|
869
|
+
if (this.destroyed) return
|
|
870
|
+
this.aqua.emit(AqualinkEvents.PlayerDestroyed, this, payload)
|
|
871
|
+
}
|
|
872
|
+
|
|
852
873
|
_handleAquaPlayerMove(oldChannel, newChannel) {
|
|
853
874
|
if (_functions.toId(oldChannel) !== _functions.toId(this.voiceChannel)) return
|
|
854
875
|
this.voiceChannel = _functions.toId(newChannel)
|
|
@@ -894,4 +915,4 @@ class Player extends EventEmitter {
|
|
|
894
915
|
}
|
|
895
916
|
}
|
|
896
917
|
|
|
897
|
-
module.exports = Player
|
|
918
|
+
module.exports = Player
|