Skip to content Skip to sidebar Skip to footer

Discord.py - Command Raised An Exception: OpusNotLoaded

I was making an music bot but I had it having this problem, im running python 3.6.8 and its hosted on heroku I've heard I need to use discord.opus.LoadOpus or something like that b

Solution 1:

You don't need to add anything to your code, try adding this to your buildpacks on Heroku:

https://github.com/xrisk/heroku-opus.git

Solution 2:

Try to load the opus module using :

discord.opus.load_opus()

Anywhere before you try do to anything related to voice channels with your bot.

According to the discord.py docs you should not need it on a windows environnement, which is maybe why it worked on your local machine and not on heroku (which is unix based).

Also, I would do the following :

discord.opus.load_opus()
if not discord.opus.is_loaded():
    raise RunTimeError('Opus failed to load')

So you are sure that an exception will be raised if it's not loaded properly and know where to look immediatly. If an exception occurs while loading, it will still propagate.


Solution 3:

I'm a Mac user (Not using Heroku) and I also got the same error. I tried the following methods: discord.opus.load_opus() which caused a required argument error. discord.opus.load_opus('opus') which caused another error.

The only thing that solved the error for me was to:

» Open up the Mac terminal

» Write the following code in the terminal brew install opus and enter.

» Open up the IDE where you wrote the code for the bot.

» Try to type this in the beginning of the code or above the music commands discord.opus.load_opus()

» Run your bot in discord.

Now you will not get any errors and the bot will play music in the voice channel.


Post a Comment for "Discord.py - Command Raised An Exception: OpusNotLoaded"