Class: Player

Player(options)

Represents a Player that connects to a node and interacts with a guild's session.

Constructor

new Player(options)

Creates a new Player instance.
Parameters:
Name Type Description
options Object The options for the Player.
Properties
Name Type Description
guildId string The ID of the guild.
node Object The node to connect to.
Source:

Extends

  • EventEmitter

Members

connectionInfo :Object

The connection information.
Type:
  • Object
Source:

filters :Object

The filters of the player
Type:
  • Object
Default Value:
  • {}
Source:

guildId :string

The ID of the guild.
Type:
  • string
Source:

listeningWebSocket :Object

Listening web socket, works with NodeLink only
Type:
  • Object
Source:

node :string

The node to connect to.
Type:
  • string
Source:

paused :boolean

Whether the player is paused
Type:
  • boolean
Default Value:
  • false
Source:

position :number

The position of the track
Type:
  • number
Default Value:
  • 0
Source:

status :string

The status of the player
Type:
  • string
Default Value:
  • 'stopped'
Source:

track :Object

The track that is currently playing
Type:
  • Object
Source:

volume :number

The volume of the player
Type:
  • number
Default Value:
  • 100
Source:

Methods

(async) clearFilter() → {Object}

Clear filter
Source:
Returns:
- Request result
Type
Object

(async) connect()

Start connection between LavaLink/NodeLink and Discord voice server
Source:

(async) destroy() → {Object}

Destroy this player on the server
Source:
Returns:
- Request result
Type
Object

(async) get() → {Object}

Get this player's information
Source:
Returns:
- This player's information
Type
Object

(async) getFilters() → {Object}

Get filters
Source:
Returns:
- Filters
Type
Object

(async) getVolume() → {number}

Get volume
Source:
Returns:
- Volume
Type
number

handleEvents(data)

Function for handling events
Parameters:
Name Type Description
data Object The data to handle
Source:

handlePlayerUpdate(data) → {Object}

Function for handling player updates
Parameters:
Name Type Description
data Object The data to handle
Source:
Returns:
- This player instance
Type
Object

(async) pause() → {Object}

Pause playing
Source:
Returns:
- Request result
Type
Object

(async) play(data) → {Object}

Plays a track
Parameters:
Name Type Description
data Object The data to play
Properties
Name Type Description
track string The base64 encoded track to play
Source:
Returns:
- Request result
Type
Object

(async) resume() → {Object}

Resume playing
Source:
Returns:
- Request result
Type
Object

(async) seek(int) → {number}

Seek track
Parameters:
Name Type Description
int number The position to seek to
Source:
Returns:
- Request result
Type
number

(async) setFilter(data) → {Object}

Set filter
Parameters:
Name Type Description
data Object The filter to set
Source:
Returns:
- This node instance
Type
Object

(async) setVolume(data) → {Object}

Set volume
Parameters:
Name Type Description
data number The volume to set
Source:
Returns:
- Request result
Type
Object

(async) startListen() → {Object}

Start listening on VC
Source:
Returns:
- An event emitter for listening
Type
Object

(async) stop() → {Object}

Stop playing
Source:
Returns:
- Request result
Type
Object

(async) stopListen() → {Boolean}

Stop listening on VC
Source:
Returns:
Return true if stopped listening
Type
Boolean

(async) update(data, noReplace) → {Object}

Update player data
Parameters:
Name Type Description
data Object The data to update
noReplace boolean Whether to replace the data
Source:
Returns:
- Request result
Type
Object