Skip to main content
Version: v1.1.1

LavaShark

Table of contents

Hierarchy

  • EventEmitter

    LavaShark

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new LavaShark(options)

Create a new LavaShark instance

Parameters

NameTypeDescription
optionsLavaSharkOptionsThe LavaShark options

Defined in

lib/LavaShark.ts:114

Properties

clientId

clientId: string

Defined in

lib/LavaShark.ts:31


nodes

nodes: Node[]

Defined in

lib/LavaShark.ts:32


on

on: EventListeners<LavaShark>

Defined in

lib/LavaShark.ts:27


once

once: EventListeners<LavaShark>

Defined in

lib/LavaShark.ts:26


players

players: Map<string, Player>

<guildId, Player>

Defined in

lib/LavaShark.ts:41


sendWS

Readonly sendWS: (guildId: string, payload: OutgoingDiscordPayload) => void

Type declaration

▸ (guildId, payload): void

Example

sendWS: (guildId, payload) => {
client.guilds.cache.get(guildId)?.shard.send(payload);
}
Parameters
NameTypeDescription
guildIdstringguildId
payloadOutgoingDiscordPayloadpayload
Returns

void

Defined in

lib/LavaShark.ts:56


unresolvedSearchSource

Readonly unresolvedSearchSource: SEARCH_SOURCE

Defined in

lib/LavaShark.ts:35


useISRC

Readonly useISRC: boolean

Defined in

lib/LavaShark.ts:36

Accessors

bestNode

get bestNode(): Node

Returns

Node

Defined in

lib/LavaShark.ts:151

Methods

addExternalSource

addExternalSource(extSource): void

Adds an external source that produces a SearchResult with UnresolvedTracks

Parameters

NameTypeDescription
extSourceAbstractExternalSourceThe external source

Returns

void

Defined in

lib/LavaShark.ts:176


createPlayer

createPlayer(options): Player

Creates a new player or returns an existing one

Parameters

NameTypeDescription
optionsPlayerOptionsThe player options

Returns

Player

Defined in

lib/LavaShark.ts:221


decodeTrack

decodeTrack(encodedTrack): Promise<Track>

Decodes a track by its base64 string

Parameters

NameTypeDescription
encodedTrackstringThe base64 encoded track

Returns

Promise<Track>

Defined in

lib/LavaShark.ts:189


decodeTracks

decodeTracks(encodedTracks): Promise<Track[]>

Decodes multiple tracks by their base64 string

Parameters

NameTypeDescription
encodedTracksstring[]The base64 encoded tracks

Returns

Promise<Track[]>

Defined in

lib/LavaShark.ts:202


getPlayer

getPlayer(guildId): Player

Retrieve an existing player using the guild id

Parameters

NameTypeDescription
guildIdstringThe guild id that player belongs to

Returns

Player | null

Defined in

lib/LavaShark.ts:239


handleVoiceUpdate

handleVoiceUpdate(payload): void

Handles voice state & voice server update packets

Parameters

NameTypeDescription
payloadIncomingDiscordPayloadThe voice packet

Returns

void

Defined in

lib/LavaShark.ts:317


nodesPing

nodesPing(): Promise<number[]>

Get the ping for all nodes

Returns

Promise<number[]>

  • All node latency, in milliseconds

Defined in

lib/LavaShark.ts:371


search(query, source?): Promise<SearchResult>

Search by song name or use music URL

Parameters

NameTypeDescription
querystringThe query to search for
source?SEARCH_SOURCEThe search source

Returns

Promise<SearchResult>

Defined in

lib/LavaShark.ts:256


start

start(clientId): void

Connects to all lavalink nodes

Parameters

NameTypeDescription
clientIdstringThe client id (BOT)

Returns

void

Defined in

lib/LavaShark.ts:301


checkOptions

Static checkOptions(options): void

Parameters

NameType
optionsLavaSharkOptions

Returns

void

Defined in

lib/LavaShark.ts:58