Red-Lavalink
A Lavalink client library written for Python 3.8 using the AsyncIO framework. This library may be used for other projects as it contains no Red specific code or logic.
However, it is important to note that this library only supports projects using discord.py.
To install:
pip install red-lavalink
Usage
import lavalink
from discord.ext.commands import Bot
class MyBot(Bot):
async def setup_hook(self):
await lavalink.initialize(
self, host='localhost', password='password', port=2333
)
async def search_and_play(voice_channel, search_terms):
player = await lavalink.connect(voice_channel)
tracks = await player.search_yt(search_terms)
player.add(tracks[0])
await player.play()
Shuffling
def shuffle_queue(player_id, forced=True):
player = lavalink.get_player(player_id)
if not forced:
player.maybe_shuffle(sticky_songs=0)
"""
`player.maybe_shuffle` respects `player.shuffle`
And will only shuffle if `player.shuffle` is True.
`player.maybe_shuffle` should be called every time
you would expect the queue to be shuffled.
`sticky_songs=0` will shuffle every song in the queue.
"""
else:
player.force_shuffle(sticky_songs=3)
"""
`player.force_shuffle` does not respect `player.shuffle`
And will always shuffle the queue.
`sticky_songs=3` will shuffle every song after the first 3 songs in the queue.
"""
When shutting down, be sure to do the following:
await lavalink.close(bot)
Metadata
Release files for Red-Lavalink 0.11.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| red_lavalink-0.11.1.tar.gz | 34.7 kB | With provenance | Details for red_lavalink-0.11.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| red_lavalink-0.11.1-py3-none-any.whl | Python 3 | none | any | Details for red_lavalink-0.11.1-py3-none-any.whl |
Total release size: 70.8 kB
Release files / red_lavalink-0.11.1.tar.gz
| Download URL | red_lavalink-0.11.1.tar.gz |
|---|---|
| Size | 34.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc6e1a2a81acbf07d3d17f547dd2e76193d29a875c9bc94c2207bc06ef7bfab3
|
|
BLAKE2b-256 checksum How to use checksums |
89bc3b62bad4188bc51eefa38810fae7e18b62dd24a0d69bb82f9d1f67e7ace7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 3, 2026.
Transparency logRelease files / red_lavalink-0.11.1-py3-none-any.whl
| Download URL | red_lavalink-0.11.1-py3-none-any.whl |
|---|---|
| Size | 36.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e4a19b1b766971599df3736cf1777835afd74bb223fe0917e5362891779c575
|
|
BLAKE2b-256 checksum How to use checksums |
92fb04531929a34722b54a30555c2ed615c30d93fb70da31b708b0780a018ca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 3, 2026.
Transparency logSecurity for Red-Lavalink 0.11.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for red_lavalink-0.11.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.