Player
Automata's Player is the main hub for everything regarding audio playback just like the cozy jukebox in Stardew Valley.
Constructor
new Player(automata: Manager, node: Node, options: ConnectionOptions)
Properties
.node
The player's node.
Type: Node
.options
The connection options for the player.
Type: ConnectionOptions
.queue
The Queue instance.
Type: Queue
.filters
The Filters instance.
Type: Filters
.guildId
The ID of the voice channel the player is connected to.
Type: String
.voiceChannel
The ID of the voice channel the player is connected to.
Type: String
.textChannel
The ID of the text channel associated with the player.
Type: String
.ping
The current ping to the audio node.
Type: Number
.isPlaying
Indicates if the player is playing or not.
Type: Boolean
.isPaused
Indicates if the player is paused or not.
Type: Boolean
.isConnected
Indicates if the player is connected or not.
Type: Boolean
.loop
The current loop the player is on.
Type: String
.nowPlayingMessage
The now playing message.
Type: NowPlayingMessage
Methods
.play()
Starts the playing the requested song.
Returns: void
Exemple
/** Must be present in your bot's ready.js. */
<Player>.play()
.connect(options)
Connects to the user's voice channel.
Parameter | Type | Description |
---|---|---|
options | ConnectionOptions | The options need for the player to connect to the voice channel. |
Returns: void
NOTE: These options are already populated via the options: ConnectionOptions = this
parameter that is passed to the function, so you don't have to specfify any parameters.
Exemple
<Player>.connect();
.stop()
Stops the player from playing.
Returns: void
Exemple
<Player>.stop()
.pause(toggle)
Pauses the player.
Parameter | Type | Description |
---|---|---|
toggle | Boolean | The value indicating if the player is paused or not. Use false to unpause and true to pause. |
Returns: Boolean
Exemple:
<Player>.pause(true)
.seekTo(position)
Seeks the track to the provided position.
Parameter | Type | Description |
---|---|---|
position | Number | The position where the player will seek to. |
Returns: void
Exemple:
<Player>.seekTo(120);
.setVolume(volume)
Sets the volume of the player.
Parameter | Type | Description |
---|---|---|
volume | Number | The new volume that will be set. |
Exemple:
<Player>.setVolume(100);
.setLoop(mode)
Sets the current loop.
Parameter | Type | Description |
---|---|---|
mode | String | The new loop mode that will be set. |
Returns: Loop
Exemple:
<Player>.setLoop('TRACK');
.setTextChannel(channel)
Sets the text channel where event messages (trackStart, trackEnd etc.) will be sent.
Parameter | Type | Description |
---|---|---|
channel | String | The new text channel. |
Returns: TextChannel
Exemple:
<Player>.setTextChannel(channel);
.setNowPlayingMessage(message)
Sets the now playing message.
Parameter | Type | Description |
---|---|---|
message | NowPlayingMessage | The now playing message. |
Returns: NowPlayingMessage
Exemple:
<Player>.setNowPlayingMessage(message);
.setVoiceChannel(channel)
Sets the voice channel.
Parameter | Type | Description |
---|---|---|
channel | String | The new voice channel. |
Returns: VoiceChannel
Exemple:
<Player>.setVoiceChannel(channel);
.disconnect()
Disconnects the player.
Returns: void
Exemple:
<Player>.disconnect();
.destroy()
Destroys the player.
Returns: void
Exemple:
<Player>.destroy();
.restart()
Restarts the currently playing song.
Returns: void
Exemple:
<Player>.restart();
.setTextChannel(channel, options)
Sets the text channel where event messages (trackStart, trackEnd etc.) will be sent.
Parameter | Type | Description |
---|---|---|
channel | String | The new text channel. |
Returns: TextChannel
Exemple:
<Player>.setTextChannel(channel);
.send(data)
Sends the raw provided data to the Lavalink node.
Parameter | Type | Description |
---|---|---|
data | Object | The object containing the data. |
Returns: void
Exemple:
<Player>.setTextChannel(channel);