FastLink 2.3.5
Public Member Functions | List of all members
Player Class Reference

Public Member Functions

 constructor (guildId)
 
 createPlayer ()
 
 playerCreated ()
 
 connect (voiceId, options, sendPayload)
 
 loadTrack (search)
 
 loadCaptions (track, lang)
 
 update (body, noReplace)
 
 destroy ()
 
 updateSession (data)
 
 getQueue ()
 
 skipTrack ()
 
 decodeTrack (track)
 
 decodeTracks (tracks)
 

Detailed Description

Represents a player for an audio streaming service.

Member Function Documentation

◆ connect()

Player::connect (   voiceId,
  options,
  sendPayload 
)
inline

Connects to a voice channel.

Parameters
voiceIdThe ID of the voice channel to connect to.
optionsOptions for the connection, deaf or mute.
sendPayloadA function for sending payload data.
Exceptions
ErrorIf the voiceId or sendPayload is not provided, or if they are of invalid type.

◆ constructor()

Player::constructor (   guildId)
inline

Constructs a Player object.

Parameters
guildIdThe ID of the guild that will be associated with the player.
Exceptions
ErrorIf the guildId is not provided, or if they are of invalid type.

◆ createPlayer()

Player::createPlayer ( )
inline

Creates a player for the guild.

Exceptions
ErrorIf a player already exists for the guild.

◆ decodeTrack()

Player::decodeTrack (   track)
inline

Decodes a track.

Parameters
trackThe array to decode.
Exceptions
ErrorIf a track is not provided or if track is not a string.
Returns
A Promise that resolves to the decoded data.

◆ decodeTracks()

Player::decodeTracks (   tracks)
inline

Decodes an array of tracks.

Parameters
tracksThe array of tracks to decode.
Exceptions
ErrorIf no tracks are provided or if tracks is not an array.
Returns
A Promise that resolves to the decoded data.

◆ destroy()

Player::destroy ( )
inline

Destroys the player.

◆ getQueue()

Player::getQueue ( )
inline

Gets the queue of tracks.

Returns
The queue of tracks.
Exceptions
ErrorIf the queue is disabled.

◆ loadCaptions()

Player::loadCaptions (   track,
  lang 
)
inline

Loads captions for a given track.

Parameters
trackThe track to load captions for.
langThe language to load captions for. Optional.
Exceptions
ErrorIf the track is not provided or is of invalid type.
Returns
A Promise that resolves to the loaded captions data.

◆ loadTrack()

Player::loadTrack (   search)
inline

Loads a track.

Parameters
searchThe search query for the track.
Returns
The loaded track data.
Exceptions
ErrorIf the search is not provided or is of invalid type.

◆ playerCreated()

Player::playerCreated ( )
inline

Verifies if a player exists for the guild.

Returns
The boolean if the player exists or not.

◆ skipTrack()

Player::skipTrack ( )
inline

Skips the currently playing track.

Returns
The queue of tracks, or null if there is no queue.
Exceptions
ErrorIf the queue is disabled

◆ update()

Player::update (   body,
  noReplace 
)
inline

Updates the player state.

Parameters
bodyThe body of the update request.
noReplaceFlag to specify whether to replace the existing track or not. Optional.
Exceptions
ErrorIf the body is not provided or is of invalid type.

◆ updateSession()

Player::updateSession (   data)
inline

Updates the session data for the player.

Parameters
dataThe session data to update.
Exceptions
ErrorIf the data is not provided or is of invalid type.

The documentation for this class was generated from the following file: