A robust and powerful Lavalink wrapper for discord.py.
Project description
Wavelink is robust and powerful Lavalink wrapper for Discord.py! Wavelink features a fully asynchronous API that’s intuitive and easy to use.
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 Wavelink --pre
Linux
python3.9 -m pip install Wavelink --pre
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')
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
wavelink-1.0.0b33.tar.gz
(22.0 kB
view details)
Built Distribution
File details
Details for the file wavelink-1.0.0b33.tar.gz
.
File metadata
- Download URL: wavelink-1.0.0b33.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27ee00db437f30d0357310d365402244594e6325f176a10887e5600d160a0959 |
|
MD5 | 4dbf9396c62f3b6353c0865fa244a897 |
|
BLAKE2b-256 | 30b2b13fce215d3d800a29ac2e8e255758422b7a9cdf57dc415811e03a61b298 |
File details
Details for the file wavelink-1.0.0b33-py3-none-any.whl
.
File metadata
- Download URL: wavelink-1.0.0b33-py3-none-any.whl
- Upload date:
- Size: 32.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a86c99dd9050805e6c64139544a0a6f1849e1e9509eaf5f1f17671dec63726b |
|
MD5 | 976dca5d81806a5e880c4eb7b441b753 |
|
BLAKE2b-256 | c7825638de558b183f26deb6ebd756b83320720ea5a9f5f997402e0c1ed8591a |