Added youtube_search method

This commit is contained in:
Lukas Blacha
2023-02-08 12:48:01 +01:00
parent 53f175379f
commit 4aabde261b

View File

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