Skip to main content

Lavalink client library for Red-DiscordBot

Project description

Travis CI status Documentation Status Code style: black

A Lavalink client library written for Python 3.5 using the AsyncIO framework. This library may be used for other projects as it contains no Red specific code or logic.

However, it is important to note that this library only supports projects using discord.py.

To install:

pip install red-lavalink

Usage

import lavalink
from discord.ext.commands import Bot

bot = Bot()


@bot.event
async def on_ready():
    lavalink.initialize(
        bot, host='localhost', password='password',
        rest_port=2332, ws_port=2333
    )


async def search_and_play(voice_channel, search_terms):
    player = await lavalink.connect(voice_channel)
    tracks = await player.search_yt(search_terms)
    player.add(tracks[0])
    await player.play()

When shutting down, be sure to do the following:

await lavalink.close()

Project details


Download files

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

Files for Red-Lavalink, version 0.3.0
Filename, size & hash File type Python version Upload date
Red_Lavalink-0.3.0-py3-none-any.whl (28.3 kB) View hashes Wheel py3
Red-Lavalink-0.3.0.tar.gz (13.5 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page