![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
A simple and easy to use lavalink wrapper.
For stable
# Using yarn
yarn add lavacord
# Using npm
npm install lavacord
For Development
# Using yarn
yarn add lavacord/lavacord
# Using npm
npm install lavacord/lavacord
Download Lavalink from their GitHub releases
Put an application.yml
file in your working directory. Example
Run with java -jar Lavalink.jar
If you're having a problem with the module contact us in the Discord Server
Start by creating a new Manager
passing an array of nodes and an object with user
the client's user id.
// import the Manager class from lavacord
const { Manager } = require("lavacord");
// Define the nodes array as an example
const nodes = [
{ id: "1", host: "localhost", port: 2333, password: "youshallnotpass" }
];
// Initilize the Manager with all the data it needs
const manager = new Manager(nodes, {
user: client.user.id, // Client id
send: (packet) => {
// this needs to send the provided packet to discord's WS using the method from your library.
// use the bindings for the discord library you use if you don't understand this
}
});
// Connects all the LavalinkNode WebSockets
await manager.connect();
// The error event, which you should handle otherwise your application will crash when an error is emitted
manager.on("error", (error, node) => {
error, // is the error
node // is the node which the error is from
});
Resolving tracks using LavaLink REST API
const { Rest } = require("lavacord");
async function getSongs(search) {
// This gets the best node available, what I mean by that is the idealNodes getter will filter all the connected nodes and then sort them from best to least beast.
const node = manager.idealNodes[0];
return Rest.load(node, search)
.catch(err => {
console.error(err);
return null;
});
}
getSongs("ytsearch:30 second song").then(songs => {
// handle loading of the tracks somehow ¯\_(ツ)_/¯
});
Joining and Leaving channels
// Join
const player = await manager.join({
guild: guildId, // Guild id
channel: channelId, // Channel id
node: "1" // lavalink node id, based on array of nodes
});
await player.play(track); // Track is a base64 string we get from Lavalink REST API
player.once("error", error => console.error(error));
player.once("end", data => {
if (data.type === "TrackEndEvent" && data.reason === "replaced") return; // Ignore replaced reason to prevent skip loops
// Play next song
});
// Leave voice channel and destroy Player
await manager.leave(guildId); // Player ID aka guild id
FAQs
A simple by design lavalink wrapper made for any discord library.
The npm package lavacord receives a total of 18 weekly downloads. As such, lavacord popularity was classified as not popular.
We found that lavacord demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.