Skip to main content
Version: v2.1.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:48


filters

Readonly filters: Filters

Defined in

lib/Player.ts:38


guildId

Readonly guildId: string

Defined in

lib/Player.ts:37


moving

moving: boolean

Defined in

lib/Player.ts:61


node

node: null | Node

Defined in

lib/Player.ts:40


paused

paused: boolean

Defined in

lib/Player.ts:56


playing

playing: boolean

Defined in

lib/Player.ts:55


position

position: number

Defined in

lib/Player.ts:53


queue

queue: Queue

Defined in

lib/Player.ts:49


repeatMode

repeatMode: RepeatMode

Defined in

lib/Player.ts:51


selfDeaf

Optional selfDeaf: boolean

Defined in

lib/Player.ts:45


selfMute

Optional selfMute: boolean

Defined in

lib/Player.ts:46


state

state: ConnectionState

Defined in

lib/Player.ts:58


textChannelId

Optional textChannelId: null | string

Defined in

lib/Player.ts:43


voiceChannelId

voiceChannelId: string

Defined in

lib/Player.ts:42


voiceState

voiceState: VoiceState

Defined in

lib/Player.ts:59

Accessors

exactPosition

get exactPosition(): number

Gets the exact track position based on the last playerUpdate packet

Returns

number

Defined in

lib/Player.ts:127


queueDuration

get queueDuration(): number

Gets the queue duration in milliseconds

Returns

number

Deprecated

  • Use queue.duration instead

Defined in

lib/Player.ts:142


volume

get volume(): number

Gets the volume of the player

Returns

number

Defined in

lib/Player.ts:149

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:169


connect

connect(): Promise<void>

Connects to the voice channel

Returns

Promise<void>

Defined in

lib/Player.ts:188


destroy

destroy(): void

Destroys the player

Returns

void

Defined in

lib/Player.ts:229


disconnect

disconnect(): void

Disconnects from the voice channel

Returns

void

Defined in

lib/Player.ts:210


moveNode

moveNode(node): Promise<void>

Parameters

NameTypeDescription
nodeNodeThe target node to move the player

Returns

Promise<void>

Defined in

lib/Player.ts:247


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:370


ping

ping(): Promise<number>

Gets the latency between lavalink client & node

Returns

Promise<number>

  • In milliseconds

Defined in

lib/Player.ts:286


play

play(options?): Promise<void>

Plays a track

Parameters

NameTypeDescription
options?PlayOptionsPlay options

Returns

Promise\<void>

Defined in

lib/Player.ts:308


prioritizePlay

prioritizePlay(track, requester): Promise\<boolean>

Prioritizes playing a new track

Parameters

NameTypeDescription
trackTrackThe track to prioritize
requesterUserThe requester of the track

Returns

Promise<void>

Defined in

lib/Player.ts:347


resume

resume(): Promise<boolean>

Resume the player

Returns

Promise\<boolean>

Defined in

lib/Player.ts:394


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:430


sendVoiceUpdate

sendVoiceUpdate(): Promise<void>

Returns

Promise<void>

Defined in

lib/Player.ts:527


setRepeatMode

setRepeatMode(mode): void

Set repeat mode for this queue

Parameters

NameTypeDescription
modeRepeatModeThe repeat mode to apply

Returns

void

Defined in

lib/Player.ts:450


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:492


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:505


setVoiceChannel

setVoiceChannel(channelId): void

Sets the player voice channel

Parameters

NameTypeDescription
channelIdstringThe voice channel id

Returns

void

Defined in

lib/Player.ts:518


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:402


update

update(state): void

Update player state

Parameters

NameTypeDescription
statePlayerStateplayerUpdate event

Returns

void

Inner

Defined in

lib/Player.ts:550


checkOptions

checkOptions(options): void

Parameters

NameType
optionsPlayerOptions

Returns

void

Defined in

lib/Player.ts:66