Onur
Onur

Reputation: 197

discord.py play command has problems with opus while using heroku

So I have a play command in my bot

@client.command()
    async def play(ctx, url):
    YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist':'True'}
    FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)

    if not voice.is_playing():
        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
        URL = info['formats'][0]['url']
        voice.play(discord.FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
        voice.is_playing()
    else:
        await ctx.send("Already playing song")
        return

and a discord.opus.load_opus("opus") line at the start. When I try to run the command I get this error OSError: opus: cannot read file data: Is a directory

PS I'm using Heroku to run the bot 24/7

Upvotes: 0

Views: 532

Answers (1)

xrisk
xrisk

Reputation: 3898

The discord.opus.load_opus("opus") isn't required; you can safely remove it.

The https://github.com/xrisk/heroku-opus.git buildpack already adds opus to the library path. No further configuration is needed :)

Upvotes: 1

Related Questions