How to Create a Discord Music Bot [Python]

Sdílet
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

Komentáře • 98

  • @FlockersDesign
    @FlockersDesign Před rokem +16

    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\

    • @CreepyD246
      @CreepyD246  Před rokem +7

      I hadn't realized that until now, thanks for letting me know

    • @jgplayz
      @jgplayz Před rokem

      just go to the bin folder location, right click the location bar and copy address as text, then paste it in the variables

    • @novianpontifex3820
      @novianpontifex3820 Před 10 měsíci

      i thought so it seemed weird to me
      thank you for saying this

    • @pavanpurohit999
      @pavanpurohit999 Před 4 měsíci

      we have to copy program files location or downloads location ??
      my bot is not joining the voice channel how to solve it ??

    • @FlockersDesign
      @FlockersDesign Před 4 měsíci

      @@pavanpurohit999 that is because this video is outdated

  • @luboisfat
    @luboisfat Před rokem +2

    Great tutorial, thanks a bunch, hope you find friends.

  • @timcre6166
    @timcre6166 Před 2 lety +1

    nice easy to understand vid

  • @Raizelen
    @Raizelen Před rokem

    Good tutorial

  • @mega7269
    @mega7269 Před rokem +3

    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"

  • @bryanmantell
    @bryanmantell Před 2 lety +2

    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?

  • @godlyvideos2379
    @godlyvideos2379 Před 5 měsíci +1

    how would I turn this into a cog function with a / slash command instead of the ? prefix you have

  • @leventekalocsai8113
    @leventekalocsai8113 Před rokem +1

    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.”

  • @piguinos3348
    @piguinos3348 Před rokem +8

    for some reason the bot doesn't joins the channel there are to problems or errors can somebody help me

  • @uniquename3929
    @uniquename3929 Před rokem

    I got an issue because the ffmpeg was not found even tho I set the directory to C:\ffmpeg\ mind helping me out?

  • @jonasbang3918
    @jonasbang3918 Před 2 lety +2

    are you going to add queue?

  • @brannn69
    @brannn69 Před rokem

    my bot could join voice channel and send back video info but no audio, terminal says: 'VoiceClient' object does not support item assignment.

  • @xarkata9682
    @xarkata9682 Před 2 lety

    I have a problem the bot joins but not play the video the erorr is 'VoiceClient' object does not support item assignment

  • @Polokalap
    @Polokalap Před rokem

    THX

  • @Jsjdndne
    @Jsjdndne Před rokem +2

    I did everything as it should be but the bot does not want to join the voice channel

  • @herbertendrian4638
    @herbertendrian4638 Před 2 lety +3

    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 🥲

  • @pony328
    @pony328 Před rokem

    the bot says its online but it wont join the chats or play
    please help everything appears to be working

  • @shineori4078
    @shineori4078 Před 2 lety +1

    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

    • @CreepyD246
      @CreepyD246  Před 2 lety +1

      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.

    • @shineori4078
      @shineori4078 Před 2 lety

      @@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.

  • @fr0zzy997
    @fr0zzy997 Před rokem +2

    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?

    • @TWJamesSS
      @TWJamesSS Před rokem +1

      uhm can you possibly tell me all the adjustments bc it would really help

    • @fr0zzy997
      @fr0zzy997 Před rokem +1

      @@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

    • @TWJamesSS
      @TWJamesSS Před rokem +1

      @@fr0zzy997 Thanks a tonne you're a life saver

    • @sethr2b966
      @sethr2b966 Před rokem +1

      @@fr0zzy997 can i also receive some help?

    • @fr0zzy997
      @fr0zzy997 Před rokem

      @@sethr2b966 send me ur email and ill send u the code that I have, hopefully itll help

  • @Jochem2502
    @Jochem2502 Před rokem +1

    If i typ ?play [URL] its not joining the vc?

  • @Kr1nxx
    @Kr1nxx Před 2 lety +1

    how do I make it loop or skip? I dont know how xd

  • @NikO-jp6vs
    @NikO-jp6vs Před 4 dny

    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

  • @roger724
    @roger724 Před 2 lety +3

    why does it say error
    [youtube] BSDPQ1uP7GI: Downloading webpage
    ffmpeg was not found.

    • @CreepyD246
      @CreepyD246  Před rokem +1

      Sorry about the error, I only now realized an error in my tutorial. Check the pinned comment

  • @milliestan
    @milliestan Před rokem +2

    can you make a tutorial there you can like add songs in a queue?

    • @phazedrl
      @phazedrl Před rokem

      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

  • @aswinbabu1630
    @aswinbabu1630 Před rokem

    can anyone help to find ffmpeg exe for linux having problem while running in server

  • @saidesandreas
    @saidesandreas Před rokem

    its says in line 9 that is missing intents

  • @MrLeon0
    @MrLeon0 Před 2 lety +1

    i keep getting this error
    [youtube] C2gSvt0LNSs: Downloading webpage
    'dict' object is not callable

    • @sethy3055
      @sethy3055 Před 2 lety

      I also get stuck on the downloading webpage step, but it is not throwing me any errors

  • @EliasFYHP
    @EliasFYHP Před rokem

    It don’t work the bot join the voice channel but it doesn’t play the music

  • @CreepyD246
    @CreepyD246  Před 2 měsíci +1

    Remember NOT to share your API keys/tokens

  • @KaidaForever
    @KaidaForever Před rokem +1

    I keep getting this:
    ffmpeg process "random numbers" should have terminated with a return code of 1.
    Also the bot doesnt join

    • @KaidaForever
      @KaidaForever Před rokem

      also if i remove the expect print error it gives me:
      PyNaCl library needed in order to use voice

  • @JhonDaid_JD
    @JhonDaid_JD Před měsícem

    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?

    • @CreepyD246
      @CreepyD246  Před měsícem

      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

  • @sleshkatplays849
    @sleshkatplays849 Před 2 lety

    I tried to use ?play (link) command, but in terminal of VS it says: “ffmpeg not found”

    • @CreepyD246
      @CreepyD246  Před 2 lety +1

      Download ffmpeg. Make sure to do each step in the tutorial

    • @sleshkatplays849
      @sleshkatplays849 Před 2 lety

      @@CreepyD246 thanks, It helped a little,

  • @sethy3055
    @sethy3055 Před 2 lety +4

    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.

    • @user-yj8di6kz5s
      @user-yj8di6kz5s Před 2 lety +1

      the dude putting 10h bass boosts:

    • @phazedrl
      @phazedrl Před rokem +2

      Yeah it’s possible. Do you still need help with this? I figured out how to

    • @Fooleiras
      @Fooleiras Před rokem

      @@phazedrl what is your solution?

    • @phazedrl
      @phazedrl Před rokem

      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?

    • @phazedrl
      @phazedrl Před rokem

      @@Fooleirasforgot to mention you on the comment I made

  • @slaughter420
    @slaughter420 Před rokem +1

    Downloading webpage
    ffmpeg was not found. i have this error

    • @CreepyD246
      @CreepyD246  Před rokem +2

      Sorry about this. Check the pinned comment

  • @Verwiesen
    @Verwiesen Před 2 lety +1

    could you maybe show how to queue and maybe search songs ?

    • @phazedrl
      @phazedrl Před rokem

      Do you still need help with this? I figured out an easy way to do this

    • @Verwiesen
      @Verwiesen Před rokem +1

      @@phazedrl yes i do

    • @ITEngines
      @ITEngines Před rokem

      @@phazedrl help

    • @phazedrl
      @phazedrl Před rokem

      @@Verwiesen I tried to send my discord but it’s getting automatically deleted

    • @phazedrl
      @phazedrl Před rokem

      @@ITEngines trying to figure out how to send my contact information haha

  • @hershey6171
    @hershey6171 Před rokem +3

    bot doesnt join the channel

  • @fantasypvp
    @fantasypvp Před 2 lety

    it says in terminal "[youtube] LrL8_b3LZLM: Downloading webpage" but no sound plays

    • @phazedrl
      @phazedrl Před rokem

      Do you still need help with this?

    • @fantasypvp
      @fantasypvp Před rokem

      @@phazedrl LOL, what a coincidence, I just started rewriting my discord bot after not working on it for 6 months lmao

    • @phazedrl
      @phazedrl Před rokem

      @@fantasypvp eyyy nice hahaha. I tried sending my discord and it got automatically deleted. Unsure how to share my contact infor

  • @theshark9001
    @theshark9001 Před 10 měsíci

    The bot joins, but no music plays. How do I fix this?

    • @CreepyD246
      @CreepyD246  Před 10 měsíci

      Make sure you downloaded and set ffmpeg up correctly

  • @SpaceSp3ctrum
    @SpaceSp3ctrum Před rokem +1

    it doesn't work

  • @WoWPnK
    @WoWPnK Před rokem

    Client.__init__() missing 1 required keyword-only argument: 'intents'

    • @TWJamesSS
      @TWJamesSS Před rokem +1

      client = discord.Client(intents=discord.Intents.default()) run this instead of client = discord.client

  • @rarestars6238
    @rarestars6238 Před rokem

    is it working in 2023?

  • @Channel-ut8ww
    @Channel-ut8ww Před rokem +1

    TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

    • @vaizi27
      @vaizi27 Před rokem +1

      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)