Skip to main content

A robust and powerful Lavalink wrapper for Nextcord

Project description

https://raw.githubusercontent.com/PythonistaGuild/Wavelink/master/logo.png https://img.shields.io/badge/Python-3.10%20%7C%203.11-blue.svg https://img.shields.io/github/license/EvieePy/Wavelink.svg https://img.shields.io/discord/490948346773635102?color=%237289DA&label=Pythonista&logo=discord&logoColor=white PyPI - Downloads Maintenance

Wavelink is a robust and powerful Lavalink wrapper for Nextcord. Wavelink features a fully asynchronous API that’s intuitive and easy to use with built in Spotify Support and Node Pool Balancing. This is a Fork of WaveLink which was modified to allow it to run on Nextcord.

Features:

  • Fully Asynchronous

  • Auto-Play and Looping (With the inbuilt Queue system)

  • Spotify Support

  • Node Balancing and Fail-over

  • Supports Lavalink 3.7+

Documentation

Official Documentation

Support

For support using WaveLink, please join the official support server on Discord.

https://discordapp.com/api/guilds/490948346773635102/widget.png?style=banner2

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 nextcord
import wavelink
from nextcord.ext import commands

intents = nextcord.intents.all()
client = nextcord.Client()
bot = commands.Bot(command_prefix="?", intents=intents)

@bot.event
async def on_ready():
    print(f'Logged in {self.user} | {self.user.id}')
    bot.loop.create_task(on_node())

async def setup_hook():
    # 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.slash_command()
async def play(interaction : nextcord.Interaction, search : str):
    """Simple play command."""

    query = await wavelink.YoutubeTrack.search(search, return_first=True)

    destination = interaction.user.voice.channel

    if not interaction.guild.voice_client:
        vc: wavelink.Player = await destination.connect(cls=wavelink.Player)
    elif interaction.guild.voice_client:
        vc: wavelink.Player = interaction.guild.voice_client

    await vc.play(query)


@bot.slash_command()
async def disconnect(interaction : nextcord.Interaction):
    """Simple disconnect command.

    This command assumes there is a currently connected Player.
    """
    vc: wavelink.Player = interaction.guild.voice_client
    await vc.disconnect()

Project details


Download files

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

Source Distribution

WaveLinkCord-2.0.33.tar.gz (29.3 kB view hashes)

Uploaded Source

Built Distribution

WaveLinkCord-2.0.33-py3-none-any.whl (41.1 kB view hashes)

Uploaded Python 3

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