From 4aabde261bf10c0cc4b5d3f42a373396dd6eeec4 Mon Sep 17 00:00:00 2001 From: Lukas Blacha Date: Wed, 8 Feb 2023 12:48:01 +0100 Subject: [PATCH] Added youtube_search method --- Music-Bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Music-Bot.py b/Music-Bot.py index 22ad30f..b21b0c3 100644 --- a/Music-Bot.py +++ b/Music-Bot.py @@ -218,10 +218,11 @@ else: @bot.slash_command() async def youtube(ctx, *, search: str): + url = await youtube_search(search=search) async with ctx.typing(): await ctx.respond("🤖 Your song is queued for download... please wait ", ephemeral=True) try: - player = await YTDLSource.from_url(youtube_search(search=search), loop=bot.loop) + player = await YTDLSource.from_url(url, loop=bot.loop) ctx.voice_client.play( player, after=lambda e: print(f"Player error: {e}") if e else None )