πŸŒ‹Vulkava

Represents the main Vulkava client.

Constructor

new Vulkava(options)

Property
Description
Type

options

The Vulkava options

Properties

Name
Description
Type

nodes

The lavalink node array

clientId

The bot id

Methods and events

* This events only work on my custom lavalinkarrow-up-right, the speakingStart, speakingStop and userDisconnect are only emitted if sendSpeakingEvents is true, in NodeOptions. The speakingStart and speakingStop are only emitted while the lavalink node is recording audio.

Methods

.addExternalSource()

Adds an external source that produces a SearchResult with UnresolvedTracks

Parameter
Description

source

Extends AbstractExternalSourcearrow-up-right The external source

.createPlayer()

Creates a new player or returns an existing one

Parameter
Description

options

Objectarrow-up-right The player options

options.guildId

Stringarrow-up-right The guild id that player belongs to

options.voiceChannelId

Stringarrow-up-right The voice channel id

options.textChannelId

Stringarrow-up-right (optional) The text channel id

options.selfDeaf

Booleanarrow-up-right (optional) Whether the bot joins the voice channel deafened or not

options.selfMute

Booleanarrow-up-right (optional) Whether the bot joins the voice channel muted or not

options.queue

Extends AbstractQueuearrow-up-right (optional) A custom queue implementation

Returns
Description

The player

decodeTrack()

Decodes a single base64 encoded track into a Track instance

Parameter
Description

encodedTrack

Stringarrow-up-right The base64 encoded track

Returns
Description

The decoded track

decodeTracks()

Decodes multiple base64 encoded tracks into an array of Tracksarrow-up-right

Parameter
Description

encodedTracks

Arrayarrow-up-right<Stringarrow-up-right> The array of base64 encoded tracks

Returns
Description

handleVoiceUpdate()

Handles voice state & voice server update packets and pipes them into the lavalink node

This method is meant to be used on the raw event listener of d.js and rawWS (eris) and requires the gateway intent `GUILD_VOICE_STATES` in order to work properly.

Parameter
Description

payload

Objectarrow-up-right The discord gateway raw payload

Parameter
Description

query

Stringarrow-up-right The song term to search for

source

SEARCH_SOURCE (optional) The source to search if the query is not a valid URL, default is youtube

Returns
Description

start()

Starts the Vulkava and connects to all lavalink nodes

Parameter
Description

clientId

Stringarrow-up-right The client (bot) id

Events

>raw

Fired when any connected lavalink node emits an event

Parameter
Description

node

Node The node this event belongs to

payload

Objectarrow-up-right The actual payload

> nodeConnect

Fired when a lavalink node connects

Parameter
Description

node

Node The node that was connected

> nodeResume

Fired when a lavalink node resumes its connection (when resumeKey configured)

Parameter
Description

node

Node The node that was resumed

> nodeDisconnect

Fired when a lavalink node disconnects

Parameter
Description

node

Node The node that was disconnected

code

Numberarrow-up-right The WebSocket close code

reason

Stringarrow-up-right The WebSocket close reason

> warn

Fired when something weird happened

Parameter
Description

node

Node The node

warn

Stringarrow-up-right The warn message

> error

Fired when a error occurred

Parameter
Description

node

Node The node

error

> debug

Event for debug messages

Parameter
Description

message

Stringarrow-up-right The debug message

> trackStart

Fired when a track starts playing

Parameter
Description

player

Player The player

track

Track The track

> trackEnd

Fired when a track stops playing

Parameter
Description

player

Player The player

track

Track The track

reason

TrackEndReason The reason why the track stopped playing

circle-info

TrackEndReason = 'FINISHED' | 'LOAD_FAILED' | 'STOPPED' | 'REPLACED' | 'CLEANUP'

> trackStuck

Fired when a track playback stucks

Parameter
Description

player

Player The player

track

Track The track

thresholdMs

Numberarrow-up-right The threshold in milliseconds

> trackException

Fired when a exception occurs during the track playback

Parameter
Description

player

Player The player

track

Track The track

exception

Objectarrow-up-right The exception object

exception.message

Stringarrow-up-right The exception message

exception.severity

'COMMON' | 'SUSPICIOUS' | 'FAULT' The exception severity

exception.cause

Stringarrow-up-right The cause of the exception

> playerCreate

Fired when a player is created

Parameter
Description

player

Player The player

> playerDestroy

Fired when a player is destroyed

Parameter
Description

player

Player The player

> playerDisconnect

Fired when a player gets disconnected from the discord voice server (Vulkava auto-reconnects on close codes: 1006, 4015, 4006 and 4009)

Parameter
Description

player

Player The player

reason

Stringarrow-up-right The websocket close reason

> queueEnd

Fired when there is no more tracks to play on the queue

Parameter
Description

player

Player The player

> pong

Fired when a lavalink node emits a pong event (used to get lavalink latency)

Parameter
Description

node

Node The node

ping

Numberarrow-up-right (optional) The latency between a player and discord voice gateway

> recordFinished

Fired when a lavalink node has finished processing an audio recording

Parameter
Description

node

Node The node that fired this event

guildId

id

Stringarrow-up-right The record id

> speakingStart

Fired when a user started speaking (only works while recording and if sendSpeakingEvents=true in NodeOptions)

Parameter
Description

player

Player The player

userId

> speakingStop

Fired when a user stopped speaking (100ms of silence) (only works while recording and if sendSpeakingEvents=true in NodeOptions)

Parameter
Description

player

Player The player

userId

> userDisconnect

Fired when a user disconnected from the voice channel (only works if sendSpeakingEvents=true in NodeOptions)

Parameter
Description

player

Player The player

userId

Last updated