How to Create a Discord Music Bot [Python]
Vložit
- čas přidán 18. 03. 2022
- How to Create a Discord Music Bot [Python] (discord.py music bot tutorial)
In this Discord Music Bot Tutorial, I'll be showing you how to create a music bot using discord.py. Our bot will be able to stream music instead of downloading the full song and storing it on your computer as a file.
Support me on Patreon - / creepyd
Code (GitHub) - github.com/CreepyD246/discord...
____________
USEFUL LINKS & DOCUMENTATIONS:
Discord Developer Portal - / discord
How to Download and Set Up Python - • How to Download Python...
Discord Python Documentation - discordpy.readthedocs.io/en/s...
Discord Bot Setup Video - • How to Create a Discor...
FFmpeg Download Page - ffmpeg.org/download.html
̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅
____________
OTHER TUTORIALS:
How to Create a Discord Bot [Setup Video] - • How to Create a Discor...
How to Create a Discord Moderation Bot - • How to Create a Discor...
̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅
____________
OTHER MEDIA:
Instagram - / creepyd_studios
Twitter - / creepyd_studios
Discord - / discord
Itch.io - creepyd.itch.io
̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ - Zábava
quik note he did this : C:\ffmpeg\bin
this is not correct because he renamed the bin folder to ffmpeg keep this in mind
so do this instead C:\ffmpeg\
I hadn't realized that until now, thanks for letting me know
just go to the bin folder location, right click the location bar and copy address as text, then paste it in the variables
i thought so it seemed weird to me
thank you for saying this
we have to copy program files location or downloads location ??
my bot is not joining the voice channel how to solve it ??
@@pavanpurohit999 that is because this video is outdated
Great tutorial, thanks a bunch, hope you find friends.
Thanks man
nice easy to understand vid
Good tutorial
Hey, so I tried to implement this system into an existing discord bot with minimal modules and when i try to play soemthing on discord, it says in the terminal "ffmpeg process 24 should have terminated with a return code of -9"
I keep getting a "source must be an AudioSource not FFmpegPCMAudio" error when I try to play youtube audio or a separate, already downloaded, .mp3 file... Any thoughts?
how would I turn this into a cog function with a / slash command instead of the ? prefix you have
tried to use ?play (link) command, but in terminal of VS it says: “ffmpeg process 520 should have terminated with a return code of -9.”
for some reason the bot doesn't joins the channel there are to problems or errors can somebody help me
same here, cant get the bot to join the voice channel
I got an issue because the ffmpeg was not found even tho I set the directory to C:\ffmpeg\ mind helping me out?
are you going to add queue?
my bot could join voice channel and send back video info but no audio, terminal says: 'VoiceClient' object does not support item assignment.
I have a problem the bot joins but not play the video the erorr is 'VoiceClient' object does not support item assignment
THX
I did everything as it should be but the bot does not want to join the voice channel
Bro, I'm currently having an audio problem with my bot. I use the FFmpegPCMAudio() function to play a song on my bot, with the source file downloaded first (not the stream url). I have a problem with the audio quality of the bot that is not clear, sometimes it breaks, sometimes it's too fast, sometimes it's too slow. My bot is hosted on a DigitalOcean server with a 1/1 configuration. The internet server connection is quite fast, but the audio streaming is also not smooth. Is there any solution for this? I've googled this solution, but never found an answer to this problem 🥲
I tried it too but there is no solution
Use yt_dlp not youtube_dl
the bot says its online but it wont join the chats or play
please help everything appears to be working
I just realized you barely have any comments or likes and I have on idea why, this is something I've been trying to do for quite a while and gave up every single time until I came across your video. Literally 30? 40? mins of work and everything just worked without any hiccups.
The only one thing I had a question on was what if I wanted to run this one the cloud? everything works as it should except for when I try to play a song, it gives me an error message of not having FFMPEG, which I don't because I don't have FFMpeg installed on the cloud. Is the way I would combat that just simply installing ffmpeg and following what you did at 6:10? (linking the directory) also, if its relevant, the cloud I would be using is googles and I think its linux based so I'm not sure if that would interfere with the process in any way
Sorry for my late response. Yes, you would just need to pass the path to ffmpeg in the executable argument (like I did at 6:10). Also, I don't believe Linux would interfere with anything, but if it does let me know. I don't use Linux much though, unfortunately, so I wouldn't be able to solve your problem instantly, but I guess that's why we have Google. I'll help you search for answers online if I don't immediately know the answer. Also, thank you for the kind words.
@@CreepyD246 Gotcha! Thank you so much for you response, I'll comment back here in case there's any hiccups and if I was able to come to a solution.
had to make a few adjustments and add some stuff but it worked! could you maybe do a tutorial how to make a queue system so that it can load and ready more songs as 1 is playing?
uhm can you possibly tell me all the adjustments bc it would really help
@@TWJamesSS No problem, had to put the all music commands under the same bot.event for it to work with other codes. then I came accross a problem where the song/bot disconnects after like a minute so i added ffmpeg_options = {'options': "-vn", "before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5"} on the ffmpeg. I don't remember all the adjustment but ill be more than happy to send my bot's code to u by email. im using pycharm if that matters
@@fr0zzy997 Thanks a tonne you're a life saver
@@fr0zzy997 can i also receive some help?
@@sethr2b966 send me ur email and ill send u the code that I have, hopefully itll help
If i typ ?play [URL] its not joining the vc?
how do I make it loop or skip? I dont know how xd
Donwloading webpage
'url'
update: now it says ffmpeg process xxxxx successfully terminated with the return code of 1
but no music was played in the bot
why does it say error
[youtube] BSDPQ1uP7GI: Downloading webpage
ffmpeg was not found.
Sorry about the error, I only now realized an error in my tutorial. Check the pinned comment
can you make a tutorial there you can like add songs in a queue?
I’m trying to send my discord but it appears my comment keeps getting removed. If you need help with this let me know I got it figured out
can anyone help to find ffmpeg exe for linux having problem while running in server
its says in line 9 that is missing intents
i keep getting this error
[youtube] C2gSvt0LNSs: Downloading webpage
'dict' object is not callable
I also get stuck on the downloading webpage step, but it is not throwing me any errors
It don’t work the bot join the voice channel but it doesn’t play the music
Remember NOT to share your API keys/tokens
I keep getting this:
ffmpeg process "random numbers" should have terminated with a return code of 1.
Also the bot doesnt join
also if i remove the expect print error it gives me:
PyNaCl library needed in order to use voice
Good morning, I have a problem that I still can't solve and that is that the code and the bot work, but the music cannot be heard, could you please help me?
Make sure to install and setup FFMPEG correctly. Check the pinned comment for some info on it, I made a small mistake in my tutorial
I tried to use ?play (link) command, but in terminal of VS it says: “ffmpeg not found”
Download ffmpeg. Make sure to do each step in the tutorial
@@CreepyD246 thanks, It helped a little,
Could it be possible to add a queue to this bot? Because if it's already playing a song, you need to wait until its over to play something.
the dude putting 10h bass boosts:
Yeah it’s possible. Do you still need help with this? I figured out how to
@@phazedrl what is your solution?
I’ve been trying to send my discord to elaborate on my solution but it’s keeps deleting my comment. Do you want me to just publish code on this comment thread?
@@Fooleirasforgot to mention you on the comment I made
Downloading webpage
ffmpeg was not found. i have this error
Sorry about this. Check the pinned comment
could you maybe show how to queue and maybe search songs ?
Do you still need help with this? I figured out an easy way to do this
@@phazedrl yes i do
@@phazedrl help
@@Verwiesen I tried to send my discord but it’s getting automatically deleted
@@ITEngines trying to figure out how to send my contact information haha
bot doesnt join the channel
it says in terminal "[youtube] LrL8_b3LZLM: Downloading webpage" but no sound plays
Do you still need help with this?
@@phazedrl LOL, what a coincidence, I just started rewriting my discord bot after not working on it for 6 months lmao
@@fantasypvp eyyy nice hahaha. I tried sending my discord and it got automatically deleted. Unsure how to share my contact infor
The bot joins, but no music plays. How do I fix this?
Make sure you downloaded and set ffmpeg up correctly
it doesn't work
Client.__init__() missing 1 required keyword-only argument: 'intents'
client = discord.Client(intents=discord.Intents.default()) run this instead of client = discord.client
is it working in 2023?
no
yes
how you get it to work bc mine wont join the channel@@keyanare
TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'
use py-cord lib and add this at the start of the code:intents =
discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)