I use the yt_dlp module to get songs to play for my discord bot, the following is the command I use
@music.command(name="play", description="Plays the music you specified", aliases=["pl"])
async def play_music(ctx, *, query):
if not str(ctx.guild.id) in queue.keys(): queue[str(ctx.guild.id)] = []
with yt_dlp.YoutubeDL(yt) as ydl:
info = ydl.extract_info(query, download=False)
video_entry = info.get('entries', [info])[0]
url = video_entry['url']
queue[str(ctx.guild.id)].append(url)
if not ctx.voice_client:
voice_client = await ctx.author.voice.channel.connect()
else:
voice_client = ctx.voice_client
for i in queue[str(ctx.guild.id)]:
voice_client.play(discord.FFmpegPCMAudio(url), **{'options': '-vn', "before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5"})
queue[str(ctx.guild.id)].remove(i)
I searched for several solutions and i was given **{'options': '-vn', "before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5"}) as kwargs to pass but it gives me the error that "options" and "before options" are unexpected arguments