GorilinkManager

GorilinkManager

Main library class in which all events and operations for nodes and players are managed

Constructor

new GorilinkManager(client, nodes, options)

The constructor of GorilinkManager

Parameters:
Name Type Description
client Client

Discord client

nodes Array.<GorilinkNode>

A Array of options that the GorilinkManager will connect

options object

The options for the Manager

Source:

Extends

  • EventEmitter

Members

client

Discord Client

Source:

idealNodes

Get the ideal node for that connection based on the stats of all connected nodes

Source:

nodes

Source:

Player

A instance of Gorilink player used to create new players

Source:

players

Source:

sendWS :function

Sets Discord WebSocket send method

Source:

shards

Total of Discord Client shards

Source:

user

Discord Client user id

Source:

voiceServers

Source:

voiceStates

Source:

Methods

_attemptConnection(guildId)

Handles the data of voiceServerUpdate & voiceStateUpdate to see if a connection is possible with the data we have and if it is then make the connection to lavalink

Parameters:
Name Type Description
guildId string

The guild id that we're trying to attempt to connect to

Source:

createNode(options) → {GorilinkNode}

Creates a node instance

Parameters:
Name Type Description
options object

Options of the lavalink node

Source:

(async) fetchTracks(query, source) → {Promise.<SearchResponse>}

Fetch tracks based on query and a source

Parameters:
Name Type Description
query string

Query string you want to search

source string

Media source

Source:

join(data, options) → {GorilinkPlayer}

Joins on guild channel

Parameters:
Name Type Description
data IJoinData

Guild and voice channel data

options IJoinOptions

Self mute and self deaf options

Source:

leave(guild) → {GorilinkPlayer}

Leave from voice channel of the guild

Parameters:
Name Type Description
guild string

Guild id you want to leave

Source:

packetUpdate(packet)

Updates manager states

Parameters:
Name Type Description
packet
Source:

request(node, endpoint, params) → {object}

Send an request to lavalink endpoints

Parameters:
Name Type Description
node GorilinkNode

The node to send the request

endpoint string

Request's endpoint

params string

Parameters of the request

Source:

spawnPlayer(data)

Creates a instance of GorilinkPlayer

Parameters:
Name Type Description
data object

Guild data

Source:

start(id)

Set user id

Parameters:
Name Type Description
id string
Source:

voiceServersUpdate(data)

For handling voiceServerUpdate

Parameters:
Name Type Description
data object

The data directly from discord

Source:

voiceStateUpdate(data)

For handling voiceStateUpdate

Parameters:
Name Type Description
data object

The data directly from discord

Source:

Events

nodeClose

Lavalink node close event

Properties:
Name Type Description
event Object

WebSocket event

node GorilinkNode

Closed lavalink node

Source:

nodeConnect :GorilinkNode

Lavalink node connect event

Source:

nodeError

Lavalink node error event

Properties:
Name Type Description
node GorilinkNode

Node on which the error occurred

err Object

Error stack

Source:

nodeReconnect :GorilinkNode

Emitted when trying to reconnect with the lavalink node

Source:

queueEnd

Emitted when the player queue ends

Properties:
Name Type Description
player GorilinkManager

Player where the queue ended

Source:

socketClosed

Emitted when events TrackStuckEvent comes from Lavalink node

Properties:
Name Type Description
player GorilinkPlayer

Player in which the connection to the Discord was closed

data Object

Lavalink node packet data

Source:

trackEnd

Emitted when the player track ends

Properties:
Name Type Description
player GorilinkManager

Player ended the track

track Object

Track data

Source:

trackError

Emitted when events on a track received an error

Properties:
Name Type Description
player GorilinkPlayer

Player who error as ocurred

track Object

Track data

data Object

Lavalink node packet data

Source:

trackStart

Emitted when the player track starts

Properties:
Name Type Description
player GorilinkPlayer

Player started to play

track Object

Track data

Source:

trackStuck

Emitted when events TrackStuckEvent comes from Lavalink node

Properties:
Name Type Description
player GorilinkPlayer

Player who emitted the event

track Object

Track data

data Object

Lavalink node packet data

Source: