Player
Table of contents
Constructors
Properties
- current
- filters
- guildId
- moving
- node
- paused
- playing
- position
- queue
- queueRepeat
- selfDeaf
- selfMute
- state
- textChannelId
- trackRepeat
- voiceChannelId
- voiceState
Accessors
Methods
- connect
- destroy
- disconnect
- moveNode
- pause
- ping
- play
- resume
- seek
- sendVoiceUpdate
- setRepeatMode
- setSelfDeaf
- setSelfMute
- setVoiceChannel
- skip
- update
- checkOptions
Constructors
constructor
• new Player(lavashark
, options
)
Create a new Player instance
Parameters
Name | Type | Description |
---|---|---|
lavashark | LavaShark | The lavashark instance |
options | PlayerOptions | The player options |
Defined in
Properties
current
• current: null
| Track
Defined in
filters
• Readonly
filters: Filters
Defined in
guildId
• Readonly
guildId: string
Defined in
moving
• moving: boolean
Defined in
node
• node: null
| Node
Defined in
paused
• paused: boolean
Defined in
playing
• playing: boolean
Defined in
position
• position: number
Defined in
queue
• queue: Queue
Defined in
queueRepeat
• queueRepeat: boolean
Defined in
selfDeaf
• Optional
selfDeaf: boolean
Defined in
selfMute
• Optional
selfMute: boolean
Defined in
state
• state: ConnectionState
Defined in
textChannelId
• Optional
textChannelId: null
| string
Defined in
trackRepeat
• trackRepeat: boolean
Defined in
voiceChannelId
• voiceChannelId: string
Defined in
voiceState
• voiceState: VoiceState
Defined in
Accessors
exactPosition
• get
exactPosition(): number
Gets the exact track position based on the last playerUpdate packet
Returns
number
Defined in
queueDuration
• get
queueDuration(): number
Gets the queue duration in milliseconds
Deprecated
- Use
queue.duration
instead
Returns
number
Defined in
volume
• get
volume(): number
Gets the volume of the player
Returns
number
Defined in
Methods
connect
▸ connect(): void
Connects to the voice channel
Returns
void
Defined in
destroy
▸ destroy(): Promise
<void
>
Destroys the player
Returns
Promise
<void
>
Defined in
disconnect
▸ disconnect(): void
Disconnects from the voice channel
Returns
void
Defined in
moveNode
▸ moveNode(node
): Promise
<void
>
Parameters
Name | Type | Description |
---|---|---|
node | Node | The target node to move the player |
Returns
Promise
<void
>
Defined in
pause
▸ pause(state?
): Promise
<boolean
>
Pause or unpause the player
Parameters
Name | Type | Default value | Description |
---|---|---|---|
state? | boolean | true | Whether to pause or unpause the player |
Returns
Promise
<boolean
>
Defined in
ping
▸ ping(): Promise
<number
>
Gets the latency between lavalink client & node
Returns
Promise
<number
>
- In milliseconds
Defined in
play
▸ play(options?
): Promise
<void
>
Plays a track
Parameters
Name | Type | Description |
---|---|---|
options? | PlayOptions | Play options |
Returns
Promise
<void
>
Defined in
resume
▸ resume(): Promise
<boolean
>
Resume the player
Returns
Promise
<boolean
>
Defined in
seek
▸ seek(position
): Promise
<void
>
Seek to a specific position in the track
Parameters
Name | Type | Description |
---|---|---|
position | number | The position to seek, in milliseconds |
Returns
Promise
<void
>
Defined in
sendVoiceUpdate
▸ sendVoiceUpdate(): Promise
<void
>
Returns
Promise
<void
>
Defined in
setRepeatMode
▸ setRepeatMode(mode
): void
Set repeat mode for this queue
Parameters
Name | Type | Description |
---|---|---|
mode | RepeatMode | The repeat mode to apply |
Returns
void
Defined in
setSelfDeaf
▸ setSelfDeaf(state
): void
Sets the bot's self deaf state
Parameters
Name | Type | Description |
---|---|---|
state | boolean | Whether to self deaf or not |
Returns
void
Defined in
setSelfMute
▸ setSelfMute(state
): void
Sets the bot's self mute state
Parameters
Name | Type | Description |
---|---|---|
state | boolean | Whether to self mute or not |
Returns
void
Defined in
setVoiceChannel
▸ setVoiceChannel(channelId
): void
Sets the player voice channel
Parameters
Name | Type | Description |
---|---|---|
channelId | string | The voice channel id |
Returns
void
Defined in
skip
▸ skip(amount?
): Promise
<boolean
>
Skips the current playing track
Parameters
Name | Type | Description |
---|---|---|
amount? | number | The amount of tracks to skip |
Returns
Promise
<boolean
>
Defined in
update
▸ update(state
): void
Parameters
Name | Type |
---|---|
state | PlayerState |
Returns
void
Defined in
checkOptions
▸ Static
checkOptions(options
): void
Parameters
Name | Type |
---|---|
options | PlayerOptions |
Returns
void