🎹 Discord Music Bots Native Support 🥁
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.
why i getting this error
"An error occurred: Command raised an exception: DownloadError: [0;31mERROR:[0m Xx9V0fTDJY0: YouTube said: Unable to extract video data"
@ChandralathaKan me to, pls help @amasad
@ChandralathaKan and @Mckael123
Use this command in shell terminal: pip install -U youtube-dl
@lucasmellolm mine uninstalls the new version and decides to use the previous one for some reason
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?
@BlazeAnnex Did u find a solution for this problem??? if so pls reply :)
@taj0023 yeah i did it was pretty easy tbh go to packages side and search PyNaCl and then download it and youre done
@BlazeAnnex AAAAAHHHH TYSM BRUH........
@BlazeAnnex i know im late but how do you download it i are have stupid
@BlazeAnnex how do u download pls
@BlazeAnnex you need to download pynacl again from packages
@BlazeAnnex Ayo bro, your a life safer
List the commands for the bot.
@jai789jai music.help
where can i find the website it doesn't generate a link or smthing
Is there a way to add Spotify to the bot?
one issue
An error occurred: Command raised an exception: DownloadError: [0;31mERROR:[0m iI34LYmJ1Fs: YouTube said: Unable to extract video data
@buzzlightyear14 Use this command in shell terminal: pip install -U youtube-dl
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
@burgerkingwhopp
where in the code is that line?
i cant seem to find it
@AnakinSteve
last or second last line, near the end
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'
@Alvinzzzzz
same error, id love to get an answer on how to fix this
With native OPUS, networking, and native always up Repls... Repl might just be suitable for hosting a powerful bot.
@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.
@PDanielY Yeah, there's also that, I forgot.
@xxpertHacker Containers have limits. Don't push them.
@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.
@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.
you guys need to upgrade the youtube_dl
My bot gives me an error saying: An error occurred: Command raised an exception: DownloadError: [0;31mERROR:[0m query "Godzilla": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)'))
Yeah me [email protected]
@DEATHITSELF Do someone know, how to fix it?
have you figured out how to fix it??
@CubingOP
@cyrahaerin
run this command in the shell
pip install --upgrade youtube_dl
@NilsoTheCookieMonster it replys with "command not found"
What is the prefix to this bot? how do i use it?
@CoolCoderz133 example: music.play
What is the prefix
how did you get the packages package-lock.json and package.json?
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 oh wait, i forgot to install ffmpeg-static
but i fixed it. so nodejs template: https://repl.it/@PDanielY/discord-music-bot-template
what does "the website made for your repl" in the markdown instructions mean? Is that the link to the code on repl or is it something else?
how do i make a javascript music bot with this?
Even if I changed the name to keep_alive() no website URL appears when I run it
i get the error package operation failed any help?
The bot simply doesn't work for me..
Tried using Music, Music. music and music.
it simply doesn't work! help me pls
Im getting any error of exit status 1 what it mean
I am a music lover and love breakthrough ideas in music. I really like what you have shared. This will help with my phone dzwonki mp3 idea.
Is there a line of code that i cna change the skip so that there has to be no votes to skip a song regardless of who requested the song?
it gives me an "exit status 1" how do i fix this?
How to make the bot a .mp3 file? What I mean is that I upload a .mp3 file from my computer, and before I send it, I put in the command and send it, after sending the .mp3 file, the bot will play the song (if it is in a channel with the person who sent the .mp3 file with the command)
This file cannot be displayed:
File "main.py", line 240, in play_next_song
raise VoiceError(str(error))
VoiceError: 'NoneType' object has no attribute 'read'
I don't understand. What are the commands? Someone pleaase tell me.
@MarcoFX its 'music.' followed by commands like play, pause, join, etc.