Skip to content

debaucheryparty/lavende

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version PyPI version Crates.io Go Reference License Release

lavende logo

Lavende

Lavende is a high-performance native audio processing library designed specifically for Discord bots. It completely replaces traditional external JVM-based nodes by running a native Rust core directly inside your bot's process.

Summary

  1. Features
  2. Getting Started
  3. Documentation
  4. Examples
  5. License

Features

  • Native Performance: Engineered entirely in Rust for a minimal memory footprint and blistering execution speed.
  • Zero-IPC Latency: Executes directly inside your application without REST or WebSocket overhead.
  • Embedded DSP Engine: Apply Nightcore, Vaporwave, Bassboost, Equalizers, and 3D Rotation effortlessly on the native audio stream.
  • DAVE (E2EE): Full support for Discord's End-to-End Encryption protocol out of the box.
  • Multi-Language Support: Fully functional and strictly typed wrappers for Node.js, Python, Golang, and Rust.
  • Audio Sources: Built-in resolution for YouTube, SoundCloud, Spotify, Apple Music, and Deezer via internal C-bindings.

Getting Started

Installing

Depending on your language, install Lavende via your package manager:

Node.js:

$ npm install lavende

Python:

$ pip install lavende

Golang:

$ go get github.com/debaucheryparty/lavende

Rust:

$ cargo add lavende

Initializing Lavende

Lavende sits side-by-side with your Discord API wrapper (e.g., discord.js, discord.py, discordgo). You simply pipe raw voice socket events into the Lavende Manager so that the Rust core can establish the UDP connection.

Here is a quick Node.js initialization strategy:

const { Client, GatewayIntentBits } = require("discord.js");
const { LavendeManager } = require("lavende");

const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
});
let manager = null;

client.once("ready", () => {
  manager = new LavendeManager({
    sendToShard: (guildId, payload) => {
      client.guilds.cache.get(guildId)?.shard?.send(payload);
    },
    client: { id: client.user.id, username: client.user.username },
  });
  manager.init();
});

// Pass raw socket events to Lavende to establish the Voice connection
client.on("raw", (packet) => {
  if (manager) manager.sendRawData(packet);
});

client.login("token");

Quick Start

  1. Clone the repository:
git clone https://github.com/debaucheryparty/lavende.git
cd lavende
  1. Choose your preferred language from the _examples directory:

    • Rust
    • JavaScript / TypeScript
    • Go
    • Python
  2. Create a .env file and add your Discord bot token:

TOKEN=YOUR_BOT_TOKEN
  1. Install dependencies and run the example for your chosen language.

Node.js

cd _examples/node
npm install
node bot.js

Python

cd _examples/python
pip install -r requirements.txt
python main.py

Go

cd _examples/go
go mod tidy
go run .

Rust

cd _examples/rust
cargo run

For detailed guides, API documentation, and architecture information, see the docs/ directory.

Documentation

Extensive documentation detailing the Rust architecture, the LavendeManager, Player, and Filters can be found in our official documentation directory:

Examples

The best way to understand how to build a bot with Lavende is to analyze the official boilerplate examples:

License

Distributed under the License. See LICENSE for more information.