Updates from the Repl.it team about the product

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

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.

Comments
hotnewtop
NguyenTong (0)

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

HypeAdal (0)

What is the bot prefix

lucasmellolm (0)

I fix bug: An error occurred: Command raised an exception: DownloadError: ERROR:[<id-video>YouTube said: Unable to extract video data

Use this command in shell terminal: pip install -U youtube-dl
Edit File "pyproject.toml" youtube version 2021.5.16

PJM411 (2)

Is there a way to add Spotify to the bot?

DaniDani2006 (0)

Traceback (most recent call last):
File "main.py", line 504, in <module>
bot.run(os.getenv("TOKEN"))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 718, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 697, in runner
await self.start(args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 660, in start
await self.login(
args, bot=bot)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 509, in login
await self.http.static_login(token.strip(), bot=bot)
AttributeError: 'NoneType' object has no attribute 'strip'
exit status 1

I get this as error pls help

cyrahaerin (1)

yeah i got that too? have you figured out how to fix it??

update:you just needed to make your token secret ^^
@DaniDani2006

MrYoavon (0)

What are the commands in this bot?

buzzlightyear14 (2)

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

Yoplayer1py (6)

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

PterTill (0)

I got this error:
query "raining tacos": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)'))
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "connect" is not found
How can I fix it?

PterTill (0)

What is the command prefix?

EricChen47 (0)

why can't it play youtube playlists?

burgerkingwhopp (1)

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

Cioara0000 (0)

for me is not working, i tried to play a song, i add at the final
"bot = commands.Bot(command_prefix=("$"))
bot.add_cog(Music(bot)"
and i tried to play something with my prefix "$" and doesn't work, do i need to download the packages files that you post it here, or it doesn't matter?

ChandralathaKan (8)

why i getting this error

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

lucasmellolm (0)

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

jai789jai (3)

List the commands for the bot.

MarcoFX (9)

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

iamujy (0)

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

Scorpliet (0)

For those people confused with prefix
you can add it yourselves too
in the line:
bot = commands.Bot('music.', description='Yet another music bot.')
change it to
bot = commands.Bot(command_prefix=("!"),'music.', description='Yet another music bot.')
Here the prefix i set was '!'

DEATHITSELF (1)

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)'))

PterTill (0)

@DEATHITSELF Do someone know, how to fix it?

cyrahaerin (1)

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

Alvinzzzzz (2)

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

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 598, in run
    self._do_run()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 585, in _do_run
    data = self.source.read()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 538, in read
    ret = self.original.read()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 223, in read
    ret = self._stdout.read(OpusEncoder.FRAME_SIZE)
AttributeError: 'NoneType' object has no attribute 'read'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 611, in _call_after
    self.after(error)
  File "main.py", line 393, in play_next_song
    raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'
expensivesalt80 (0)

What is the prefix and how cna I change it

DEATHITSELF (1)

@expensivesalt80 From what I see the bot doesn’t have a prefix. To change it go to the bottom of the main.py code and find where it says bot = commands.Bot(‘music.’, description=‘Yet another music bot.’). Once you have found that change it to bot = commands.Bot(‘music.’, description=‘Yet another music bot.’, command_prefix = ‘yourprefix’). I hope this helps you and others that may see this message :)

DEATHITSELF (1)

The prefix is music.

BlazeAnnex (6)

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 (0)

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

BlazeAnnex (6)

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

taj0023 (0)

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

SolarK (2)

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

SamirKhanGT (0)

@BlazeAnnex you need to download pynacl again from packages

Beau222 (1)

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.

CoolCoderz133 (2)

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

Dhaloi (6)

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

Faresgmr (0)

it says improper token has been passed :'(

HahaYes (1868)

mosic shall overtake the world

Tea307307 (0)

where can i put the preflix in?

Eyseedoubleyou (25)

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