Skip to main content
Version: v2.0.0

Player

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Player(lavashark, options)

Create a new Player instance

Parameters

NameTypeDescription
lavasharkLavaSharkThe lavashark instance
optionsPlayerOptionsThe player options

Defined in

lib/Player.ts:88

Properties

current

current: null | Track

Defined in

lib/Player.ts:47


filters

Readonly filters: Filters

Defined in

lib/Player.ts:37


guildId

Readonly guildId: string

Defined in

lib/Player.ts:36


moving

moving: boolean

Defined in

lib/Player.ts:60


node

node: null | Node

Defined in

lib/Player.ts:39


paused

paused: boolean

Defined in

lib/Player.ts:55


playing

playing: boolean

Defined in

lib/Player.ts:54


position

position: number

Defined in

lib/Player.ts:52


queue

queue: Queue

Defined in

lib/Player.ts:48


repeatMode

repeatMode: RepeatMode

Defined in

lib/Player.ts:50


selfDeaf

Optional selfDeaf: boolean

Defined in

lib/Player.ts:44


selfMute

Optional selfMute: boolean

Defined in

lib/Player.ts:45


state

state: ConnectionState

Defined in

lib/Player.ts:57


textChannelId

Optional textChannelId: null | string

Defined in

lib/Player.ts:42


voiceChannelId

voiceChannelId: string

Defined in

lib/Player.ts:41


voiceState

voiceState: VoiceState

Defined in

lib/Player.ts:58

Accessors

exactPosition

get exactPosition(): number

Gets the exact track position based on the last playerUpdate packet

Returns

number

Defined in

lib/Player.ts:126


queueDuration

get queueDuration(): number

Gets the queue duration in milliseconds

Returns

number

Deprecated

  • Use queue.duration instead

Defined in

lib/Player.ts:141


volume

get volume(): number

Gets the volume of the player

Returns

number

Defined in

lib/Player.ts:148

Methods

addTracks

addTracks(tracks, requester): void

Adds one or more tracks to the queue

Parameters

NameTypeDescription
tracksdefaultTrack
requesterUserThe requester of the track(s)

Returns

void

Defined in

lib/Player.ts:168


connect

connect(): Promise<void>

Connects to the voice channel

Returns

Promise<void>

Defined in

lib/Player.ts:187


destroy

destroy(): void

Destroys the player

Returns

void

Defined in

lib/Player.ts:228


disconnect

disconnect(): void

Disconnects from the voice channel

Returns

void

Defined in

lib/Player.ts:209


moveNode

moveNode(node): Promise<void>

Parameters

NameTypeDescription
nodeNodeThe target node to move the player

Returns

Promise<void>

Defined in

lib/Player.ts:246


pause

pause(state?): Promise<boolean>

Pause or unpause the player

Parameters

NameTypeDefault valueDescription
state?booleantrueWhether to pause or unpause the player

Returns

Promise<boolean>

Defined in

lib/Player.ts:346


ping

ping(): Promise<number>

Gets the latency between lavalink client & node

Returns

Promise<number>

  • In milliseconds

Defined in

lib/Player.ts:285


play

play(options?): Promise<void>

Plays a track

Parameters

NameTypeDescription
options?PlayOptionsPlay options

Returns

Promise<void>

Defined in

lib/Player.ts:307


resume

resume(): Promise<boolean>

Resume the player

Returns

Promise<boolean>

Defined in

lib/Player.ts:370


seek

seek(position): Promise<void>

Seek to a specific position in the track

Parameters

NameTypeDescription
positionnumberThe position to seek, in milliseconds

Returns

Promise<void>

Defined in

lib/Player.ts:406


sendVoiceUpdate

sendVoiceUpdate(): Promise<void>

Returns

Promise<void>

Defined in

lib/Player.ts:503


setRepeatMode

setRepeatMode(mode): void

Set repeat mode for this queue

Parameters

NameTypeDescription
modeRepeatModeThe repeat mode to apply

Returns

void

Defined in

lib/Player.ts:426


setSelfDeaf

setSelfDeaf(state): void

Sets the bot's self deaf state

Parameters

NameTypeDescription
statebooleanWhether to self deaf or not

Returns

void

Defined in

lib/Player.ts:468


setSelfMute

setSelfMute(state): void

Sets the bot's self mute state

Parameters

NameTypeDescription
statebooleanWhether to self mute or not

Returns

void

Defined in

lib/Player.ts:481


setVoiceChannel

setVoiceChannel(channelId): void

Sets the player voice channel

Parameters

NameTypeDescription
channelIdstringThe voice channel id

Returns

void

Defined in

lib/Player.ts:494


skip

skip(amount?): Promise<boolean>

Skips the current playing track

Parameters

NameTypeDescription
amount?numberThe amount of tracks to skip

Returns

Promise<boolean>

Defined in

lib/Player.ts:378


update

update(state): void

Update player state

Parameters

NameTypeDescription
statePlayerStateplayerUpdate event

Returns

void

Inner

Defined in

lib/Player.ts:526


checkOptions

checkOptions(options): void

Parameters

NameType
optionsPlayerOptions

Returns

void

Defined in

lib/Player.ts:65