Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.
Latest stable Version: v2.1.3
npm install --save lavalink-client
Dev Version: (Current)
npm install tomato6966/lavalink-client
yarn add lavalink-client
Dev Version: (Current)
yarn add tomato6966/lavalink-client
Check out the Documentation | or the TSDocumentation for Examples, and detailled Docs, and to figure out how to get started. note: it's not fully done yet (see the docs)
💯 Lavalink v4 Supported only (with Lavalink Plugins)
✅ Player-Destroy Reasons like:
✨ Choose able queue stores (maps, collections, redis, databases, ...)
😍 Included Filter & Equalizer Management
👍 Multiple Player Options for easier use
🛡️ Lavalink Validations
🛡️ Client Validations
🧑💻 Memory friendly and easy style
😘 Automated Handlings
😁 Much much more!
player.stopPlaying()
: When executed it clears the Queue and stops playing, without destroying the PlayerPlayer.skip()
throwError
Property to: player.skip(skipTo?:number = 0, throwError?:boolean = true)
.player.getSponsorBlock()
/ node.getSponsorBlock()
player.setSponsorBlock(segments:SponsorBlockSegment[])
/ node.setSponsorBlock(segments:SponsorBlockSegment[])
player.deleteSponsorBlock()
/ node.deleteSponsorBlock()
"SegmentsLoaded"
, "SegmentSkipped"
, "ChapterStarted"
, "ChaptersLoaded"
ManagerOptions#emitNewSongsOnly
. If set to true, it won't emit "trackStart" Event, when track.loop is active, or the new current track == the previous (current) track. ManagerOptions#linksBlacklist
which allows user to specify an array of regExp / strings to match query strings (for links / words) and if a match happens it doesn't allow the request (blacklist) ManagerOptions#linksWhitelist
which allows user to specify an array of regExp / strings to match query strings (for links only) and if a match does NOT HAPPEN it doesn't allow the request (whitelist)ManagerOptions#linksAllowed
if set to false, it does not allow requests which are linksManaagerOptions#debugOptions
to ManaagerOptions#advancedOptions.debugOptions
player.stopPlaying()
stopPlaying(clearQueue:boolean = true, executeAutoplay:boolean = false)
.parseLavalinkConnUrl(connectionUrl:string)
Util Function.lavalink://<nodeId>:<nodeAuthorization(Password)>@<NodeHost>:<NodePort>
{ id: string, authorization: string, host: string, port: number }
parseLavalinkConnUrl("lavalink://LavalinkNode_1:strong%23password1@localhost:2345")
will give you:
{ id: "LavalinkNode_1", authorization: "strong#password1", host: "localhost", port: 2345 }
# How to load tracks / stop playing has changed for the node.updatePlayer rest endpoint the Client handles it automatically
- await player.node.updatePlayer({ encodedTrack?: Base64|null, track?: Track|UnresolvedTrack, identifer?: string });
+ await player.node.updatePlayer({ track: { encoded?: Base64|null, identifier?: string }, clientTrack?: Track|UnresolvedTrack });
# To satisfy the changes from lavalink updatePlayer endpoint, player play also got adjusted for that (Most users won't need this feature!)
- await player.play({ encodedTrack?: Base64|null, track?: Track|UnresolvedTrack, identifer?: string });
+ await player.play({ track: { encoded?: Base64|null, identifier?: string }, clientTrack?: Track|UnresolvedTrack });
# However it' still recommended to do it like that:
# first add tracks to the queue
+ await player.queue.add(Track: Track|UnresolvedTrack|(Track|UnresolvedTrack)[]);
# then play the next track from the queue
+ await player.play();
# Node Resuming got supported
# First enable it by doing:
+ await player.node.updateResuming(true, 360_000);
# then when reconnecting to the node add to the node.createeOptions the sessionId: "" of the previous session
# and after connecting the nodeManager.on("resumed", (node, payload, players) => {}) will be executed, where you can sync the players!
# Node Options got adjusted # It's a property not a method should be treated readonly
+ node.resuming: { enabled: boolean, timeout: number | null };
# Player function got added to stop playing without disconnecting
+ player.stopPlaying(clearQueue:boolean = true, executeAutoplay:boolean = false);
# Node functions for sponsorBlock Plugin (https://github.com/topi314/Sponsorblock-Plugin) got added
+ deleteSponsorBlock(player:Player)
+ setSponsorBlock(player:Player, segments: ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "filler"])
# only works if you ever set the sponsor blocks once before
+ getSponsorBlock(player:Player)
# Corresponding nodeManager events got added:
+ nodeManager.on("ChapterStarted");
+ nodeManager.on("ChaptersLoaded");
+ nodeManager.on("SegmentsLoaded");
+ nodeManager.on("SegmentSkipped");
# Filters sending got supported for filters.pluginFilters key from lavalink api: https://lavalink.dev/api/rest.html#plugin-filters
# Native implementation for lavaSearch plugin officially updated https://github.com/topi314/LavaSearch
# Native implementation for lavaSrc plugin officially updated https://github.com/topi314/LavaSrc including floweryTTS
# couple other changes, which aren't noticeable by you.
# Lavalink track.userData got added (basically same feature as my custom pluginInfo.clientData system)
# You only get the track.userData data through playerUpdate object
In one of the next updates, there will be more queueWatcher options and more custom nodeevents to trace
Most features of this update got tested, but if you encounter any bugs feel free to open an issue!
player.filterManager.filters.lavalinkLavaDspxPlugin
player.filterManager.filters.lavalinkLavaDspxPlugin.echo
player.filterManager.filters.lavalinkLavaDspxPlugin.normalization
player.filterManager.filters.lavalinkLavaDspxPlugin.highPass
player.filterManager.filters.lavalinkLavaDspxPlugin.lowPass
player.filterManager.filters.lavalinkFilterPlugin
(this plugins seems to not work on v4 at the moment)player.filterManager.filters.lavalinkLavaDspxPlugin.echo
player.filterManager.filters.lavalinkLavaDspxPlugin.reverb
player.filterManager.lavalinkLavaDspxPlugin
player.filterManager.lavalinkLavaDspxPlugin.toggleEcho(decay:number, echoLength:number)
player.filterManager.lavalinkLavaDspxPlugin.toggleNormalization(maxAmplitude:number, adaptive:boolean)
player.filterManager.lavalinkLavaDspxPlugin.toggleHighPass(boostFactor:number, cutoffFrequency:number)
player.filterManager.lavalinkLavaDspxPlugin.toggleLowPass(boostFactor:number, cutoffFrequency:number)
player.filterManager.lavalinkFilterPlugin
player.filterManager.lavalinkFilterPlugin.toggleEcho(delay:number, decay:number)
player.filterManager.lavalinkFilterPlugin.toggleReverb(delays:number[], gains:number[])
Generated using TypeDoc