Giter Club home page Giter Club logo

pycord.wavelink's Introduction

Pycord.Wavelink

Wavelink is robust and powerful Lavalink wrapper for Pycord! Wavelink features a fully asynchronous API that's intuitive and easy to use.

Support

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

Discord

Documentation

The documention can be found here!

Installation

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

WaveLink requires Python 3.8+

Windows

py -3.9 -m pip install pycord.wavelink --pre

Linux

python3.9 -m pip install pycord.wavelink --pre

Getting Started

A quick and easy bot example:

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

    @commands.Cog.listener()
    async def on_wavelink_node_ready(self, node: wavelink.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: wavelink.YouTubeTrack):
        """Play a song with the given search query.
        If not connected, connect to our voice channel.
        """
        if not ctx.voice_client:
            vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
        else:
            vc: wavelink.Player = ctx.voice_client
        await vc.play(search)

bot = Bot()
bot.add_cog(Music(bot))
bot.run('YOUR_BOT_TOKEN')

pycord.wavelink's People

Contributors

adure avatar aschenkuttel avatar bijij avatar clement-ldr avatar cuzimsyntax avatar evieepy avatar gamescom15 avatar gelbpunkt avatar ikusaba-san avatar imshvishal avatar keksiqc avatar lostluma avatar lulalaby avatar makiyu-py avatar mujykun avatar omlanke avatar pendragonlore avatar ranile avatar reinasakuraba avatar roxashe avatar scragly avatar skullbite avatar souranild avatar tari-dev avatar twitch0001 avatar ultrasonic1209 avatar vincentrps avatar willy-c avatar wizzygeek avatar zritsu 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.