async def play(ctx, *, link):
try:
voice_client = await ctx.author.voice.channel.connect()
voice_clients[voice_client.guild.id] = voice_client
except Exception as e:
print(e)
if 1==1:
if youtube_base_url not in link:
query_string = urllib.parse.urlencode({
'search_query': link
})
content = urllib.request.urlopen(
youtube_results_url + query_string
)
search_results = re.findall(r'/watch?v=(.{11})', content.read().decode())
link = youtube_watch_url + search_results[0]
loop = asyncio.get_event_loop()
data = await loop.run_in_executor(None, lambda: ytdl.extract_info(link, download=False))
song = data['url']
player = discord.FFmpegOpusAudio(song, **ffmpeg_options)
voice_clients[ctx.guild.id].play(player, after=lambda e: asyncio.run_coroutine_threadsafe(play_next(ctx), bot.loop))
ffmpeg installed and added in PATH
ffmpeg lib for python added
I can’t find a solution. How to solve this problem?
New contributor
salice is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.