Create a Music Discord bot using Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024

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

  • @Computeshorts
    @Computeshorts  2 ปีที่แล้ว +32

    Let me know what other features you'd like to see or if you encounter any problems 😉

    • @chase_g0161
      @chase_g0161 2 ปีที่แล้ว +1

      do you think youll add it where you can use playlist links to add songs

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว +5

      I am not really sure how to do this yet. But I'll give it a go. 😉

    • @GBTraffyHQ
      @GBTraffyHQ 2 ปีที่แล้ว +1

      i was having issues in the skip command where it was playing the last song in queue and was clearing the rest of the queue. I switched calling the play_music function to play_next function and it seems like it works

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว

      @@GBTraffyHQ I'll have a look into it thanks.

    • @eclair1616
      @eclair1616 2 ปีที่แล้ว

      It works! But the audio is low quality (kind of earrape, not clean), i tried setting 'bestaudio/best' in YDL_OPTIONS but it remained the same, any suggestions?

  • @ye2341
    @ye2341 11 หลายเดือนก่อน +77

    if anyone is still working with this tutorial:
    at first: youtube_dl has been discontinued so your next best choice is yt_dlp which is a "newer" version of yt_dl.
    additionally: in the 'search_yt' function - in the return statement - remove the following: "['formats'][0]" - leaving only "return{'source': info['url'], ...}"
    this is caused by a change in the JSON data by yt_dlp.
    hope this helps.

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

      Any thoughts on quality? It's really bad despite 'bestaudio' setting

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

      @@Tribal260 sadly I am not really familiar with the topic. You can specify the format type (e.g. mp3) in the config. The default is .opus as far as i know. I am not sure if a change helps, audio encoding is a topic i am not familiar with at all.

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

      Your comment help me to run my bot but I cannot use command
      I got this message
      2023-10-22 03:48:33 ERROR discord.ext.commands.bot Ignoring exception in command None
      discord.ext.commands.errors.CommandNotFound: Command "play" is not found
      2023-10-22 03:51:36 ERROR discord.ext.commands.bot Ignoring exception in command None
      discord.ext.commands.errors.CommandNotFound: Command "p" is not found
      how to solve this?

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

      hello , was looking for your comment , I recently started this project but from a different prospective , my bot is having issues playing as my FFmpeg and FFprobe location cant be traced my code , even though they are added in path and downloaded properly , and providing a path and then running the code still doesnt make my bot play music , anything would be helpful.

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

      @@devbisht8200 are you importing ffmpeg correctly in your code?

  • @JustinS06
    @JustinS06 2 ปีที่แล้ว +14

    Amazing.
    Your channel is really underrated, though I would understand that it might be hard for beginners to understand most of the code as you don't really explain it. But making a discord bot is also not a very beginner friendly thing so there's that.

    • @Harsh-gh7rx
      @Harsh-gh7rx 10 หลายเดือนก่อน +2

      My first python project was discord bot lmao

  • @azharindrawan273
    @azharindrawan273 ปีที่แล้ว +12

    the cogs have a new update.. can u make tutorial video for setup the cogs ?

    • @kot0cha257
      @kot0cha257 ปีที่แล้ว

      did you solve the problem?

  • @pandinijoao1304
    @pandinijoao1304 ปีที่แล้ว +7

    Thank you my friend, you saved me a lot, save from Brazil!!

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

      save from Brazil !

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

      @@czr9183 save from Brazil!

  • @Computeshorts
    @Computeshorts  2 ปีที่แล้ว +4

    Are there any other bots that you'd like me to make?

    • @genoses5174
      @genoses5174 2 ปีที่แล้ว +2

      Giving role bot

    • @genoses5174
      @genoses5174 2 ปีที่แล้ว +1

      Like MEE6

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว +1

      @@genoses5174 will do 😉

    • @genoses5174
      @genoses5174 2 ปีที่แล้ว

      @@Computeshorts thanks sm

    • @genoses5174
      @genoses5174 2 ปีที่แล้ว +2

      Can u make a brief explanation about it also

  • @erfanakhavan1373
    @erfanakhavan1373 2 ปีที่แล้ว +2

    I really enjoy your channel and you are a good teacher. I might have missed sotNice tutorialng and I don't get friends with the setuper. I worked

  • @dovydasdovydas4638
    @dovydasdovydas4638 ปีที่แล้ว +3

    None of the commands are getting picked up :( Can someone help?

    • @CSG_STUDIOUS
      @CSG_STUDIOUS ปีที่แล้ว

      need to give one extra tab of space for everything starting from @commands.comand

  • @ESIMapping
    @ESIMapping 2 ปีที่แล้ว +4

    I copied everything word to word but for some reason my bot just doesnt play audio. Can anyone help me with this please.

    • @ESIMapping
      @ESIMapping 2 ปีที่แล้ว

      @RyZe OG AY YO MY MAN THANK U SM
      LMAOOOOO THANKS

  • @JustinS06
    @JustinS06 2 ปีที่แล้ว +2

    Oh and FIY, pulling music from TH-cam is actually illegal, but I wouldn't worry about it if it's just a personal bot or if it's in a small server.

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว +1

      Yeah I should've mentioned that. Thanks I'll add it to the description.

    • @Ozzy4201
      @Ozzy4201 2 ปีที่แล้ว +2

      wrong, its not illegal, its against youtubes TOS, which isnt the same thing

  • @zh3ka_217
    @zh3ka_217 ปีที่แล้ว +2

    Hi guys. I have a problem. I have made everythink identical to the video my bot even starts, but the problem is that he doesn`t response me when i am trying to use any of command, idk why

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

    the bot is entering the channel however there is no sound playing what to do ? in the terminal there r no errors and it's downloading the info I copied your source code too

  • @spikeydavid
    @spikeydavid 6 หลายเดือนก่อน +1

    Hello, I got everything to work except no audio will play when the bot is connected in VC. It successfully finds the video's URL and they are skippable, can be queued, and all songs queued show up in the list. I used some comments here to work around the changes to youtube_dl and also implemented the new Cog update, as well as referencing your github. I think it may be an issue with ffmpeg but I cant seem to sort it out. Any help would be appreciated.

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

      I resolved the issue, It was an issue with how I was using "self.vc.play(discord.FFmpegPCMAudio.....". I wasn't using the right format since ffMped must've gotten a formatting update since this video was made.

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

      Hey, I'm having the same issue as you here but I'm having trouble finding the updated format for FFmpeg to test and see if that fixes it. Any chance you could let me know what you changed that fixed the issue for you? @@spikeydavid

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

    I have a problem with the song is stopped while 1 minute (srry i dont speak english)

  • @user-oe4kr2jo8s
    @user-oe4kr2jo8s 2 ปีที่แล้ว +8

    Cannot import name 'help_cog' from 'help_cog' error. Plz help

    • @strysix3890
      @strysix3890 ปีที่แล้ว

      same did you find a solution?

    • @AussieBazzo
      @AussieBazzo ปีที่แล้ว

      You must have a file with an incorrect name or in the incorrect location

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

      The same you must in help cog replace help cog(commands.cog) with (commands.Cog)

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

    Traceback (most recent call last):
    File "C:\Users\jassi\OneDrive\Desktop\Games - Python\MUSIC-BOT\music_bot\main.py", line 7, in
    from music_cog import music_cog
    File "C:\Users\jassi\OneDrive\Desktop\Games - Python\MUSIC-BOT\music_bot\music_cog.py", line 4, in
    from youtubesearchpython import VideosSearch
    ModuleNotFoundError: No module named 'youtubesearchpython'

  • @EasyKey6612
    @EasyKey6612 2 ปีที่แล้ว +3

    I did everything correct, no error, the bot joins, the commands work , but i don't hear any sound when he says he is playing
    😔

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว +1

      Seems to be a common issue. Did you make sure that you have the path to ffmpeg in your environment variables?

    • @EasyKey6612
      @EasyKey6612 2 ปีที่แล้ว

      @@Computeshorts idk i tried to do your command set Path= %% but It didnt work It only took part of my disk space and songs werent playing

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว

      @@EasyKey6612 are you using node version 16 or above?

    • @EasyKey6612
      @EasyKey6612 2 ปีที่แล้ว

      @@Computeshorts wdym by node?, Sorry but im a beginneer on those things, node js?

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว

      @@EasyKey6612 some packages might not fully work unless you have the latest version of node. This is especially true with yourube dl and discordjs since they are constantly changing.

  • @jacefactory1790
    @jacefactory1790 ปีที่แล้ว +1

    can't open file '*insert directory here': [Errno 2] No such file or directory please help

  • @minsu-vn
    @minsu-vn 2 ปีที่แล้ว +1

    I can't use any command like /p (music link) but don't have anything happen in terminal and discord how can i fix this i have no error

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

    This code doesn't work anymore for anyone who is still working on this project.

  • @fantais5918
    @fantais5918 ปีที่แล้ว +1

    hello
    ImportError: cannot import name 'help' from 'help'
    please help me

  • @MarcioSantos-in7fq
    @MarcioSantos-in7fq 2 ปีที่แล้ว +3

    Bro, could you help me? Every time I write the command to play this error appears:
    Ignoring exception in command None:
    discord.ext.commands.errors.CommandNotFound: Command "play" is not found. The only command that works is help, I've tried to change some things but it didn't help

    • @flobberant
      @flobberant ปีที่แล้ว

      @@psyphwastaken is "play", "p" is an alias

    • @Panda_-4100
      @Panda_-4100 ปีที่แล้ว

      Hey did you manage to solve this issue ?

    • @emresimsek2872
      @emresimsek2872 ปีที่แล้ว

      @@Panda_-4100 hey,did u solve the issue?

    • @woeuntous
      @woeuntous ปีที่แล้ว

      @commands.command(name="play", help="Play the selected song from yt", aliases=["p"])
      it should be like this.
      when you declare name as "play" (name="play") it will become an alias. so you can not use in aliases again.

    • @CSG_STUDIOUS
      @CSG_STUDIOUS ปีที่แล้ว +1

      it was happening due to tab space error , all @commands must come under the class music_cog

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

    How do I upload the bot to a hosting with FFmpeg included?

  • @zkasxplr
    @zkasxplr ปีที่แล้ว +10

    Traceback (most recent call last):
    File "C:\Users\Dylan\Desktop\YouBot\YouBot\main.py", line 7, in
    from music_cog import music_cog
    File "C:\Users\Dylan\Desktop\YouBot\YouBot\music_cog.py", line 95
    self.is_playing = False
    TabError: inconsistent use of tabs and spaces in indentation

    • @yellowpant
      @yellowpant ปีที่แล้ว +1

      This error message is indicating that there is an issue with the indentation of your code. In Python, indentation is used to denote the level of code blocks, such as loops and conditional statements. The error message specifically says that there is inconsistent use of tabs and spaces, which means that you may have mixed tabs and spaces in your code. To fix this error, you should ensure that you are using either tabs or spaces consistently for indentation throughout your code. It's generally recommended to use four spaces for indentation in Python. In this case, the error is occurring in line 95 of the file "music_cog.py". You should check the indentation of this line and make sure that it is consistent with the rest of your code. You may need to convert any tabs to spaces or vice versa to ensure consistency. Once you have fixed the indentation issue, you should be able to run your code without this error.

    • @fuckbitchesgehmoney
      @fuckbitchesgehmoney ปีที่แล้ว +1

      Yo theres this silly little thing called reading, do it.

  • @_Milek_
    @_Milek_ ปีที่แล้ว +2

    Hi, I downloaded everything
    I changed the token and added intents but...
    /p and /play doesn't work
    ERROR:
    discord.ext.commands.errors.CommandNotFound: Command "p" is not found

    • @Panda_-4100
      @Panda_-4100 ปีที่แล้ว

      Hey did you manage to solve this issue ?

    • @_Milek_
      @_Milek_ ปีที่แล้ว

      @@Panda_-4100 nope

  • @ziynon7679
    @ziynon7679 ปีที่แล้ว +1

    ImportError: cannot import name 'help' from 'help' (C:\Users\USER1\Desktop\Discord Bot\help.py)
    How can I fix this?

  • @someaddictedidiot2186
    @someaddictedidiot2186 ปีที่แล้ว +4

    The bot does not even react to any command. What did i do wrong? (The bot is online and i don't get any errors)

    • @brianhsu6594
      @brianhsu6594 ปีที่แล้ว +1

      same issue here
      please help

    • @iamtea9719
      @iamtea9719 ปีที่แล้ว

      @@brianhsu6594 you decided this problem? idk what to do

  • @WiseNoodles0
    @WiseNoodles0 2 ปีที่แล้ว +2

    I LOVE U SO MUCH, IT ALL WORKED!!!

  • @docplayslive1108
    @docplayslive1108 ปีที่แล้ว +1

    bot = commands.Bot(command_prefix='/') is whats screwing me up now

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

    This tutorial wont work with cogs anymore, they got an update
    cogs need to be awaited and other stuff, just try doing it in a single file without cogs

  • @CanalRodriGames
    @CanalRodriGames ปีที่แล้ว

    how to create a bot with order of arrival queue command on discord with the intention of playing with my followers and ordering them by queue?

  • @Ticktok_of_Oz
    @Ticktok_of_Oz ปีที่แล้ว +1

    cool, so It would seem that this is way out of date now since everything has switched over to using intents.

  • @KennyKen-eq1ql
    @KennyKen-eq1ql 3 หลายเดือนก่อน

    its working but the bot don't join the voice what's worng

  • @slix5953
    @slix5953 2 ปีที่แล้ว +1

    I'm not sure why but everything works other than it not playing the actual sound

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

    Hello!
    For me it randomly skips the current song around 1 minute and i can't finish it.
    Can someone help me with this problem?

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

      same

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

      @@spikeydavid I found the solution if you want to know

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

      @@matemoricz2627 please post it, i have the same issue

  • @justskiez9584
    @justskiez9584 2 ปีที่แล้ว +12

    you need to add two lines in the resume command, in the "pause" function you set is_playing to False and is_paused to True. the resume function should look like that:
    if self.is_paused:
    self.vc.resume()
    self.is_playing = True
    self.is_paused = False

    • @g1akahnh
      @g1akahnh 2 ปีที่แล้ว

      thanks for your comment 👏👏

  • @salaheldinkhaledaminelshaf2803
    @salaheldinkhaledaminelshaf2803 ปีที่แล้ว

    SyntaxWarning: str indices must be integers or slices, not str; perhaps you missed a comma?
    return {'source': info['formats'[0]['url']] ,'title':info['title']}

    • @MonstermanX
      @MonstermanX ปีที่แล้ว

      do you know the fix?

  • @YasinII
    @YasinII ปีที่แล้ว +2

    Hey im having this error when trying to run the code. (I copied exactly your code and entered my token)
    Traceback (most recent call last):
    File "main.py", line 7, in
    from music_cog import music_cog
    File "/home/runner/BeneficialDiligentComputergame/music_cog.py", line 100
    self.is_playing = True
    ^
    TabError: inconsistent use of tabs and spaces in indentation

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

      You just had bad indents

  • @agarz4133
    @agarz4133 ปีที่แล้ว +1

    RuntimeWarning: coroutine 'music.play_next' was never awaited
    self.after(error)
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    Im getting this error and have no idea how to fix it, ive asked around the python community and still cannot find an answer... any ideas?

    • @meme4memes
      @meme4memes ปีที่แล้ว

      same stilll awtiing on answer here :(

    • @dzultra_real
      @dzultra_real ปีที่แล้ว

      same porblem

  • @rodrigocaldeira4379
    @rodrigocaldeira4379 ปีที่แล้ว

    Hii, i used your code and everything works fine, but when i type the function /play the bot doesnt play the right video, it just plays a random video, and idk why. Anyone has this error?

  • @SadBoy-zk5wu
    @SadBoy-zk5wu ปีที่แล้ว +1

    ModuleNotFoundError: No module named 'youtube_dl', helppp

    • @galacticdivinity
      @galacticdivinity ปีที่แล้ว +1

      That command of TH-cam's A.P.I. is no longer in service, due to copyright Terms-of-Service by TH-cam.

  • @zzcc7534
    @zzcc7534 2 ปีที่แล้ว +2

    Hi I am now trying to use your code, it is working (it shows those help commands and it replies song added to the queue when i say play something, but somehow the bot does not join the channel so no song is played. I really don't know why. I've been struggled with this for days...

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว

      Do you gey any errors in the console?

    • @bustin1946
      @bustin1946 2 ปีที่แล้ว

      i dont get any feedback in the console, and my bot isn't joining the channel either
      edit: if you also have the on_message command in your bot it will interfere, but that doesn't seem to be the issue you're facing

  • @boraned
    @boraned ปีที่แล้ว

    how can i define the music being over. i wanna do something like; if the music is over, leave the voice channel.

  • @duyquang3913
    @duyquang3913 2 ปีที่แล้ว

    clips. I use a drum loop and afterwards I want to record a appguitar. What happens.. the drumloop starts to record again along the

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

    what if someone attempt to run 'play' while someone else is using it?

  • @yab1103
    @yab1103 ปีที่แล้ว +1

    Im having this problem
    RuntimeWarning: coroutine 'BotBase.add_cog' was never awaited
    bot.add_cog(music_cog(bot))
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    both on the bot.add_cog(music_cog(bot)) line and the bot.add_cog(help_cog(bot)), does anyone know how to fix this?

    • @dzultra_real
      @dzultra_real ปีที่แล้ว

      same problem

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

      same problem here did you solved?

  • @bustin1946
    @bustin1946 2 ปีที่แล้ว +1

    how would i make a now_playing command and a loop command?

  • @Scoltren
    @Scoltren ปีที่แล้ว +1

    I followed your code and it shows me this error, help?
    discord.ext.commands.errors.CommandNotFound: Command "play" is not found

    • @Scoltren
      @Scoltren ปีที่แล้ว

      @Jorge Coutinho nope :(

    • @Scoltren
      @Scoltren ปีที่แล้ว

      Discord keeps changing their syntaxes and these tutorials are not keeping up to them

  • @NicolasHoffmann-yy5lu
    @NicolasHoffmann-yy5lu ปีที่แล้ว

    A little bit Late, but I got the Error
    "Unrecognized option 'reconnect'.
    Error splitting the argument list: Option not found", I tried the set path you said in the end, but it deosn't seem to work, I get the error message "
    The naming "C:\ffmpeg\bin" was not used as the name of a cmdlet, function, script file, or executable program
    recognized." (The Error Message is translated) when using it. I used the same place of the ffmpeg he did.

  • @mrjo.1355
    @mrjo.1355 2 ปีที่แล้ว +1

    I have been trying to figure out this error for HOURS. I'm stumped, so reaching out. When I try and run 'python main.py' I get an error "'NoneType' object has no attribute 'strip'" directed towards the line in the main file 'bot.run(os.getenv("TOKEN"))'
    I have used the SET TOKEN=x and nothing seems to happen when I press enter, either.

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว

      Try to run "echo %TOKEN%" to make sure that the environment variables has been set correctly. Also make sure you are not running this in powershell.

    • @Ozzy4201
      @Ozzy4201 2 ปีที่แล้ว

      just do bot.run("token here, just the raw token in quotes")

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

    discord.ext.commands.errors.commandnotfound: Command "play" is not found
    My problem please give me any solution for this
    This problem is from yesterday

  • @BornHype
    @BornHype 2 ปีที่แล้ว +1

    running into this issue any help?
    PS C:\Users\GTA\Python tests> python main.py
    Traceback (most recent call last):
    File "C:\Users\GTA\Python tests\main.py", line 6, in
    from music_cog import music_cog
    File "C:\Users\GTA\Python tests\music_cog.py", line 7, in
    class music_cog(commands.cog):
    TypeError: module() takes at most 2 arguments (3 given)

    • @onetapmanbbr
      @onetapmanbbr 2 ปีที่แล้ว +1

      Why you making the discord bot on the GTA folder 💀

    • @BornHype
      @BornHype 2 ปีที่แล้ว +1

      @@onetapmanbbr that’s my initials lol it’s not under gta the game

    • @vog25
      @vog25 2 ปีที่แล้ว

      @@onetapmanbbr XDDDDD

    • @DONOPOTTER
      @DONOPOTTER ปีที่แล้ว

      i have the same issue, do you find a solution ?

  • @slix5953
    @slix5953 2 ปีที่แล้ว +1

    Basically I originally did this in Replit and it came with an ffmpeg error and i tried the PATH thing but that didn't work so I moved to Pycharm and I keep getting:
    raise CommandInvokeError(exc) from exc
    discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice
    So i'm not sure what to do at this point, can anyone help?
    *EDIT*
    i fixed the issue but the sound quality is kinda low HOWEVER i appreciate you making this video

    • @robbie8545
      @robbie8545 2 ปีที่แล้ว

      May I ask, how you were able to fix this issue? I am currently going through the same issue

    • @slix5953
      @slix5953 2 ปีที่แล้ว

      @@robbie8545 Basically, if you're using pycharm, what i did was type 'import PyNaCl' and when there was a red line under it i clicked on it and it came up with some fix options and i clicked 'import PyNaCl'

  • @NoConn
    @NoConn ปีที่แล้ว +1

    for ~24 in music_cog.py, the one that says: return {'source': info['formats'[0]['url']], 'title': info['title']}, im getting an error that says:
    SyntaxWarning: str indices must be integers or slices, not str; perhaps you missed a comma?
    return {'source': info['formats'[0]['url']], 'title': info['title']}
    Does anybody know what the problem is?

    • @CSG_STUDIOUS
      @CSG_STUDIOUS ปีที่แล้ว

      return {'source': info['formats'[0]['url']], 'title': info['title']}
      change from this to this
      return {'source': info['formats'][0]['url'], 'title': info['title']}

  • @LofiNeo-yt
    @LofiNeo-yt ปีที่แล้ว

    how did you make en entry when you type set path=%% i cant reproduce this for fixing ffmpeg problem.

  • @anshumanupadhyay7831
    @anshumanupadhyay7831 ปีที่แล้ว

    hey can some tell me how to set the enviroment veriable for the TOKEN in linux

  • @GPTkhan
    @GPTkhan 2 ปีที่แล้ว

    is there a setting Called Program*, its default is set to *Agressive TEwNice tutorialch is making that sNice tutorialtty static soft, change that one, once to

  • @shivangi8417
    @shivangi8417 2 ปีที่แล้ว

    Can you help me. Everything works but when the its the turn to play the song it shows an error ffmpeg not found

  • @EliteNerds
    @EliteNerds ปีที่แล้ว

    I'm having a problem with the @commands.command(name = "play", aliases=["p", "playing"] help= "plays the selected song from youtube") bracket number one is highlighted for an issue to do with command decoding

    • @ponystr
      @ponystr ปีที่แล้ว +1

      it looks like you missed a comma between the last bracket and 'help' attribute

  • @lohaavenger245
    @lohaavenger245 2 ปีที่แล้ว +1

    i have a problem , i got to your github thingy and copied the full code, and pasted it , and everything is working fine, bot is joining and the commands are working perfectly expect the music is not being played... means i cant hear the sound

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว

      Did you make sure that the path to ffmpeg is in your path variables?

    • @myxology5941
      @myxology5941 2 ปีที่แล้ว

      @@Computeshorts Also having the same problem and i'm sure ffmpeg is in my variables

    • @dustin0001
      @dustin0001 ปีที่แล้ว

      ​@@Computeshorts You mentioned doing this in the video but did not explain where to find the path to ffmpeg or how that would work. Where can we find this ffmpeg path you are talking about? Running:
      set path=%path%;c:/ffmpeg/bin
      produces an error:
      "c:/ffmpeg/bin : The term 'c:/ffmpeg/bin' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
      and try again."

  • @panajot6534
    @panajot6534 ปีที่แล้ว +1

    Hello there, is there any premade version which works with replit?

  • @sury1088
    @sury1088 ปีที่แล้ว +2

    Somehow my token is detected as a NoneType instead of a string. I get this error message:
    File "C:\Users\user\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
    Does someone know how to fix this?

    • @dzultra_real
      @dzultra_real ปีที่แล้ว

      i got the same problem

    • @azraeltom
      @azraeltom ปีที่แล้ว

      it is what it said, pass the argument as the token value but in str

  • @_al3x_845
    @_al3x_845 2 ปีที่แล้ว +1

    I did everything the right way and I also tried it with your Code from Github but it´s constantly reportig an error with my token saying that a NoneType Obejct can´t be stripped, could you help me? I already tried to "SET TOKEN=token" and to SET TOKEN = str(token) but it does not work and keeps blowing up

    • @KazeMDProd
      @KazeMDProd 2 ปีที่แล้ว +1

      Honestly just correct it to this, where it says Token here replace that with your bot token.
      bot.run("TOKEN HERE")

    • @juwx
      @juwx ปีที่แล้ว

      @@KazeMDProd you saved me, tysm

    • @KazeMDProd
      @KazeMDProd ปีที่แล้ว

      @@juwx No Problem!

  • @Thibault2605
    @Thibault2605 2 ปีที่แล้ว

    I still have :
    discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: y58JkIC1sJE: TH-cam said: Unable to extract video data
    I already tried to upgrade/reinstall youtube-dl but didn't work...
    Someone have a solution?

  • @GlowwyAMV
    @GlowwyAMV ปีที่แล้ว

    when i download python it just shows some completely different coding thing, is this normal?

  • @jklas4568
    @jklas4568 2 ปีที่แล้ว +1

    where is the song downloaded to when i use the play command?

  • @bread6947
    @bread6947 ปีที่แล้ว

    do you have a discord server cause i would love to learn more on how to code with other softwere engineers and find all of my mistakes

  • @slavfuciouss
    @slavfuciouss ปีที่แล้ว +1

    PS E:\dis bot> python main.py
    Traceback (most recent call last):
    File "E:\dis bot\main.py", line 6, in
    from music_cog import music_cog
    File "E:\dis bot\music_cog.py", line 5, in
    from youtube_dl import TH-camDL
    ModuleNotFoundError: No module named 'youtube_dl'
    i have installed TH-camDL, please can you explain why is this happening ?

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

      @ye2341
      13 days ago
      if anyone is still working with this tutorial:
      at first: youtube_dl has been discontinued so your next best choice is yt_dlp which is a "newer" version of yt_dl.
      additionally: in the 'search_yt' function - in the return statement - remove the following: "['formats'][0]" - leaving only "return{'source': info['url'], ...}"
      this is caused by a change in the JSON data by yt_dlp.
      hope this helps.

  • @bezerrac
    @bezerrac 2 ปีที่แล้ว +1

    awesome tutorial video bro, but how can i get just the name of song without search for url

    • @JustinS06
      @JustinS06 2 ปีที่แล้ว

      It does work. You don't necessarily need to give it a url.

  • @bedeuhdb27y9
    @bedeuhdb27y9 ปีที่แล้ว +1

    client.add_cog(music_cog(bot=client))
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    please help

    • @dzultra_real
      @dzultra_real ปีที่แล้ว

      same problem

    • @FireDrag_
      @FireDrag_ ปีที่แล้ว

      After some messing around with the code this seems to work, you have to run the add cog statement with asynico and as a function.
      import discord
      import asyncio
      from discord.ext import commands
      from config.settings import DISCORD_TOKEN
      from utils.music_cog import setup as music #for cleanness my cogs are under a file called utils which is why there is a utils. at the start if they #are in the same folder this is unnecessary and u can just use the name
      from utils.help_cog import setup as help
      intents = discord.Intents.default()
      intents.message_content = True
      intents.members = True
      bot = commands.Bot(command_prefix='£', intents=intents) # used £ as I don't like / cos all the other / commands appear (make sure not to copy # this if ur trying to u / to test the bot
      bot.remove_command('help')
      asyncio.run(music(bot))
      asyncio.run(help(bot))
      bot.run(DISCORD_TOKEN) # This is just a different way of importing the token, the token string works here just fine
      In addition you need to add this to each cog file OUTSIDE the class above or below works
      async def setup(bot):
      await bot.add_cog(music_cog#(bot)) - this for the music_cog.py
      async def setup(bot):
      await bot.add_cog(help_cog(bot)) - this is for the help_cog.py
      However, I still run into an issue when running the play command where it doesn't play the song

  • @mansardotv9558
    @mansardotv9558 2 ปีที่แล้ว +1

    Hello Computeshorts I have one problem after starting a bot can you help me please? Traceback (most recent call last):
    File "c:/Users/Пользователь/Desktop/питон/Juzou.py", line 4, in
    from music_cog import music_cog
    File "c:\Users\Пользователь\Desktop\питон\music_cog.py", line 100
    self.is_playing = True
    ^
    TabError: inconsistent use of tabs and spaces in indentation

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว +1

      This will be down to your indents. Make sure that you are using spaces all throughout the file and no tabs. If you're using vs code you can co figure your tabs to be spaces.

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

    bro can you make a vid to teach use docker with your image

  • @rodrigo-maidana
    @rodrigo-maidana 10 หลายเดือนก่อน

    Anyone got this error starting the bot? "d:\Proyectos\discord-music-bot\main.py:24: RuntimeWarning: coroutine 'BotBase.add_cog' was never awaited bot.add_cog(music_cog(bot))"
    Also when i do /play i get this error "discord.ext.commands.errors.CommandNotFound: Command "play" is not found"

  • @vog25
    @vog25 2 ปีที่แล้ว +1

    @Computeshorts, could u help me pls. i have the problems like: discord.ext.commands.errors.CommandRegistrationError: The alias play is already an existing command or alias.

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

      U already ran a program and that program registered the command now it's trying to over lap it so it's causing the error u can understand unregsiter the command first and then the program u can use

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

      @@neelamsingla5062 It's been over a year, but thanks for the answer anyway)

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

    it works but not if u put a playlist

  • @sapphiremelon8445
    @sapphiremelon8445 ปีที่แล้ว

    I receive "TypeError: expected token to be a str, received NoneType instead" after running the code. What should I do next?

    • @MZC_GAMING
      @MZC_GAMING ปีที่แล้ว

      I wanna know the solution for this too

  • @jackthewatcher976
    @jackthewatcher976 2 ปีที่แล้ว +1

    Well, ngl it kinda looks like a template for a discord music bot😂😂

  • @SadaraxTutorials
    @SadaraxTutorials ปีที่แล้ว

    Anyway to make this bot use slash commands to play pause and queue?

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

    "D:\xxxx\Documents\MutanMusic_1\music_bot\main.py", line 3, in
    from music import music_cog PLEASE HELP

  • @12gaugeofficial
    @12gaugeofficial ปีที่แล้ว

    Hello..can u make me a music streaming BOT? For Spotify, Boomplay and TH-cam Music. ? ..reply ASAP

  • @sambandhasilwal2433
    @sambandhasilwal2433 ปีที่แล้ว

    discord.ext.commands.errors.CommandNotFound: Command "help" is not found
    please help m8

  • @JunQii89
    @JunQii89 2 ปีที่แล้ว +4

    Traceback (most recent call last):
    File "C:\Temp\music_bot-main\main.py", line 9, in
    bot = commands.Bot(command_prefix='/')
    TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'
    how can i resolve this issue

    • @estebanjones3781
      @estebanjones3781 2 ปีที่แล้ว +1

      Try to add this:
      intents = discord.Intents.default()
      intents.message_content = True
      bot = commands.Bot(command_prefix='/', intents=intents, help_command=None)

    • @marcin7944
      @marcin7944 2 ปีที่แล้ว +2

      Now discord requires intents, so your line should look like this.
      bot = commands.Bot(command_prefix='/', intents=discord.Intents.default())

    • @walrus9904
      @walrus9904 2 ปีที่แล้ว

      @@estebanjones2741 where do i add the bot.start code?

    • @crakrooif2606
      @crakrooif2606 ปีที่แล้ว

      solve with this code: bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())

    • @estebanjones2741
      @estebanjones2741 ปีที่แล้ว

      I'm just seeing your comments. Everything is okay ?

  • @Fraserss
    @Fraserss 2 ปีที่แล้ว +1

    Getting a import error
    ImportError: cannot import name 'music_cog' from 'music_cog'
    Curious if you would know a fix? Thanks

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว +1

      This is usually caused when you aren't running python in the same directory as your files. Can be solved by either having all the files in the same directory and running python from there or by appending the folder with the music_cog to the path. You can read in more detail here stackoverflow.com/a/24722419/7175167

    • @vexic2642
      @vexic2642 2 ปีที่แล้ว

      yo fraser did u fix the issue?

    • @Fraserss
      @Fraserss 2 ปีที่แล้ว

      @@vexic2642 not that I remember. I can give the video another shot if I got a minute and let you know.

  • @TuanNguyen-cx2pf
    @TuanNguyen-cx2pf 10 หลายเดือนก่อน

    how to make it play music from spotify too!

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

    it give me the Error
    ImportError: cannot import name 'help_cog' from 'help_cog'
    how can i solve it?

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

      In main.py Line 6

  • @wozzybozo4082
    @wozzybozo4082 2 ปีที่แล้ว

    when i try to run mine it says "S D:\Discord bots\Meerkat music bot> & C:/Users/Jonathan/AppData/Local/Programs/Python/Python310/python.exe "d:/Discord bots/Meerkat music bot/musicbot/main.py"
    Traceback (most recent call last):
    File "d:\Discord bots\Meerkat music bot\musicbot\main.py", line 9, in
    bot = commands.Bot(command_prefix="/")
    TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'

  • @bigkidfatcakes
    @bigkidfatcakes ปีที่แล้ว

    So I followed this exact, but I keep getting "command 'play' not is not found". Not sure what I did wrong but the code at this point is identical minus a dotenv for the token.

    • @zaidtahir2845
      @zaidtahir2845 ปีที่แล้ว +1

      did you figure this out?

    • @alexandergu7797
      @alexandergu7797 ปีที่แล้ว

      I'm encountering this exact issue as well.
      (I'm also using dotenv, but that shouldn't be causing this)

  • @mch170
    @mch170 ปีที่แล้ว

    It worked great for 2 months, now it can't play anything and the console shows: "Unable to extract uploader id". Any ideas on how to fix that?

    • @Dealve
      @Dealve ปีที่แล้ว

      TH-cam API update broke youtube_dl, which hasn't been updated in a while. You should be able to use the branch yt_dlp instead

    • @CSG_STUDIOUS
      @CSG_STUDIOUS ปีที่แล้ว

      @@Dealve could you please help me with that good sir / mam ?
      if you could point me to a resource such as a video that would be of great help.

  • @otap-o1946
    @otap-o1946 10 หลายเดือนก่อน

    line 8, in
    bot = commands.Bot(command_prefix="/")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    anyone know how to fix this?

  • @enchis1269
    @enchis1269 ปีที่แล้ว

    2023-02-03 17:30:29 ERROR discord.ext.commands.bot Ignoring exception in command None
    discord.ext.commands.errors.CommandNotFound: Command "help" is not found when i run it. what should i do?

    • @iamtea9719
      @iamtea9719 ปีที่แล้ว

      u decided this problem?

    • @enchis1269
      @enchis1269 ปีที่แล้ว

      @@iamtea9719 unfortunately, i forgot how i fix this ._. the file is in my old laptop

  • @mtx5425
    @mtx5425 2 ปีที่แล้ว

    hello... i have a little problems with cogs... i need to install something for using cogs?

    • @mtx5425
      @mtx5425 2 ปีที่แล้ว

      pycharm do not recognize cogs

  • @raymk
    @raymk ปีที่แล้ว

    Thanks mate, very helpful

  • @wannn7733
    @wannn7733 2 ปีที่แล้ว +1

    line 19, in
    bot.run(os.getenv("TOKEN")),
    when I run the command "python main.py" an error appears on line 19,can u help me sir?

    • @Levrinho
      @Levrinho 2 ปีที่แล้ว

      Try:
      TOKEN = 'your token'
      bot.run(TOKEN)

  • @torzin4006
    @torzin4006 ปีที่แล้ว

    its giving this error:
    discord.ext.commands.errors.CommandNotFound:

    • @Panda_-4100
      @Panda_-4100 ปีที่แล้ว

      Hey did you manage to solve this issue ?

  • @SpaceHero1000
    @SpaceHero1000 2 ปีที่แล้ว +1

    Hi @Computeshorts - I've followed this guide and successfully recreated the bot. However, I have one issue - the files are being saved and this is rapidly filling storage - how do I fix this?

    • @Computeshorts
      @Computeshorts  2 ปีที่แล้ว +1

      I suggest adding some code to delete the song you just played in the play_next function.

    • @SpaceHero1000
      @SpaceHero1000 2 ปีที่แล้ว

      @@Computeshorts thank you

    • @JustinS06
      @JustinS06 2 ปีที่แล้ว

      @kmanjt
      Hey, where do you find the files. And have you made some code to fix this?

    • @jhivern5975
      @jhivern5975 2 ปีที่แล้ว +1

      @@Computeshorts Have you made the code for this? I'm a beginner and I can't figure it out haha.

  • @vincentwijaya4749
    @vincentwijaya4749 2 ปีที่แล้ว

    Can you help me? When I want to run it with: python main.py
    File "c:\Users\ASUS\main.py", line 7, in
    from music_cog import music_cog
    ModuleNotFoundError: No module named 'music_cog'How can I find a solution thank you, im so beginner

    • @mansardotv9558
      @mansardotv9558 2 ปีที่แล้ว

      You just need to place files in one folder

  • @gridpaper2980
    @gridpaper2980 2 ปีที่แล้ว +1

    THANK YOU SO VERY MUCH

  • @docplayslive1108
    @docplayslive1108 ปีที่แล้ว

    whats the new youtube dl

  • @hisako04
    @hisako04 2 ปีที่แล้ว

    why the bot don't join in the vc

  • @luizfernandoschmittfilho8659
    @luizfernandoschmittfilho8659 ปีที่แล้ว +2

    my code dont recognizes the commands from the cog