LavalinkManager
The main Base-Manager of this Package
Type: class extends node:EventEmitter
Constructor
Import
Overview
Properties | Methods | Event-Listeners |
---|---|---|
init() IMPORTANT | ||
sendRawData() IMPORTANT | ||
Check out Example Creations down below
Properties
.initated
If the Manager was initated
Type: Boolean
.useable
If the Manager is useable (If at least 1 Node is connected)
Type: Boolean
.options
The options from the Manager
Type: ManagerOptions
.players
All the Players of the Manager
Type: MiniMap<guildId:string, Player>
.nodeManager
The Node Manager of the Manager
Type: NodeManager
.utils
The Manager's Utils
Type: ManagerUtils
Methods
Initializes the Manager and connects all Nodes
Returns: Promise<LavalinkManager>
Create or get a Player
Returns: Player
Create a Player
Important Conditions to check:
player is not undefined
player is connected to a VoiceChannel
user in a VoiceChannel && player in same VoiceChannel as user
player.node is Connected
player is playing / there is a current song in player.queue
Removes a Player from the saved MiniMap, needs to be destroyed first
Returns: Boolean
.sendRawData(data : VoicePacket | VoiceServer | VoiceState | any) IMPORTANT!
Sends Raw Discord's Clients Event Data to the Manager
Returns: void
Event-Listeners
All Events you can listen to on the LavalinkManager Class
trackStart
Emitted whenever a Track plays
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
track | The current playing track (player.queue.current) | |
payload | The Payload Lavalink sent |
trackEnd
Emitted whenever a Track finished playing.
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
track | The Track that finished Playing | |
payload | The Payload Lavalink sent |
trackStuck
Emitted whenever a Track got stuck while playing
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
track | The Track that got stuck | |
payload | The Payload Lavalink sent |
trackError
Emitted whenever a Track errored
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
track | The Track that Errored | |
payload | The Payload Lavalink sent |
queueEnd
Emitted when the track Ended, but there are no more tracks in the queue
(trackEnd, does NOT get exexcuted)
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
track | The last played track | |
payload | The Payload Lavalink sent |
playerCreate
Emitted whenver a Player gets created
Parameter | Type | Description |
---|---|---|
player | The created Player |
playerMove
Emitted whenever a Player gets moved between Voice Channels
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
oldVoiceChannelId | old Voice Channel Id | |
newVoiceChannelId | new Voice Channel Id |
playerDisconnect
Emitted whenever a player is disconnected from a channel
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
voiceChannelId | The disconnected voice Channel |
playerSocketClose
Emitted when a Node-Socket got closed for a specific Player
Parameter | Type | Description |
---|---|---|
player | The Player for this Event | |
payload | The Payload Lavalink sent |
playerDestroy
Emitted whenever a Player got destroyed
Parameter | Type | Description |
---|---|---|
player | The Destroyed Player | |
destroyReason | The Destroy Reason (if provided) |
playerUpdate
Emitted whenever a Player gets an update from Lavalink's playerUpdate Event
Parameter | Type | Description |
---|---|---|
oldPlayerJson | Player Data before it was udpated | |
newPlayer | Afterwards the Player got updated |
Example-Creations
Advanced Example Creation
Last updated