A versatile LavaLink wrapper for Discord.py
Project description
A robust and powerful Lavalink wrapper for discord.py@rewrite!
Documentation
Support
For support using WaveLink, please join the official support server on Discord.
Installation
WaveLink is currently not on PyPI and thus needs to be installed using git. The following commands are currently the valid ways of installing WaveLink.
WaveLink requires Python 3.7
Windows
py -version -m pip install git+https://github.com/EvieePy/Wavelink.git
Linux
python3 -m pip install git+https://github.com/EvieePy/Wavelink.git
Getting Started
A quick and easy bot example:
import discord
import wavelink
from discord.ext import commands
class Bot(commands.Bot):
def __init__(self):
super(Bot, self).__init__(command_prefix=['audio ', 'wave ','aw '])
self.add_cog(Music(self))
async def on_ready(self):
print(f'Logged in as {self.user.name} | {self.user.id}')
class Music:
def __init__(self, bot):
self.bot = bot
if not hasattr(bot, 'wavelink'):
self.bot.wavelink = wavelink.Client(self.bot)
self.bot.loop.create_task(self.start_nodes())
async def start_nodes(self):
await self.bot.wait_until_ready()
# Initiate our nodes. For this example we will use one server.
# Region should be a discord.py guild.region e.g sydney or us_central (Though this is not technically required)
await self.bot.wavelink.initiate_node(host='0.0.0.0',
port=80,
rest_uri='http://0.0.0.0:2333',
password='youshallnotpass',
identifier='TEST',
region='us_central')
@commands.command(name='connect')
async def connect_(self, ctx, *, channel: discord.VoiceChannel=None):
if not channel:
try:
channel = ctx.author.voice.channel
except AttributeError:
raise discord.DiscordException('No channel to join. Please either specify a valid channel or join one.')
player = self.bot.wavelink.get_player(ctx.guild.id)
await ctx.send(f'Connecting to **`{channel.name}`**')
await player.connect(channel.id)
@commands.command()
async def play(self, ctx, *, query: str):
tracks = await self.bot.wavelink.get_tracks(f'ytsearch:{query}')
if not tracks:
return await ctx.send('Could not find any songs with that query.')
player = self.bot.wavelink.get_player(ctx.guild.id)
if not player.is_connected:
await ctx.invoke(self.connect_)
await ctx.send(f'Added {str(tracks[0])} to the queue.')
await player.play(tracks[0])
bot = Bot()
bot.run('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-0.1.70.tar.gz
(12.6 kB
view details)
Built Distribution
wavelink-0.1.70-py3-none-any.whl
(17.4 kB
view details)
File details
Details for the file wavelink-0.1.70.tar.gz
.
File metadata
- Download URL: wavelink-0.1.70.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0b4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a069c9b0b0b66959cb6c7f622a7ae569c5f88061e3a59f6263cf97e49930d44 |
|
MD5 | c0d3310d8582c9379283376c573a27ce |
|
BLAKE2b-256 | aa50aef3b937642c0bcd67d49ee2c188909d42cc9294074c0c4f0590a2f3cb10 |
File details
Details for the file wavelink-0.1.70-py3-none-any.whl
.
File metadata
- Download URL: wavelink-0.1.70-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0b4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f357d1e2aeb9056822e3761ed57c7d581d3556ec6f611baab15c5599af6d1a8 |
|
MD5 | ae8d5c97d882a52b3fbe3aa05bbf4983 |
|
BLAKE2b-256 | 03ccf296144e831508898611b9aff9f9d4638a41c071428affedb2c1cef5ea9f |