Create a Discord Music Bot with a Queue in Python [2024]

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ม.ค. 2025

ความคิดเห็น • 56

  • @m.h630
    @m.h630 19 วันที่ผ่านมา +1

    Thanks for making this video, bots working perfectly!

    • @ethancox2025
      @ethancox2025  19 วันที่ผ่านมา

      @m.h630 thanks for the kind words! Glad it's working so many months later.

  • @龔柏叡
    @龔柏叡 7 หลายเดือนก่อน +2

    very useful,thanks for the perfect tutorial.

  • @DraukooYT
    @DraukooYT 7 หลายเดือนก่อน +3

    Thanks my dude!

  • @fukkumicu
    @fukkumicu 4 วันที่ผ่านมา

    what should i do if the terminal shows "INFO discord.client logging in using static token" and the bot still doesn't appear online ?😞

  • @potatoforfries
    @potatoforfries 8 หลายเดือนก่อน +2

    Too late to reply.. But greatt tutorial everything worked smoothly as per the need..
    Future potential tutorial idea: searching for URL if name of the video is provided.

  • @Deluxaa06
    @Deluxaa06 28 วันที่ผ่านมา +1

    just typing the command and listening to music with the bot

  • @jonathanjacob512
    @jonathanjacob512 9 หลายเดือนก่อน +1

    does this support playing playlists?

    • @jonathanjacob512
      @jonathanjacob512 9 หลายเดือนก่อน

      great video btw

    • @ethancox2025
      @ethancox2025  9 หลายเดือนก่อน +1

      I actually have never tried that. Did it work for you?

    • @jonathanjacob512
      @jonathanjacob512 8 หลายเดือนก่อน

      ​@@ethancox2025 no it didnt, it seems to connect to voice channel and download all the songs in the list but doesnt play anything

  • @AlterSwiftie
    @AlterSwiftie 2 หลายเดือนก่อน

    Excellent video, is there a way to use command “play” for both play and queue functions?

  • @Sleepmalice
    @Sleepmalice 8 หลายเดือนก่อน +3

    #repeat
    @client.command(name = "repeat")
    async def repeat(ctx):
    global repeat_songs
    global current_song
    repeat_songs = abs(repeat_songs-1)
    if repeat_songs == 1:
    await queue(ctx,current_song)
    await ctx.send("repeated now")
    else:
    await ctx.send("don't repeated now")
    idk how to avoid in python keyword "global" for global vars in this context, but it works.var current_song is the current played song.In the play_next popping url adding to queue again and so on
    Also repeat_songs must be boolean type this my mistake/

    • @kay1dev
      @kay1dev หลายเดือนก่อน

      could you tell me in detail how you did this command?

  • @fletline7326
    @fletline7326 8 หลายเดือนก่อน +2

    Hi, there's a problem. I did everything as shown in the video, but at startup it gives the following error
    Traceback (most recent call last):
    File "c:\ds_bot\main.py", line 4, in
    bot.run_bot()
    File "c:\ds_bot\bot.py", line 107, in run_bot
    client.run(TOKEN)
    File "C:\Users\OLEG\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 860, in run
    asyncio.run(runner())
    File "C:\Users\OLEG\AppData\Local\Programs\Python\Python39\lib\asyncio
    unners.py", line 44, in run
    return loop.run_until_complete(main)
    File "C:\Users\OLEG\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
    File "C:\Users\OLEG\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 849, in runner
    await self.start(token, reconnect=reconnect)
    File "C:\Users\OLEG\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 777, in start
    await self.login(token)
    File "C:\Users\OLEG\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 609, in login
    raise TypeError(f'expected token to be a str, received {token.__class__.__name__} instead')
    TypeError: expected token to be a str, received NoneType instead
    Could you help me figure this out?

    • @ethancox2025
      @ethancox2025  8 หลายเดือนก่อน

      Looks like the token was never set. Did you set it in the .env file and specifically reference it as your TOKEN var with load_env?

    • @fletline7326
      @fletline7326 8 หลายเดือนก่อน +1

      @@ethancox2025 well, I just installed all the libraries, put my bot's token in .env and ran the code. Do I need to change something else?

    • @fletline7326
      @fletline7326 8 หลายเดือนก่อน +1

      @@ethancox2025 Hooray, I figured it out. I had problems with VS and support for .env files. I tried to run it on PyCharm and everything worked. Many thanks to you for the guide))))

    • @ethancox2025
      @ethancox2025  8 หลายเดือนก่อน

      So glad you figured it out! VS Code can be finicky with .env lol

  • @medin.fzc07
    @medin.fzc07 หลายเดือนก่อน

    Hallo, my name is Karinas. i get all time error (ffmpeg not found) can you pliz help meni. Tenks!

  • @dehavo
    @dehavo 7 หลายเดือนก่อน +1

    Can someone explain to me why when I add a track to the queue, the playing music starts to freeze?

    • @ethancox2025
      @ethancox2025  7 หลายเดือนก่อน

      This could be low network connectivity

    • @dehavo
      @dehavo 7 หลายเดือนก่อน

      @@ethancox2025 This happens exactly at the moment a new track is added to the queue. I tried everything, but nothing changes...😥

    • @soficartagena6200
      @soficartagena6200 9 วันที่ผ่านมา

      @@dehavo Were you able to fix it?, I also have this problem, but it cuts out after a minute when the current song is playing.

  • @Sleepmalice
    @Sleepmalice 9 หลายเดือนก่อน +1

    Thank you! queue for this case is really not so obvious as i thinked.If we want to repeat our queue for playing maybe realise linkedlist?

    • @ethancox2025
      @ethancox2025  9 หลายเดือนก่อน +1

      Glad you liked it!

  • @m0str33t
    @m0str33t 9 หลายเดือนก่อน +2

    Gonna try an make this tomorrow

    • @ethancox2025
      @ethancox2025  9 หลายเดือนก่อน +1

      Sweet! How'd it go?

    • @m0str33t
      @m0str33t 9 หลายเดือนก่อน

      @@ethancox2025 I have been tryna use replit to host the bot 24/7 in the cloud, I got it connect and log into the discord server but when i .play a yt video I keep getting ffmpeg not found and I’ve triple checked that I have ffmpeg.exe’s path correctly in env variables idrk other than it’s something with replit maybe

    • @m0str33t
      @m0str33t 9 หลายเดือนก่อน

      @@ethancox2025 couldn’t get it to work the bike connects to my discord server, but when I try to play a song, it says FFMPeg not found I’ve copied the correct path in env varibles like 4 times. I’m using replit to try and host in cloud 24/7 but can’t figure it out.

    • @ethancox2025
      @ethancox2025  9 หลายเดือนก่อน

      @@m0str33t does it work locally? You'll need to set the environment variables in Replit if you're hosting there

  • @grizzly2970
    @grizzly2970 3 หลายเดือนก่อน

    You can add a feature that will repeat a whole series of songs pls🙏

  • @allegrojacc
    @allegrojacc 8 หลายเดือนก่อน +1

    ty 🖤

  • @1993abaleaskg
    @1993abaleaskg 6 หลายเดือนก่อน

    It doesn't play for me. I get this error: ffmpeg was not found...
    [youtube] Extracting URL: th-cam.com/video/tzfVd_xq80k/w-d-xo.html
    [youtube] tzfVd_xq80k: Downloading webpage
    [youtube] tzfVd_xq80k: Downloading ios player API JSON
    [youtube] tzfVd_xq80k: Downloading m3u8 information
    ffmpeg was not found.
    What could be wrong?

  • @fun3999
    @fun3999 9 หลายเดือนก่อน +2

    Thank for vid. What about video how upload bot on hosting service? It will help a lot

    • @ethancox2025
      @ethancox2025  9 หลายเดือนก่อน +1

      Future video 👀

  • @Deluxaa06
    @Deluxaa06 28 วันที่ผ่านมา +1

    will you follow me all ready and put them on and listen to music with the bot

  • @DrANKIT
    @DrANKIT 12 วันที่ผ่านมา

    Still working?

  • @eastwesser
    @eastwesser 8 หลายเดือนก่อน +2

    git pull?

    • @ethancox2025
      @ethancox2025  8 หลายเดือนก่อน

      Check description

    • @eastwesser
      @eastwesser 8 หลายเดือนก่อน

      @@ethancox2025 thanks :D

  • @kylechiu3083
    @kylechiu3083 3 หลายเดือนก่อน

    File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/discord/player.py", line 29, in
    import audioop
    ModuleNotFoundError: No module named 'audioop'
    audioop is now depreciated, so what should I do to fix this instead?

    • @godlyflikqz2725
      @godlyflikqz2725 2 หลายเดือนก่อน

      sorry if this is late but pip install audioop -its

  • @KennyAMT
    @KennyAMT 4 หลายเดือนก่อน +1

    amazing

  • @IN3ANEEDITZ
    @IN3ANEEDITZ 5 หลายเดือนก่อน +1

    Hello 👋🏿 i need help

    • @ethancox2025
      @ethancox2025  5 หลายเดือนก่อน

      @@IN3ANEEDITZ hello!

  • @programmer2625
    @programmer2625 9 หลายเดือนก่อน +2

    Hy there Ethan thanks for this informing video i'm having trouble on this and i try adding it as a cog rather than a async function it still runs but it's giving me the error of ffmpeg not found even i did add it to my enviroments variables :
    Already connected to a voice channel.
    [youtube] Extracting URL: th-cam.com/video/n78m4NjhqGg/w-d-xo.html&ab_channel=Ethan%7CTheCodeSyndicate
    [youtube] tS8nzAQg_8k: Downloading webpage
    [youtube] tS8nzAQg_8k: Downloading ios player API JSON
    [youtube] tS8nzAQg_8k: Downloading android player API JSON
    [youtube] tS8nzAQg_8k: Downloading m3u8 information
    ffmpeg was not found.

    • @ethancox2025
      @ethancox2025  9 หลายเดือนก่อน

      You might need to restart your computer after making it an environment variable. I know that fixed this for me

    • @programmer2625
      @programmer2625 9 หลายเดือนก่อน

      @@ethancox2025 it didn't work even tho it gave me the same error

    • @Spectre726
      @Spectre726 5 หลายเดือนก่อน

      ​@@programmer2625Try putting the address where the ffmpeg.exe is located, for example, in the PATH, delete the previous one and put like this: C:\ffmpeg\bin remember that this will depend on where you have extracted the ffmpeg folder

  • @hestbehist
    @hestbehist 8 หลายเดือนก่อน

    ty Ethan

  • @MEGAF4IL
    @MEGAF4IL 3 หลายเดือนก่อน

    Hi, thank you for these tutorials!
    I'm having an issue with the queue, the bot plays the first song without a problem, but once anyone adds another song when one is already playing, I get this error:
    Already playing audio.
    discord.player ffmpeg process 7860 has not terminated. Waiting to terminate...
    discord.player ffmpeg process 7860 should have terminated with a return code of 1.

    • @qaguthur_tu3366
      @qaguthur_tu3366 2 หลายเดือนก่อน

      I have the same issue. Do u solve it?

    • @MEGAF4IL
      @MEGAF4IL 2 หลายเดือนก่อน

      @@qaguthur_tu3366 Not yet, I've been stumped for weeks now