32 releases

0.13.0 Aug 1, 2024
0.12.0 Apr 30, 2024
0.11.0 Feb 26, 2024
0.10.0-beta.3 Sep 16, 2023
0.3.0-alpha Oct 24, 2020

#781 in Web programming

47 downloads per month

MPL-2.0 license

625KB
5K SLoC

Rust 4.5K SLoC // 0.0% comments Python 558 SLoC // 0.0% comments

lavalink-rs

An API Wrapper for lavalink. Compatible with all tokio 1.x based discord crates or asyncio based discord python libraries.

If you have questions, you can get support in the serenity, lavalink or hikari discord servers, or by opening an issue in the gitlab repository.

Documentation for the library can be found here for rust or here for python.

To-Do

0.14

  • Implement __anext__ to QueueRef
  • Implement some const methods
  • RoutePlanner API
  • Support tokio-websockets
  • native and webpki roots for rustls feature separation

Future

  • Improve documentation with examples, better formatting, and fill in missing data
  • Expand event logging
  • discord.py example
  • hata example
  • twilight-rs example
  • Gitlab CI Tests
  • Implement abstractions for ease of use
  • Region based node selection method

Done

  • native_tls backend
  • Player queues
  • Readbale player queues
  • Search engine helpers
  • Write basic cocumentation
  • Songbird utilities
  • Serenity utilities
  • Twilight utilities
  • Load balancer node selection method
  • Lavasnek (PyO3)
  • Lavasnek events
  • Remove third party dependency for custom user data.
  • Round-Robin node selection method
  • Main and fallback node selection method
  • CPU Load based node selection method
  • Memory usage based node selection method
  • Custom node selection method
  • Python stubs
  • Basic Twilight 0.16 support
  • Hide password from logs
  • hikari-lightbulb example
  • Implement python builders for all the needed model structures
  • Expose Http and methods to python
  • Switch from reqwests to hyper
  • Implement SSL support with hyper
  • Implement search utilities to python
  • load_tracks to return Track in python
  • Streamable queue reader

To install Lavalink, you can follow their getting started guide.

How to use

This is how you can install the library to be used.

Rust

You can install the latest version from crates.io:

lavalink-rs = "0.13"

# or

[dependencies.lavalink-rs]
version = "0.13"

Or the development release:

lavalink-rs = { git = "https://gitlab.com/vicky5124/lavalink-rs/", branch = "main"}

# or

[dependencies.lavalink-rs]
git = "https://gitlab.com/vicky5124/lavalink-rs/"
branch = "main"

If you wish to use a development version of songbird (or serenity, or twilight-model), add the following to the Cargo.toml:

[patch.crates-io.songbird]
git = "https://github.com/serenity-rs/songbird"
branch = "next"

[dependencies.songbird]
git = "https://github.com/serenity-rs/songbird"
branch = "next"

Python

You can install the latest version from pypi by using python3 -m pip install lavalink_rs.

OS Arch Python Versions Supported?
Windows x86 3.8-3.12
Windows x64 3.8-3.12
Windows aarch64 -
Mac OS x86_64 3.8-3.12
Mac OS aarch64 3.8-3.12
Linux x86 3.8-3.12
Linux x86_64 3.8-3.12
Linux armv7 3.8-3.12
Linux aarch64 3.8-3.12
Linux ppc64le -
Linux s390x -

Building the library

You can build the library using cargo build

To build for python, you can use maturin instead.

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install maturin
maturin develop --target x86_64-unknown-linux-gnu

Features

  • macros: default feature - Adds procedural macros for ease of use.
  • rustls-native-roots: default feature - Use rustls with the system trusted roots.
  • rustls-webpki-roots: Use rustls with the Mozilla set of trusted roots.
  • native-tls Use the system native tls implementation.
  • serenity for serenity support.
  • songbird for songbird support.
  • twilight for twilight-model v0.15 support.
  • twilight16 for twilight-model v0.16-rc support.
  • python for python3.8+ support.

Contributing

To contribute to the project, fork the gitlab repository and create a merge request over there. Make sure to update the changelog with whatever update you did to the library.

Dependencies

~9–24MB
~380K SLoC