From 705443fa7ed9c24bdb8e8fb976102c2255397fbe Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Sat, 24 Apr 2021 00:12:51 +0545 Subject: [PATCH] jump peature --- src/Player.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Player.ts b/src/Player.ts index 1455a6d..eca3af4 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -970,6 +970,22 @@ export class Player extends EventEmitter { }; } + /** + * Jumps to particular track + * @param {DiscordMessage} message The message + * @param {Track|number} track The track to jump to + * @returns {boolean} + */ + jump(message: Message, track: Track | number): boolean { + const toJUMP = this.remove(message, track); + const queue = this.getQueue(message); + if (!toJUMP || !queue) throw new PlayerError('Track not found'); + + queue.tracks.splice(1, 0, toJUMP); + + return this.skip(message); + } + private _handleVoiceStateUpdate(oldState: VoiceState, newState: VoiceState): void { const queue = this.queues.find((g) => g.guildID === oldState.guild.id); if (!queue) return;