Skip to main content
Version: v1.2.2

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


filters

Readonly filters: Filters

Defined in

lib/Player.ts:40


guildId

Readonly guildId: string

Defined in

lib/Player.ts:38


moving

moving: boolean

Defined in

lib/Player.ts:64


node

node: null | Node

Defined in

lib/Player.ts:36


paused

paused: boolean

Defined in

lib/Player.ts:59


playing

playing: boolean

Defined in

lib/Player.ts:58


position

position: number

Defined in

lib/Player.ts:55


queue

queue: Queue

Defined in

lib/Player.ts:51


repeatMode

repeatMode: RepeatMode

Defined in

lib/Player.ts:53


selfDeaf

Optional selfDeaf: boolean

Defined in

lib/Player.ts:47


selfMute

Optional selfMute: boolean

Defined in

lib/Player.ts:48


state

state: ConnectionState

Defined in

lib/Player.ts:61


textChannelId

Optional textChannelId: null | string

Defined in

lib/Player.ts:45


voiceChannelId

voiceChannelId: string

Defined in

lib/Player.ts:44


voiceState

voiceState: VoiceState

Defined in

lib/Player.ts:62

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

Deprecated

  • Use queue.duration instead

Returns

number

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
tracksdefault | Track | (default | Track)[]The track(s) to add to the queue
requesterunknownThe 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(): Promise<void>

Destroys the player

Returns

Promise<void>

Defined in

lib/Player.ts:239


disconnect

disconnect(): void

Disconnects from the voice channel

Returns

void

Defined in

lib/Player.ts:218


moveNode

moveNode(node): Promise<void>

Parameters

NameTypeDescription
nodeNodeThe target node to move the player

Returns

Promise<void>

Defined in

lib/Player.ts:253


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


ping

ping(): Promise<number>

Gets the latency between lavalink client & node

Returns

Promise<number>

  • In milliseconds

Defined in

lib/Player.ts:292


play

play(options?): Promise<void>

Plays a track

Parameters

NameTypeDescription
options?PlayOptionsPlay options

Returns

Promise<void>

Defined in

lib/Player.ts:314


resume

resume(): Promise<boolean>

Resume the player

Returns

Promise<boolean>

Defined in

lib/Player.ts:374


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


sendVoiceUpdate

sendVoiceUpdate(): Promise<void>

Returns

Promise<void>

Defined in

lib/Player.ts:507


setRepeatMode

setRepeatMode(mode): void

Set repeat mode for this queue

Parameters

NameTypeDescription
modeRepeatModeThe repeat mode to apply

Returns

void

Defined in

lib/Player.ts:430


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


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


setVoiceChannel

setVoiceChannel(channelId): void

Sets the player voice channel

Parameters

NameTypeDescription
channelIdstringThe voice channel id

Returns

void

Defined in

lib/Player.ts:498


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


update

update(state): void

Parameters

NameType
statePlayerState

Returns

void

Defined in

lib/Player.ts:530


checkOptions

Static checkOptions(options): void

Parameters

NameType
optionsPlayerOptions

Returns

void

Defined in

lib/Player.ts:66