i am writing an all purpose bot basicly i want to to type the command and then a song name example:?play song-name and it will search youtube and the first video that pops up it will download the audio of it
I got the bot to work with normal links but if i have to get the link to play the music it defeats the purpose
client = discord.Client()
@client.event
async def on_message(message):
    ydl_opts = {
            'format': 'beataudio/best',
            'postprocessors': [{
                'key': 'FFmpegExtractAudio',
                'preferredcodec': 'mp3',
                'preferredquality': '192'
            }]
        }
     with youtube_dl.YoutubeDL(ydl_opts) as ydl:
          print("Downloading audio now\n")
          url: str = message.content.replace('?play ', '')
          print(url)
          ydl.download([url])
i did not use youtube-dl before so I donot know how it works.
 
    