Skip to main content

PyAV audio sources for discord.py, pycord, and disnake

Project description

av-discord

PyAV audio sources for discord.py, pycord, and disnake

Installation

Stable version (PyPI)

# For Windows
py -3 -m pip install av-discord

# For Linux / Mac OS
python3 -m pip install av-discord

Development version

NOTE: You must have git installed. If you don't have it, install it from here https://git-scm.com/.

git clone https://github.com/mansuf/av-discord.git
cd av-discord
python setup.py install

Usage

from discord.ext.commands import Bot
from avcord import setup_av, AVPCMAudio, setup_encoder

# Do setup
# Use `setup_av('disnake')` if you're using disnake library
setup_av('discord')

bot = Bot()

@bot.command()
async def play(ctx):
    voice_user = ctx.message.author.voice
    vc = await voice_user.channel.connect()

    # It is important to call this function before play audio
    # to avoid "Segmentation fault" error
    setup_encoder(vc)

    source = AVPCMAudio('audio.webm')
    vc.play(source)

@bot.event
async def on_ready():
    print('READY')

bot.run('token')

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

av-discord-0.0.1.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

av_discord-0.0.1-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

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