I have a method which calls itself after an audio is finished as a discord bot. However since the method is async, I can't use the await
keyword since I am using a lambda expression. How can I get around this?
async def play_next(self, voice_client, ctx):
if self.queue:
self.is_playing = True
array = (self.queue.pop(0))
audio, filename = discord.FFmpegPCMAudio(array[0]), array[1]
await ctx.send(f"Now playing: {filename}")
voice_client.play(audio, after=lambda e: await (self.play_next(voice_client, ctx)))
else:
self.is_playing = False
I tried using __anext__()
but didn't work out.