A robust and powerful Lavalink wrapper for py-cord
Project description
Wavelink is a robust and powerful Lavalink wrapper for Discord.py. Wavelink features a fully asynchronous API that’s intuitive and easy to use with built in Spotify Support and Node Pool Balancing.
Features:
Fully Asynchronous
Auto-Play and Looping (With the inbuilt Queue system)
Spotify Support
Node Balancing and Fail-over
Supports Lavalink 3.7+
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 2 requires Python 3.10+
Windows
py -3.10 -m pip install -U Wavelink
Linux
python3.10 -m pip install -U Wavelink
Getting Started
See also: Examples
import discord
import wavelink
from discord.ext import commands
class Bot(commands.Bot):
def __init__(self) -> None:
intents = discord.Intents.default()
intents.message_content = True
super().__init__(intents=intents, command_prefix='?')
async def on_ready(self) -> None:
print(f'Logged in {self.user} | {self.user.id}')
async def setup_hook(self) -> None:
# Wavelink 2.0 has made connecting Nodes easier... Simply create each Node
# and pass it to NodePool.connect with the client/bot.
node: wavelink.Node = wavelink.Node(uri='http://localhost:2333', password='youshallnotpass')
await wavelink.NodePool.connect(client=self, nodes=[node])
bot = Bot()
@bot.command()
async def play(ctx: commands.Context, *, search: str) -> None:
"""Simple play command."""
if not ctx.voice_client:
vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
else:
vc: wavelink.Player = ctx.voice_client
tracks = await wavelink.YouTubeTrack.search(search)
if not tracks:
await ctx.send(f'No tracks found with query: `{search}`')
return
track = tracks[0]
await vc.play(track)
@bot.command()
async def disconnect(ctx: commands.Context) -> None:
"""Simple disconnect command.
This command assumes there is a currently connected Player.
"""
vc: wavelink.Player = ctx.voice_client
await vc.disconnect()
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 pywavelink-2.6.5.tar.gz
.
File metadata
- Download URL: pywavelink-2.6.5.tar.gz
- Upload date:
- Size: 38.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ae61d8c2b2c23ea0817ac53ec4beddf0ea3bcb2400aca9e9f9a4669a48edadb |
|
MD5 | a0a5222bf709bec88205549630a226fb |
|
BLAKE2b-256 | 31bf9382c87a966f93ee61dd0bb8726af218abebea12d3adecd237afb7829663 |
File details
Details for the file pywavelink-2.6.5-py3-none-any.whl
.
File metadata
- Download URL: pywavelink-2.6.5-py3-none-any.whl
- Upload date:
- Size: 49.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cb5871839a1420d47ae85cc0b0f9f4f2a896f3dc90af7b7c5f47b5636f0685b |
|
MD5 | ecabc943f14cf324f829bf3a9b9966bf |
|
BLAKE2b-256 | ae1bd4b852add0c57d84adcd9a5636f26e1cc3a1f83fdff41c0b6ddd5c2bd9fc |