Skip to main content

Lavalink client library for Red-DiscordBot

Project description

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.commands.ext 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 lavalink.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.

Source Distribution

Red-Lavalink-0.0.2.tar.gz (7.6 kB view hashes)

Uploaded Source

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