Player
Controls a guild's queue and playback. Native helpers operate on this player's node; they do not reroute the player to another backend.
Signatures below match the public source surface in 2.10.3. Use manager/player factories for ordinary application setup.
Constructorโ
constructor(public options: PlayerOptions);
Propertiesโ
Methodsโ
initโ
public static init(manager: Manager): void;
Initializes the static properties of the Player class.
setโ
public set(key: string, value: unknown): void;
Set custom data.
getโ
public get<T>(key: string): T;
Retrieves custom data associated with a given key.
searchโ
public async search<T = unknown>(query: string | SearchQuery, requester?: T): Promise<SearchResult>;
Delegates to manager.search(); it does not constrain search selection to this player's node.
connectโ
public connect(): void;
Connects the player to the voice channel.
disconnectโ
public async disconnect(): Promise<this>;
Disconnects the player from the voice channel.
destroyโ
public async destroy(disconnect: boolean = true): Promise<boolean>;
Destroys the player and clears the queue.
setVoiceChannelIdโ
public setVoiceChannelId(channel: string): this;
Sets the player voice channel.
setTextChannelIdโ
public setTextChannelId(channel: string): this;
Sets the player text channel.
setNowPlayingMessageโ
public setNowPlayingMessage(message: AnyMessage): AnyMessage;
Sets the now playing message.
playโ
public async play(): Promise<Player>;
public async play(track: Track): Promise<Player>;
public async play(options: PlayOptions): Promise<Player>;
public async play(track: Track, options: PlayOptions): Promise<Player>;
public async play(optionsOrTrack?: PlayOptions | Track, playOptions?: PlayOptions): Promise<Player>;
Plays the next track.
preloadNextTrackโ
public async preloadNextTrack(track: Track | null, options: NodeLinkNextTrackOptions = {}): Promise<this>;
Sets or clears the native preload. Does not enqueue the track; align the next local queue entry yourself.
setNodeLinkFadingโ
public async setNodeLinkFading(fading: NodeLinkFadingConfig): Promise<this>;
Updates NodeLink playback fading behavior.
setNodeLinkLoudnessNormalizerโ
public async setNodeLinkLoudnessNormalizer(enabled: boolean): Promise<this>;
Enables or disables NodeLink loudness normalization.
setAutoplayโ
public setAutoplay<T = unknown>(autoplayState: boolean, AutoplayUser?: T, tries?: number): this;
Changes autoplay mode, requester, and retry count. These are included in saved/restored state.
getRecommendedTracksโ
public async getRecommendedTracks(track: Track): Promise<Track[]>;
Loads recommendations with source/fallback logic; it does not guarantee selection of this player's own node.
getChaptersโ
public async getChapters(track?: Track): Promise<NodeLinkChapter[]>;
Loads chapters for the current or provided track using NodeLink.
getNodeLinkChaptersโ
public async getNodeLinkChapters(track?: Track): Promise<NodeLinkChapter[]>;
Loads chapters for the current or provided track using NodeLink.
getNodeLinkMeaningโ
public async getNodeLinkMeaning(track?: Track, language: string = "en"): Promise<NodeLinkMeaningResult>;
Loads NodeLink meaning/background information for the current or provided track.
addMixโ
public async addMix(track: Track, volume?: number): Promise<NodeLinkMix>;
Adds a NodeLink audio mix layer over the current playback.
addNodeLinkMixโ
public async addNodeLinkMix(track: Track, volume?: number): Promise<NodeLinkMix>;
Adds a NodeLink audio mix layer over the current playback.
getMixesโ
public async getMixes(): Promise<NodeLinkMix[]>;
Gets the active NodeLink audio mix layers.
getNodeLinkMixesโ
public async getNodeLinkMixes(): Promise<NodeLinkMix[]>;
Gets the active NodeLink audio mix layers.
updateMixโ
public async updateMix(mixId: string, volume: number): Promise<void>;
Updates a NodeLink audio mix layer volume.
updateNodeLinkMixโ
public async updateNodeLinkMix(mixId: string, volume: number): Promise<void>;
Updates a NodeLink audio mix layer volume.
removeMixโ
public async removeMix(mixId: string): Promise<void>;
Removes a NodeLink audio mix layer.
removeNodeLinkMixโ
public async removeNodeLinkMix(mixId: string): Promise<void>;
Removes a NodeLink audio mix layer.
setVolumeโ
public async setVolume(volume: number): Promise<this>;
Sets main-player volume on the 0-1000 scale (0-500 in filter mode), not the mix-layer 0-1 scale.
setSponsorBlockโ
public async setSponsorBlock(segments: SponsorBlockSegment[] = [SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]): Promise<void>;
Sets the sponsorblock for the player. This will set the sponsorblock segments for the player to the given segments.
getSponsorBlockโ
public async getSponsorBlock(): Promise<SponsorBlockSegment[]>;
Gets the sponsorblock for the player.
getNodeLinkSponsorBlockStateโ
public async getNodeLinkSponsorBlockState(): Promise<NodeLinkSponsorBlockState>;
Returns the complete NodeLink SponsorBlock state.
updateNodeLinkSponsorBlockโ
public async updateNodeLinkSponsorBlock(update: NodeLinkSponsorBlockUpdate): Promise<NodeLinkSponsorBlockState>;
Updates NodeLink SponsorBlock categories, actions, margin, or enabled state.
setNodeLinkSponsorBlockSegmentsโ
public async setNodeLinkSponsorBlockSegments(segments: NodeLinkSponsorBlockSegment[]): Promise<NodeLinkSponsorBlockState>;
Replaces NodeLink's SponsorBlock segments with an explicit segment list.
deleteSponsorBlockโ
public async deleteSponsorBlock(): Promise<void>;
Deletes the sponsorblock for the player. This will remove all sponsorblock segments that have been set for the player.
setTrackRepeatโ
public setTrackRepeat(repeat: boolean): this;
Sets the track repeat mode.
setQueueRepeatโ
public setQueueRepeat(repeat: boolean): this;
Sets the queue repeat.
setDynamicRepeatโ
public async setDynamicRepeat(repeat: boolean, ms: number): Promise<this>;
Sets the queue to repeat and shuffles the queue after each song.
restartโ
public async restart(): Promise<Player>;
Restarts the currently playing track from the beginning.
stopโ
public async stop(amount?: number): Promise<this>;
Stops the player and optionally removes tracks from the queue.
pauseโ
public async pause(pause: boolean): Promise<this>;
Pauses or resumes playback according to the boolean argument.
previousโ
public async previous(addBackToQueue: boolean = true): Promise<this>;
Skips to the previous track in the queue.
seekโ
public async seek(position: number): Promise<this>;
Seeks to a given position in the currently playing track.
autoMoveNodeโ
public async autoMoveNode(): Promise<Player | void>;
Automatically moves the player to a usable node.
moveNodeโ
public async moveNode(identifier: string): Promise<Player>;
Moves the player to another node.
getDataโ
public getData(): Record<string, unknown>;
Retrieves the data associated with the player.
getDynamicLoopIntervalPublicโ
public getDynamicLoopIntervalPublic(): NodeJS.Timeout | null;
Retrieves the dynamic loop interval of the player.
getSerializableDataโ
public getSerializableData(): Record<string, unknown>;
Retrieves the data associated with the player.
getCurrentLyricsโ
public async getCurrentLyrics(skipTrackSource: boolean = false): Promise<Lyrics>;
Loads current-track lyrics. The declared return type is Lyrics, but NodeLink's native result is currently returned without normalization; prefer node.getLyrics() and narrow its union.
setupVoiceReceiverโ
public async setupVoiceReceiver(): Promise<void>;
Opens the NodeLink voice socket. The server must enable voice receive; typed live events contain binary audio.
removeVoiceReceiverโ
public async removeVoiceReceiver(): Promise<void>;
Closes the NodeLink voice receiver and clears speaking buffers.
updateVoiceโ
public async updateVoice(): Promise<void>;
Updates the voice state for the player.
Types and Guidesโ
- IQueue
- Filters
- Node
- AnyMessage
- StateTypes
- Manager
- SearchQuery
- SearchResult
- Track
- PlayOptions
- NodeLinkNextTrackOptions
- NodeLinkFadingConfig
- NodeLinkChapter
- NodeLinkMeaningResult
- NodeLinkMix
- SponsorBlockSegment
- NodeLinkSponsorBlockState
- NodeLinkSponsorBlockUpdate
- NodeLinkSponsorBlockSegment
- Lyrics
- NodeLink feature guides