Player
Represents an active audio session for a specific guild. It controls playback, queue management, filters, and voice connection state.
The Player class is the heart of the audio session. Every guild playing music has one Player instance. It manages the queue, controls the playback flow (play, pause, skip), and handles voice channel connections.
Properties
Player Properties
Core state and configuration for the audio player.
References
The main Moonlink Manager instance.
The Lavalink node currently handling this player.
The queue of tracks waiting to be played.
Audio filter controls (equalizer, karaoke, timescale, etc.).
Configuration
The ID of the guild this player belongs to.
The ID of the currently connected voice channel.
The ID of the text channel used for updates.
Current volume (0-1000). Default: 100.
Loop mode: 'off', 'track', or 'queue'.
Whether auto-play is enabled.
State
True if a track is currently playing.
True if playback is paused.
True if connected to a voice channel.
The track currently being played.
History of previously played tracks.
Methods
connect(options)
connect(options)#
→Promise<this>Connects the player to the voice channel specified in voiceChannelId.
Optional voice state settings.
options
Whether to deafen the bot on join. Default: true.
Whether to mute the bot on join. Default: false.
disconnect()
disconnect()#
→Promise<this>Disconnects the player from the voice channel but keeps the player instance active (paused).
play(options)
play(options)#
→Promise<boolean>Starts playback. If a track is provided, it is added to the queue. If the queue is not empty, it starts playing.
The track to play or play options.
PlayOptions
The track object to play.
Alternatively, a base64 encoded track string.
If true, will not replace the currently playing track.
pause()
resume()
stop()
skip(position)
skip(position)#
→Promise<boolean>Skips the current track. If position is provided, it skips to that specific index in the queue.
Optional. The index in the queue to skip to.
seek(position)
seek(position)#
→Promise<this>Seeks to a specific position in the current track.
The position in milliseconds.
setVolume(volume)
setVolume(volume)#
→thisSets the playback volume.
Volume level (0-1000).
setLoop(loop)
setLoop(loop)#
→thisSets the loop mode.
Mode: 'off', 'track', or 'queue'.
shuffle()
destroy()
Totally destroys the player, disconnects voice, and cleans up data on the node.
transferNode(node)
transferNode(node)#
→Promise<boolean>Moves the player to a different Lavalink node seamlessly.
The target node or its identifier.