Skip to main content

A robust and powerful Lavalink wrapper for py-cord

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 Discord.py. Wavelink features a fully asynchronous API that’s intuitive and easy to use with built in Spotify Support and Node Pool Balancing.

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


class Bot(commands.Bot):

    def __init__(self) -> None:
        intents = discord.Intents.default()
        intents.message_content = True

        super().__init__(intents=intents, command_prefix='?')

    async def on_ready(self) -> None:
        print(f'Logged in {self.user} | {self.user.id}')

    async def setup_hook(self) -> None:
        # 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 = Bot()


@bot.command()
async def play(ctx: commands.Context, *, search: str) -> None:
    """Simple play command."""

    if not ctx.voice_client:
        vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
    else:
        vc: wavelink.Player = ctx.voice_client

    tracks = await wavelink.YouTubeTrack.search(search)
    if not tracks:
        await ctx.send(f'No tracks found with query: `{search}`')
        return

    track = tracks[0]
    await vc.play(track)


@bot.command()
async def disconnect(ctx: commands.Context) -> None:
    """Simple disconnect command.

    This command assumes there is a currently connected Player.
    """
    vc: wavelink.Player = ctx.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

WavelinkPycord-2.5.1.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

WavelinkPycord-2.5.1-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file WavelinkPycord-2.5.1.tar.gz.

File metadata

  • Download URL: WavelinkPycord-2.5.1.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for WavelinkPycord-2.5.1.tar.gz
Algorithm Hash digest
SHA256 7f5b446dfc336e08c4335a5d1431a3634ca830d61520f7cbc61c0a0be2b8b622
MD5 40fbb339d62c2676f3764cfb02797b9d
BLAKE2b-256 afa7aca79d43a1ae46b0a929c003ff3911d27bb956544792d77fa2b89b4cb64c

See more details on using hashes here.

File details

Details for the file WavelinkPycord-2.5.1-py3-none-any.whl.

File metadata

  • Download URL: WavelinkPycord-2.5.1-py3-none-any.whl
  • Upload date:
  • Size: 43.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for WavelinkPycord-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 695a914670f4db3c1ee3493b78da1762b9d58a7855ade79730416c57ba9010da
MD5 cea86fed039aa2790dddabfebc08c62f
BLAKE2b-256 d8e9d30e8c815cd0b8eb10f0a77b08a1ecbb86a9fe52a74a4f57c4d1ff58e7a9

See more details on using hashes here.

Supported by

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