Player

Player

Represents a player/voice connection to Lavalink

Constructor

new Player(id, data)

Source:
Properties:
Name Type Description
id string Guild id for the player
manager PlayerManager Reference to the player manager
node Lavalink Lavalink node the player is connected to
shard object The eris shard the player is associated with
hostname string Hostname of the lavalink node
guildId string Guild ID
channelId string Channel ID
ready boolean If the connection is ready
playing boolean If the player is playing
state object The lavalink player state
track string The lavalink track to play
Player constructor
Parameters:
Name Type Description
id string Guild ID
data Object Player data
Properties
Name Type Attributes Description
channelId string The channel id of the player
guildId string The guild id of the player
hostname string The hostname of the lavalink node
manager PlayerManager The PlayerManager associated with this player
node Lavalink The Lavalink node associated with this player
shard Shard The eris shard associated with this player
options Object <optional>
Additional passed from the user to the player

Extends

  • EventEmitter

Methods

connect(data) → {void}

Source:
Connect to the Lavalink node
Parameters:
Name Type Description
data Object The data used to connect
Properties
Name Type Description
guildId string The guild ID to connect
sessionId string The voice connection session ID
event object The event data from the voice server update
Returns:
Type
void

(async) disconnect(msgopt) → {void}

Source:
Disconnect from Lavalink
Parameters:
Name Type Attributes Description
msg * <optional>
An optional disconnect message
Returns:
Type
void

play(track, optionsopt) → {void}

Source:
Play a Lavalink track
Parameters:
Name Type Attributes Description
track string The track to play
options Object <optional>
Optional options to send
Returns:
Type
void

seek(position) → {void}

Source:
Used for seeking to a track position
Parameters:
Name Type Description
position number The position to seek to
Returns:
Type
void

setPause(pause) → {void}

Source:
Used to pause/resume the player
Parameters:
Name Type Description
pause boolean Set pause to true/false
Returns:
Type
void

setVolume(volume) → {void}

Source:
Set the volume of the player
Parameters:
Name Type Description
volume number The volume level to set
Returns:
Type
void

stop() → {void}

Source:
Stop playing
Returns:
Type
void

switchChannel(channelId, reactiveopt) → {void}

Source:
Switch voice channel
Parameters:
Name Type Attributes Description
channelId string Called when switching channels
reactive boolean <optional>
Used if you want the bot to switch channels
Returns:
Type
void