Git Product home page Git Product logo

wavelink's Introduction

https://raw.githubusercontent.com/PythonistaGuild/Wavelink/master/logo.png

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

    track = await wavelink.YouTubeTrack.search(search, return_first=True)
    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()

Lavalink Installation

Head to the official Lavalink repo and give it a star!

  • Create a folder for storing Lavalink.jar and related files/folders.
  • Copy and paste the example application.yml to application.yml in the folder we created earlier. You can open the yml in Notepad or any simple text editor.
  • Change your password in the application.yml and store it in a config for your bot.
  • Set local to true in the application.yml if you wish to use wavelink.LocalTrack for local machine search options... Otherwise ignore.
  • Save and exit.
  • Install Java 17(Windows) or Java 13+ on the machine you are running.
  • Download Lavalink.jar and place it in the folder created earlier.
  • Open a cmd prompt or terminal and change directory cd into the folder we made earlier.
  • Run: java -jar Lavalink.jar

If you are having any problems installing Lavalink, please join the official Discord Server listed above for help.

wavelink's People

Contributors

evieepy avatar chillymosh avatar aaronhnsy avatar scragly avatar bijij avatar mrarkon avatar isaa-ctaylor avatar abstractumbra avatar wizzygeek avatar clement-ldr avatar skullbite avatar reinasakuraba avatar ombucha avatar pendragonlore avatar lostluma avatar kosmicanomaly avatar devoxin avatar adure avatar zritsu avatar wladbelsky avatar twitch0001 avatar gamescom15 avatar souranild avatar aukur avatar senpos avatar willy-c avatar ultrasonic1209 avatar roxashe avatar mccoderpy avatar gelbpunkt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.