
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
lavaclient
Advanced tools
A lightweight and powerful lavalink v4 client for NodeJs.
Node.js LTS (or higher) is required to use lavaclient.
(p)npm install lavaclient
// or
yarn add lavaclient
(p)npm install lavaclient@next
// or
yarn add lavaclient@next
Take a look at lavadeno :)
import { Cluster, Node, type NodeOptions } from "lavaclient";
const info: NodeOptions["info"] = {
host: "127.0.0.1",
port: 2333,
auth: "youshallnotpass"
}
// If you only have a single lavalink node, use the `Node` class.
const lavaclient = new Node({
info,
ws: {
// The client name to use, defaults to some very long string lol.
clientName: "my very cool bot",
// Resuming is enabled by default, but you can disable it if you want.
// The timeout defaults to 1 minute.
resuming: false | { timeout: 30_000 },
// The reconnecting options, this is enabled by default.
// If you want to disable it, set it to `false`.
reconnecting: {
// The number of tries to reconnect before giving up, defaults to Infinity.
tries: 3,
// The delay in milliseconds between each attempt, defaults to 5 seconds.
// This can either be a function that accepts the current try and returns the delay, or a static delay.
delay: (attempt) => attempt * 1_000
}
},
rest: {
// Whether lavalink should return stack traces for requests that ran into exceptions.
enableTrace: true,
// The fetch implementation to use, defaults to node.js built-in fetch.
fetch: fetch,
// The user agent to use for requests, defaults to some very long string lol.
userAgent: "my very cool bot (v1.0.0, <user id>)"
},
discord: {
sendGatewayCommand: (id, payload) => // Send the payload to the Discord Gateway.
}
});
// If you have multiple lavalink nodes, use the `Cluster` class.
const lavaclient = new Cluster({
// An array of lavalink node options, this supports the same thing as the `Node` class.
nodes: [{ info }],
discord: {
sendGatewayCommand: (id, payload) => // Send the payload to the Discord Gateway.
}
});
// Connect to the lavalink node(s).
await lavaclient.connect("1077037369850605599");
const player = lavaclient.players.create("<guild id>");
// Passing `true` as the 2nd arg will skip checking if the player exists locally.
await lavaclient.players.destroy("<guild id>", true);
If you want a player to leave the voice channel, you can do this first:
player.voice.disconnect();
import { S, getUserData } from "lavaclient";
const results = await lavaclient.api.loadTracks("ytsearch:never gonna give you up");
if (results.loadType === "search") {
const track = results.data[0];
// You can pass a track object directly.
await player.play(track);
// If you want to pass some user data to the track, you can do this:
await player.play({
encoded: track.encoded,
userData: { requesterId: interaction.user.id },
});
// There's also an option to pass a user data schema for type-safe user data values.
const schema = S.struct({
requesterId: S.string,
});
await player.play({
encoded: track.encoded,
userData: { requesterId: interaction.user.id },
userDataSchema: schema,
});
getUserData(player.track, schema); // { requesterId: string }
}
player.resume()
player.pause()
player.setFilters({ volume: 0.5 });
player.setFilters("volume", 0.5);
player.seek(1000);
player.stop();
// A little experimental but you can transfer a player to a different node.
player.transfer(lavaclient2)
Lavalink requires you to forward voice server & state updates to it so that it can connect to the voice channel.
Here's a discord.js v14 example:
import { Client, GatewayDispatchEvents } from "discord.js";
const client = new Client({ ... });
client.ws.on(GatewayDispatchEvents.VoiceStateUpdate, (u) => lavaclient.players.handleVoiceUpdate(u));
client.ws.on(GatewayDispatchEvents.VoiceServerUpdate, (u) => lavaclient.players.handleVoiceUpdate(u));
FAQs
A simple, easy-to-use, and flexible lavalink client for node.js
The npm package lavaclient receives a total of 280 weekly downloads. As such, lavaclient popularity was classified as not popular.
We found that lavaclient demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.