Skip to main content
Version: v1.1.1

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

Properties

current

current: null | Track

Defined in

lib/Player.ts:39


filters

Readonly filters: Filters

Defined in

lib/Player.ts:29


guildId

Readonly guildId: string

Defined in

lib/Player.ts:27


moving

moving: boolean

Defined in

lib/Player.ts:54


node

node: null | Node

Defined in

lib/Player.ts:25


paused

paused: boolean

Defined in

lib/Player.ts:49


playing

playing: boolean

Defined in

lib/Player.ts:48


position

position: number

Defined in

lib/Player.ts:45


queue

queue: Queue

Defined in

lib/Player.ts:40


queueRepeat

queueRepeat: boolean

Defined in

lib/Player.ts:42


selfDeaf

Optional selfDeaf: boolean

Defined in

lib/Player.ts:36


selfMute

Optional selfMute: boolean

Defined in

lib/Player.ts:37


state

state: ConnectionState

Defined in

lib/Player.ts:51


textChannelId

Optional textChannelId: null | string

Defined in

lib/Player.ts:34


trackRepeat

trackRepeat: boolean

Defined in

lib/Player.ts:43


voiceChannelId

voiceChannelId: string

Defined in

lib/Player.ts:33


voiceState

voiceState: VoiceState

Defined in

lib/Player.ts:52

Accessors

exactPosition

get exactPosition(): number

Gets the exact track position based on the last playerUpdate packet

Returns

number

Defined in

lib/Player.ts:118


queueDuration

get queueDuration(): number

Gets the queue duration in milliseconds

Deprecated

  • Use queue.duration instead

Returns

number

Defined in

lib/Player.ts:133


volume

get volume(): number

Gets the volume of the player

Returns

number

Defined in

lib/Player.ts:140

Methods

connect

connect(): void

Connects to the voice channel

Returns

void

Defined in

lib/Player.ts:158


destroy

destroy(): Promise<void>

Destroys the player

Returns

Promise<void>

Defined in

lib/Player.ts:207


disconnect

disconnect(): void

Disconnects from the voice channel

Returns

void

Defined in

lib/Player.ts:186


moveNode

moveNode(node): Promise<void>

Parameters

NameTypeDescription
nodeNodeThe target node to move the player

Returns

Promise<void>

Defined in

lib/Player.ts:221


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


ping

ping(): Promise<number>

Gets the latency between lavalink client & node

Returns

Promise<number>

  • In milliseconds

Defined in

lib/Player.ts:260


play

play(options?): Promise<void>

Plays a track

Parameters

NameTypeDescription
options?PlayOptionsPlay options

Returns

Promise<void>

Defined in

lib/Player.ts:282


resume

resume(): Promise<boolean>

Resume the player

Returns

Promise<boolean>

Defined in

lib/Player.ts:342


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


sendVoiceUpdate

sendVoiceUpdate(): Promise<void>

Returns

Promise<void>

Defined in

lib/Player.ts:478


setRepeatMode

setRepeatMode(mode): void

Set repeat mode for this queue

Parameters

NameTypeDescription
modeRepeatModeThe repeat mode to apply

Returns

void

Defined in

lib/Player.ts:398


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


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


setVoiceChannel

setVoiceChannel(channelId): void

Sets the player voice channel

Parameters

NameTypeDescription
channelIdstringThe voice channel id

Returns

void

Defined in

lib/Player.ts:469


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


update

update(state): void

Parameters

NameType
statePlayerState

Returns

void

Defined in

lib/Player.ts:501


checkOptions

Static checkOptions(options): void

Parameters

NameType
optionsPlayerOptions

Returns

void

Defined in

lib/Player.ts:56