Updates from the Repl.it team about the product

← Back to all posts
🎹 Discord Music Bots Native Support 🥁
amasad (2521)

At Repl.it we believe programming should useful, fun, and exciting. Discord bots have been something people loved to make with Repl.it ever since we enabled outbound network connections from repls (yes, we used to disable networking).

Discord music bots, however, didn't work very well if at all. At first, OPUS was missing from our Python environment. Then we also inadvertently blocked voice connections from our servers. So all in all it was a pain. However, today, I'm excited to announce that Music Bots natively work on Repl.it.

The only thing that's currently missing from our images is native ffmpeg support, but that can be worked around by installing ffmpeg-static from npm. I just added the following Python repl to templates to make it easy for you to get started.

I know it works in Node.js too but I didn't have the time to make a nice template. If anyone can make a very simple template for Node.js I'd love to include it in our template library.

CoolCoderz133 (1)

What is the prefix to this bot? how do i use it?

Eyseedoubleyou (24)

how did you get the packages package-lock.json and package.json?

xxpertHacker (387)

With native OPUS, networking, and native always up Repls... Repl might just be suitable for hosting a powerful bot.

PDanielY (1091)

@xxpertHacker It might be able to host a small bot (a bot in like 20 servers) but it can't host big bots (a bot in like 200+ servers) because of memory and ram.

xxpertHacker (387)

@PDanielY Yeah, there's also that, I forgot.

firefish (506)

@xxpertHacker Containers have limits. Don't push them.

amasad (2521)

@firefish I don't know, we run some production work on Repl.it on a single container and it serves lots of users. We also have a lot of big bots already hosted on repl.it.

I would try it. If your code is efficient it should work especially with the hacker plan.

In the future, we'll probably have to introduce an even bigger plan.

firefish (506)

@amasad Ok, I might just try it... sound interesting to me! :)

xxpertHacker (387)

@amasad @firefish The biggest problem with most bots hosted here is the actual code and language, usually, they're written in inefficient languages (ex: Python, JS), but what's worse is they're often set up in very inefficient ways.
If you set it up correctly, plan ahead, and know what you're doing, it can perform very well, but this applies even outside of Repl.it.

Eyseedoubleyou (24)

@amasad my bot has grown a lot and it's all on repl :D

Beau222 (0)

Does anyone know the prefix? I dont know what it is.

TylerFlowers (4)

Oh sweet! Finally! This is probably gonna be a nightmare to set up with my current bot, but I'm glad this is finally supported.

AndrewC4289 (0)

What is the prefix

Faresgmr (0)

it says improper token has been passed :'(

HahaYes (1206)

mosic shall overtake the world

Tea307307 (0)

where can i put the preflix in?

TheForArkLD (710)

thanks for merge,
and this is cool :D

stubaduble (13)

I am so confused.. how do you give your bot an actual purpose?

stubaduble (13)

@amasad what does the token mean?
Is it the id?

TonyCrafter (0)

@stubaduble Open Chrome, go to Discord Developer Portal and select your application. If you don't have one, create it. Then look for this tab. It's at your left.

Click Bots, and you'll see something like this.

Click Copy, and you're done.

TonyCrafter (0)

Oh, and you don't want to share it. People may have full access to your bot if you leak that token somewhere on the internet. Keep it safe!

MuriloBeluco (0)

my bot fails with the error "ffmpeg was not found"

amasad (2521)

@MuriloBeluco If you forked our template it should work. If you're starting from scratch make sure to

  • open shell and npm install ffmpeg-static
  • create a .replit file and in it put the following:
export PATH="$PWD/node_modules/ffmpeg-static:$PATH"
python main.py
amasad (2521)

@MuriloBeluco You should still use npm install because that's the easiest way to get ffmpeg right now.

We're in the process of adding it by default but for now follow the steps above.

PDanielY (1091)

Tried to create a discord bot to play music (https://repl.it/@PDanielY/EasygoingPlumHashmaps#index.js).

(node:482) UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!
    at Function.getInfo (/home/runner/EasygoingPlumHashmaps/node_modules/prism-media/src/core/FFmpeg.js:130:11)
    at Function.create (/home/runner/EasygoingPlumHashmaps/node_modules/prism-media/src/core/FFmpeg.js:143:38)
    at new FFmpeg (/home/runner/EasygoingPlumHashmaps/node_modules/prism-media/src/core/FFmpeg.js:44:27)
    at AudioPlayer.playUnknown (/home/runner/EasygoingPlumHashmaps/node_modules/discord.js/src/client/voice/player/BasePlayer.js:47:20)
    at VoiceConnection.play (/home/runner/EasygoingPlumHashmaps/node_modules/discord.js/src/client/voice/util/PlayInterface.js:71:28)
    at startPlaying (/home/runner/EasygoingPlumHashmaps/index.js:12:14)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
PDanielY (1091)

@PDanielY oh wait, i forgot to install ffmpeg-static but i fixed it. so nodejs template: https://repl.it/@PDanielY/discord-music-bot-template

DynamicSquid (3532)

Awesome! Wish you could make a bot using a C-Family language though...

xxpertHacker (387)

@DynamicSquid Why can't you? I've seen bots built with aegis.cpp.

firefish (506)

@DynamicSquid There's a thing called C++ embedding in nodejs, and you can also have full access to the raw V8 engine via that

dabs364 (272)

AttributeError: 'NoneType' object has no attribute 'strip'
exit status 1 @amasad