UNPKG

@ariijs/lavalink-client

Version:

arii "plugin" / extras for lavalink-client package. fully compatible with commonjs and esm enviroments.

71 lines (70 loc) 3.26 kB
import { ManagerQueueOptions, ManagerUtils, Queue as Qe, QueueChangesWatcher, QueueSaver, StoredQueue, Track, UnresolvedTrack } from "lavalink-client"; import { TrackOrTracks, QueueResult } from "../types/index.js"; import { LavalinkManager } from "../manager/lavalinkManager.js"; export declare class Queue extends Qe { protected isShuffled: boolean; backup: (Track | UnresolvedTrack)[]; protected managerUtilsCustom: ManagerUtils; protected queueChangesCustom: QueueChangesWatcher | null; protected readonly guildIdCustom: string; protected readonly manager: LavalinkManager; constructor(guildId: string, manager: LavalinkManager, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueOptions?: ManagerQueueOptions); /** returns true if the queue is shuffled */ get shuffled(): boolean; /** * leaves the queue empty and sets the given tracks to the queue * @example * ```ts * player.queue.setTracks([track1, track2, track3]); // sets tracks * player.queue.setTracks(); // clears tracks * ``` */ setTracks(trackOrTracks?: TrackOrTracks): Promise<void>; /** * leaves the previous tracks empty and sets the given tracks to the previous tracks * @example * ```ts * player.queue.setPrevious([track1, track2, track3]); // sets tracks * player.queue.setPrevious(); // clears tracks * ``` */ setPrevious(trackOrTracks?: Track | Track[]): Promise<void>; /** * Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks * @param TrackOrTracks Track or Tracks to add to the queue * @param index At what position to add the Track * @returns previous tracks, current track, next tracks and tracks added */ add(trackOrTracks: TrackOrTracks, index?: number): Promise<QueueResult>; /** * Splice the tracks in the Queue * @param start Where to remove the Track * @param deleteCount How many Tracks to remove? * @param TrackOrTracks Want to Add more Tracks? * @returns previous tracks, current track, next tracks and tracks added if any */ splice(start: number, deleteCount: number, trackOrTracks?: TrackOrTracks): Promise<QueueResult>; /** * Shuffles the current Queue, then saves it. * This method simply shuffles the next tracks. Consider using toggleShuffle() for a more advanced implementation. */ shuffle(): Promise<number>; /** * enables/disables shuffle of the entire queue * @param [shuffle=false] - true to simply shuffle the queue. this will shuffle the queue and won't be reversible. DON'T SET THIS TO TRUE IF you only want to toggle on shuffle mode. useful when you want to re-shuffle the queue when it's already shuffled on. * @returns previous tracks, current track and next tracks in the queue */ toggleShuffle(shuffle?: boolean): Promise<QueueResult>; private shuffleTracks; private shufflePrevious; /** * Adds tracks to the backup array. * @param tracks Tracks to add to the backup. */ private pushToBackup; /** * Adds tracks to the backup array. * @param tracks Tracks to add to the backup. */ private unshiftToBackup; }