https://github.com/vincentrps/wavelink-forks
This wil be using the master branch instead of 1.0 branch :D
https://github.com/vincentrps/wavelink-forks
Last synced: about 2 months ago
JSON representation
This wil be using the master branch instead of 1.0 branch :D
- Host: GitHub
- URL: https://github.com/vincentrps/wavelink-forks
- Owner: VincentRPS
- License: mit
- Created: 2021-12-12T13:13:18.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T07:37:38.000Z (almost 3 years ago)
- Last Synced: 2025-01-30T03:41:21.034Z (4 months ago)
- Homepage:
- Size: 271 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
.. image:: logo.png?raw=true
:align: center.. image:: https://img.shields.io/badge/Python-3.7%20%7C%203.8-blue.svg
:target: https://www.python.org.. image:: https://api.codacy.com/project/badge/Grade/d020ed97fd2a46fcb1f42bd3bc397e63
:target: https://app.codacy.com/app/mysterialpy/Wavelink?utm_source=github.com&utm_medium=referral&utm_content=EvieePy/Wavelink&utm_campaign=Badge_Grade_Dashboard.. image:: https://img.shields.io/github/license/EvieePy/Wavelink.svg
:target: LICENSEA robust and powerful Lavalink wrapper for `Discord.py `_!
Documentation
---------------------------
`Official Documentation `_.Support
---------------------------
For support using WaveLink, please join the official `support server
`_ on `Discord `_.|Discord|
.. |Discord| image:: https://img.shields.io/discord/490948346773635102?color=%237289DA&label=Pythonista&logo=discord&logoColor=white
:target: https://discord.gg/RAKc3HFInstallation
---------------------------
The following commands are currently the valid ways of installing WaveLink.**WaveLink requires Python 3.7+**
**Windows**
.. code:: sh
py -3.7 -m pip install Wavelink
**Linux**
.. code:: sh
python3.7 -m pip install Wavelink
Getting Started
----------------------------A quick and easy bot example:
.. code:: py
import discord
import wavelink
from discord.ext import commandsclass 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(commands.Cog):
def __init__(self, bot):
self.bot = botif not hasattr(bot, 'wavelink'):
self.bot.wavelink = wavelink.Client(bot=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='127.0.0.1',
port=2333,
rest_uri='http://127.0.0.1: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')