🌋Vulkava

Represents the main Vulkava client.

Constructor

new Vulkava(options)

PropertyDescriptionType

options

The Vulkava options

Properties

NameDescriptionType

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

ParameterDescription

source

Extends AbstractExternalSource The external source

.createPlayer()

Creates a new player or returns an existing one

ParameterDescription

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

ReturnsDescription

The player

decodeTrack()

Decodes a single base64 encoded track into a Track instance

ParameterDescription

encodedTrack

String The base64 encoded track

ReturnsDescription

The decoded track

decodeTracks()

Decodes multiple base64 encoded tracks into an array of Tracks

ParameterDescription

encodedTracks

Array<String> The array of base64 encoded tracks

ReturnsDescription

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.

ParameterDescription

payload

Object The discord gateway raw payload

ParameterDescription

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

ReturnsDescription

The search result

start()

Starts the Vulkava and connects to all lavalink nodes

ParameterDescription

clientId

String The client (bot) id

Events

>raw

Fired when any connected lavalink node emits an event

ParameterDescription

node

Node The node this event belongs to

payload

Object The actual payload

> nodeConnect

Fired when a lavalink node connects

ParameterDescription

node

Node The node that was connected

> nodeResume

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

ParameterDescription

node

Node The node that was resumed

> nodeDisconnect

Fired when a lavalink node disconnects

ParameterDescription

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

ParameterDescription

node

Node The node

warn

String The warn message

> error

Fired when a error occurred

ParameterDescription

node

Node The node

error

Error The error

> trackStart

Fired when a track starts playing

ParameterDescription

player

Player The player

track

Track The track

> trackEnd

Fired when a track stops playing

ParameterDescription

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

ParameterDescription

player

Player The player

track

Track The track

thresholdMs

Number The threshold in milliseconds

> trackException

Fired when a exception occurs during the track playback

ParameterDescription

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

ParameterDescription

player

Player The player

> playerDestroy

Fired when a player is destroyed

ParameterDescription

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)

ParameterDescription

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

ParameterDescription

player

Player The player

> pong

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

ParameterDescription

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

ParameterDescription

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)

ParameterDescription

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)

ParameterDescription

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)

ParameterDescription

player

Player The player

userId

String The user id

Last updated