Skip to main content

A robust and powerful Lavalink wrapper for py-cord and derivatives.

Project description

https://img.shields.io/badge/Python-3.8%20%7C%203.9%20%7C%203.10-blue.svg https://img.shields.io/github/license/EvieePy/Wavelink.svg PyPI - Downloads Maintenance

pywave is a fork of the package Wavelink. pywave is a robust and powerful Lavalink wrapper for Pycord. pywave features a fully asynchronous API that’s intuitive and easy to use with built in Spotify Support and Node Pool Balancing.

Installation

The following commands are currently the valid ways of installing WaveLink.

pywave requires Python 3.8+

Windows

py -3.9 -m pip install -U pywave

Linux

python3.9 -m pip install -U pywave

Getting Started

A quick and easy bot example:

import pywave
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 pywave.NodePool.create_node(bot=bot,
                                            host='0.0.0.0',
                                            port=2333,
                                            password='YOUR_LAVALINK_PASSWORD')

    @commands.Cog.listener()
    async def on_pywave_node_ready(self, node: pywave.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: pywave.YouTubeTrack):
        """Play a song with the given search query.

        If not connected, connect to our voice channel.
        """
        if not ctx.voice_client:
            vc: pywave.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
        else:
            vc: pywave.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

This version

1.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywavee-1.5.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

pywavee-1.5-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file pywavee-1.5.tar.gz.

File metadata

  • Download URL: pywavee-1.5.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for pywavee-1.5.tar.gz
Algorithm Hash digest
SHA256 a32b86a106f5ab80c8cbd6011fca6bd2810cc56d319f2f82b148b2b5c8b85463
MD5 ddf3eff1944823c6db5915923e704757
BLAKE2b-256 225374b4442aed54d2fe5167b6faaf6a2792b5ddd629eaacc0fc2406c2184d8c

See more details on using hashes here.

File details

Details for the file pywavee-1.5-py3-none-any.whl.

File metadata

  • Download URL: pywavee-1.5-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for pywavee-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c1220bbcd8c6e6eceb338c574cbc0e8fec719afeb93d6bb91a66ea0836bedbdc
MD5 2877a365a250ab714820f5854c77e9f9
BLAKE2b-256 c51bc7c6ce01640e39f446bd17fe1e00a4052b78a4a93bc782886cbea08f1e0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page