Updates from the Repl.it team about the product

← Back to all posts
🎹 Discord Music Bots Native Support 🥁
h
amasad

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.

Voters
MaiIl1
dbriem
RoopeTuominiemi
KeRuiYang
12A527Nguyen-Hu
SnowieChanDeveloper
TenzoYuki
Acundori
adafikad
rayane3352
Comments
hotnewtop
MarcoFX

I don't understand. What are the commands? Someone pleaase tell me.

iamujy

@MarcoFX its 'music.' followed by commands like play, pause, join, etc.

ChandralathaKan

why i getting this error

"An error occurred: Command raised an exception: DownloadError: ERROR: Xx9V0fTDJY0: YouTube said: Unable to extract video data"

Mckael123

@ChandralathaKan me to, pls help @amasad

lucasmellolm

@ChandralathaKan and @Mckael123
Use this command in shell terminal: pip install -U youtube-dl

AnakinSteve

you guys need to upgrade the youtube_dl

jai789jai

List the commands for the bot.

DillonB07

@jai789jai music.help

PJM411

Is there a way to add Spotify to the bot?

BlazeAnnex

my bot gives me a error saying 'An error occurred: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice' isnt pynaci downloaded already?

taj0023

@BlazeAnnex Did u find a solution for this problem??? if so pls reply :)

BlazeAnnex

@taj0023 yeah i did it was pretty easy tbh go to packages side and search PyNaCl and then download it and youre done

taj0023

@BlazeAnnex AAAAAHHHH TYSM BRUH........

SolarK

@BlazeAnnex i know im late but how do you download it i are have stupid

SavageGamers99Y

@BlazeAnnex how do u download pls

SamirKhanGT

@BlazeAnnex you need to download pynacl again from packages

instrogamer121

@BlazeAnnex Ayo bro, your a life safer

buzzlightyear14

one issue
An error occurred: Command raised an exception: DownloadError: ERROR: iI34LYmJ1Fs: YouTube said: Unable to extract video data

Yoplayer1py

@buzzlightyear14 Use this command in shell terminal: pip install -U youtube-dl

burgerkingwhopp

for people who dont know the prefix, it's "music." you can change this by going to: bot = commands.Bot('music.', description='Yet another music bot.')
bot.add_cog(Music(bot))
and changing 'music.' to whatever prefix you want it to be

AnakinSteve

@burgerkingwhopp
where in the code is that line?
i cant seem to find it

sankalprocks02

@AnakinSteve
last or second last line, near the end

Alvinzzzzz

When the bot tried to play the next song it raises this error

DaliaAlJumaili

@Alvinzzzzz
same error, id love to get an answer on how to fix this

xxpertHacker

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

HackermonDev

@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

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

firefish

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

amasad

@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

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

xxpertHacker

@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

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

DEATHITSELF

My bot gives me an error saying: An error occurred: Command raised an exception: DownloadError: ERROR: query "Godzilla": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)'))

CubingOP
PterTill

@DEATHITSELF Do someone know, how to fix it?

cyrahaerin

have you figured out how to fix it??
@CubingOP

AnakinSteve

@cyrahaerin
run this command in the shell
pip install --upgrade youtube_dl

CoolCoderz133

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

Dhaloi

@CoolCoderz133 example: music.play <your youtube video link>

AndrewC4289

What is the prefix

Eyseedoubleyou

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

HackermonDev

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

HackermonDev

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

AwesomePendejo

ayup, can someone explain this problem and how to fix it?

AwesomePendejo

AwesomePendejo

File "main.py", line 240, in play_next_song
raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'

AwesomePendejo

File "main.py", line 240, in play_next_song
raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'

AwesomePendejo

File "main.py", line 240, in play_next_song
raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'

can someone explain me why? and how to fix it? i can't loop the muscis

instrogamer121

Why is my bot giving me this error in the Discord Chat ("An error occurred: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice") and in the Console, it says ("export PATH="$PWD/node_modules/ffmpeg-static:$PATH" python main.py")?? can anyone please help?

ShadowyShakeYT

You cannot make .env files anymore, so can somebody help???

GoldenFright100

Im so confused. I got my bot into my discord server, but the bot seems to not want to work. Any tips on how to make the bot run?

Emjok

@GoldenFright100 music. and then write join or play just send music.help

peppy10003

How do i import?

ovelionx

Anyone knows what code do i have to add if i also want that playlist on youtube can be played

AnakinSteve

the loop command dont work
i get the error "File "main.py", line 246, in play_next_song
raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'"
what should i do?

AnakinSteve

its really laggy?
what should i do?

AnakinSteve

can i change the prefix?

NguyenTong

naming the file .env is now deprecated, what should i do ?

HypeAdal

What is the bot prefix