Learn to Code via Tutorials on Repl.it!

← Back to all posts
OPUS SUPPORT FOR DISCORD MUSIC BOTS!
h
Scoder12 (681)

The wait is over! You can now make music bots with discord! I have compiled libopus.so for repl.it which you can now use to make music bots.

To make your bot in python, all you have to do is fork the repl linked below.
If you want to use a different language than python for your bot, you need to download the .so file. Just fork the repl, press ctrl+shift+s, type php -S 0.0.0.0:8080, and then add /libopus.so.0.8.0 to the url of your repl to download the file. Next, upload this file into your repl.

Ask questions in the comments, I might be able to help.

Before you comment asking for help:

Try it first, then let me know whether it worked or not. If it worked for you I'll update the post, otherwise I'll help the best I can.

Enjoy, upvote if it helped you!

Commentshotnewtop
amasad (2497)

Thanks so much, Scoder! I will close the bug report and direct people to this.

tpunn19 (7)

@amasad, This only works on Python. Most people who make Discord bots won't be able to use this feature.

TroolProo (0)

Hello I have an error in my music bot that does not play the songs, I did it from my pc, I uploaded it and it does not play, but if I open it from visual studio code it plays, I wanted to see if someone can help me I am new to this world of programming

Hodat2k9 (0)

When I add discord.opus.load_opus("./libopus.so.0.8.0"), it stops working. It has a lot of errors, but when I scroll down it said files such as in directory.

Scoder12 (681)

@Hodat2k9 fork the repl I attached first so you have that file, or upload it into your repl

CoolJames1610 (558)

I followed a tutorial and I think thats the problem. How would I use opus to create a music bot?

tpunn19 (7)

Hi, my entire bot is written in JavaScript, so I would like to continue using Discord.js instead of Discord.py. I don't seem to understand based on your article on how to add OPUS. If there is no way, then I will write my next bot in Python (though I prefer JavaScript).

tpunn19 (7)

I tried doing it, and it says: [VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds.

Scoder12 (681)

@tpunn19 I'm trying to get this to work and I will let you know if I can figure it out.

tpunn19 (7)

@Scoder12 Did you get anything yet? Just checking.

Scoder12 (681)

@tpunn19 havent been working on it at all

TrainsRUs (4)

Still not working for me - The code hangs on await message.author.voice.channel.connect() and never completes. The bot physically joins the channel but any attempt to disconnect or play audio, it just Not connected to voice.

Scoder12 (681)

@TrainsRUs I got the same issue and have opened an issue in discord.py for it.

TrainsRUs (4)

@Scoder12 Yeah I think its a repl issue still - copied the code onto my windows PC and it works a dream (without the problem mentioned above). Have to keep that part of my bot locally hosted now though :(.

Trunks8257 (0)

Hi, I'm actually doing this in nodejs and I'm getting the same as before the file was added (the bot joins the vc but doesn't play nothing). I'm using Discord.js 12.2.0 and ffmpeg-static.

Trunks8257 (0)

idk if it could be useful but I get an error

[VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds.

Scoder12 (681)

@Trunks8257 I don't know whether it works on discord.js.

Trunks8257 (0)

@Scoder12
Ok,no problem. Do you know any way of doing it in discord.js?

xxpertHacker (341)

I can't believe the Repl.it team gave up and didn't actually implement this themselves. Good work nonetheless.

xxpertHacker (341)

@mat1 Then why can't we make out own Repls? Check my bio.

willuhmjs (7)

@mat1 yes they need to hire more staff ffs and actually implement this sh*t

willuhmjs (7)

Can we get more in depth instructions for nodejs installation

Scoder12 (681)

@willuhmjs what are you having trouble with

SilentShadowBla (537)

yes that would be helpful xd @willuhmjs

SilentShadowBla (537)

can u give me an overall way to do this in discord.js?^_^ @Scoder12

Scoder12 (681)

@SilentShadowBla try it first, then let me know whether it worked or not. If it worked for you I'll update the post, otherwise I'll help the best I can.

SilentShadowBla (537)

so i have the file in my nodejs repl, but how do I use it? (I'm retarded)

@Scoder12

Scoder12 (681)

@SilentShadowBla try running some voice code. Let me know what happens.

Scoder12 (681)

@SilentShadowBla if you're not running a music bot you have no reason to use this post. Let me know if you actually run any code and need help.

a5rocks (787)

Have a virtual cookie! By the way, to start a local web server you can also do python3 -m http.server 8080 (if you want to stay in the python ecosystem :p)

Scoder12 (681)

@a5rocks yeah, I never remember that command haha! Luckily its repl.it so everything is already installed.