Added youtube_search method
This commit is contained in:
@@ -218,10 +218,11 @@ else:
|
|||||||
|
|
||||||
@bot.slash_command()
|
@bot.slash_command()
|
||||||
async def youtube(ctx, *, search: str):
|
async def youtube(ctx, *, search: str):
|
||||||
|
url = await youtube_search(search=search)
|
||||||
async with ctx.typing():
|
async with ctx.typing():
|
||||||
await ctx.respond("🤖 Your song is queued for download... please wait ", ephemeral=True)
|
await ctx.respond("🤖 Your song is queued for download... please wait ", ephemeral=True)
|
||||||
try:
|
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(
|
ctx.voice_client.play(
|
||||||
player, after=lambda e: print(f"Player error: {e}") if e else None
|
player, after=lambda e: print(f"Player error: {e}") if e else None
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user