A robust and powerful Lavalink wrapper for discord.py and derivatives.
Project description
Wavelink is a robust and powerful Lavalink wrapper for Discord.py and certain supported forks. Wavelink features a fully asynchronous API that’s intuitive and easy to use with built in Spotify Support and Node Pool Balancing.
Documentation
Support
For support using WaveLink, please join the official support server on Discord.
Installation
The following commands are currently the valid ways of installing WaveLink.
WaveLink requires Python 3.8+
Windows
py -3.9 -m pip install -U Wavelink
Linux
python3.9 -m pip install -U Wavelink
Getting Started
A quick and easy bot example:
import wavelink
from discord.ext import commands
class Bot(commands.Bot):
def __init__(self):
super().__init__(command_prefix='>?')
async def on_ready(self):
print('Bot is ready!')
class Music(commands.Cog):
"""Music cog to hold Wavelink related commands and listeners."""
def __init__(self, bot: commands.Bot):
self.bot = bot
bot.loop.create_task(self.connect_nodes())
async def connect_nodes(self):
"""Connect to our Lavalink nodes."""
await self.bot.wait_until_ready()
await wavelink.NodePool.create_node(bot=bot,
host='0.0.0.0',
port=2333,
password='YOUR_LAVALINK_PASSWORD')
@commands.Cog.listener()
async def on_wavelink_node_ready(self, node: wavelink.Node):
"""Event fired when a node has finished connecting."""
print(f'Node: <{node.identifier}> is ready!')
@commands.command()
async def play(self, ctx: commands.Context, *, search: wavelink.YouTubeTrack):
"""Play a song with the given search query.
If not connected, connect to our voice channel.
"""
if not ctx.voice_client:
vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
else:
vc: wavelink.Player = ctx.voice_client
await vc.play(search)
bot = Bot()
bot.add_cog(Music(bot))
bot.run('YOUR_BOT_TOKEN')
Lavalink Installation
Head to the official Lavalink repo and give it a star!
Create a folder for storing Lavalink.jar and related files/folders.
Copy and paste the example application.yml to application.yml in the folder we created earlier. You can open the yml in Notepad or any simple text editor.
Change your password in the application.yml and store it in a config for your bot.
Set local to true in the application.yml if you wish to use wavelink.LocalTrack for local machine search options… Otherwise ignore.
Save and exit.
Install Java 17(Windows) or Java 13+ on the machine you are running.
Download Lavalink.jar and place it in the folder created earlier.
Open a cmd prompt or terminal and change directory cd into the folder we made earlier.
Run: java -jar Lavalink.jar
If you are having any problems installing Lavalink, please join the official Discord Server listed above for help.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wavelink-1.2.1.tar.gz
.
File metadata
- Download URL: wavelink-1.2.1.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f0f0e75d725f3d754ef4cd925900608f7ef2a4b5f9c53ad0706d5491f18df0a |
|
MD5 | 999dddf60ab81559d4095ab010a571af |
|
BLAKE2b-256 | 28b4f340899128831a2401e9e281e18caca6ed71d2743c75a7546f02689f5415 |
File details
Details for the file wavelink-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: wavelink-1.2.1-py3-none-any.whl
- Upload date:
- Size: 33.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a575e0fc4bcfbfc51f93afaa7e654bdfd4bbd67957278c59f6148057c67eb128 |
|
MD5 | 02f28a617ad7037a6a1d19ddc4b41ef5 |
|
BLAKE2b-256 | ce2bf2e43da4eff9dbf0b490c79e19020c74a26946136ddf2bbe6a52a6a73468 |