🌋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

players

The players map

Methods and events

* This events only work on my custom lavalink, 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 AbstractExternalSource The external source

.createPlayer()

Creates a new player or returns an existing one

Parameter
Description

options

Object The player options

options.guildId

String The guild id that player belongs to

options.voiceChannelId

String The voice channel id

options.textChannelId

String (optional) The text channel id

options.selfDeaf

Boolean (optional) Whether the bot joins the voice channel deafened or not

options.selfMute

Boolean (optional) Whether the bot joins the voice channel muted or not

options.queue

Extends AbstractQueue (optional) A custom queue implementation

Returns
Description

The player

decodeTrack()

Decodes a single base64 encoded track into a Track instance

Parameter
Description

encodedTrack

String The base64 encoded track

Returns
Description

The decoded track

decodeTracks()

Decodes multiple base64 encoded tracks into an array of Tracks

Parameter
Description

encodedTracks

Array<String> The array of base64 encoded tracks

Returns
Description

The decoded tracks

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

Object The discord gateway raw payload

Parameter
Description

query

String 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

The search result

start()

Starts the Vulkava and connects to all lavalink nodes

Parameter
Description

clientId

String 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

Object 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

Number The WebSocket close code

reason

String The WebSocket close reason

> warn

Fired when something weird happened

Parameter
Description

node

Node The node

warn

String The warn message

> error

Fired when a error occurred

Parameter
Description

node

Node The node

error

Error The error

> debug

Event for debug messages

Parameter
Description

message

String 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

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

Number 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

Object The exception object

exception.message

String The exception message

exception.severity

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

exception.cause

String 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

code

Number The websocket close code See: discord voice close codes

reason

String 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

Number (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

String The guildId

id

String 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

String The user id

> 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

String The user id

> userDisconnect

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

Parameter
Description

player

Player The player

userId

String The user id

Last updated