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.5. 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