From 67abd09209ca61dbb71b957a763d5c223b6ea15c Mon Sep 17 00:00:00 2001 From: "Vijay Meena (Samar)" Date: Mon, 17 Jun 2024 23:34:59 +0530 Subject: [PATCH] refactor(lava-queue): new getters (#1050) --- packages/lava-queue/CHANGELOG.md | 6 ++++++ packages/lava-queue/package.json | 2 +- packages/lava-queue/src/queue.ts | 21 ++++++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/packages/lava-queue/CHANGELOG.md b/packages/lava-queue/CHANGELOG.md index 44382058d..4de12263c 100644 --- a/packages/lava-queue/CHANGELOG.md +++ b/packages/lava-queue/CHANGELOG.md @@ -1,5 +1,11 @@ # @discordx/lava-queue +## 4.0.1 + +### Patch Changes + +- new getters + ## 4.0.0 ### Minor Changes diff --git a/packages/lava-queue/package.json b/packages/lava-queue/package.json index 7610356a9..bc870390c 100644 --- a/packages/lava-queue/package.json +++ b/packages/lava-queue/package.json @@ -1,6 +1,6 @@ { "name": "@discordx/lava-queue", - "version": "4.0.0", + "version": "4.0.1", "private": false, "description": "Queue system for @discordx/lava-player", "keywords": [ diff --git a/packages/lava-queue/src/queue.ts b/packages/lava-queue/src/queue.ts index 1a3b64255..c1cbe68f6 100644 --- a/packages/lava-queue/src/queue.ts +++ b/packages/lava-queue/src/queue.ts @@ -77,6 +77,22 @@ export class Queue { return this.queueManager.node.guildPlayerStore.get(this.guildId); } + get http() { + return this.guildPlayer.http; + } + + get node() { + return this.guildPlayer.node; + } + + get rest() { + return this.guildPlayer.rest; + } + + get sessionId() { + return this.node.sessionId; + } + constructor( private queueManager: QueueManager, public guildId: string, @@ -161,8 +177,7 @@ export class Queue { return null; } - const player = this.queueManager.node.guildPlayerStore.get(this.guildId); - await player.update({ track: { encoded: track.encoded } }); + await this.guildPlayer.update({ track: { encoded: track.encoded } }); this._currentPlaybackTrack = track; return track; } @@ -190,7 +205,7 @@ export class Queue { * @returns The response from the Lavalink search. */ search(text: string): Promise { - return this.guildPlayer.rest.loadTracks(text); + return this.rest.loadTracks(text); } /**