I'm trying to make a discord bot with discord API for python, but I'm having a problem:
async def nextSong(self):
if not self.loop:
self.queue.pop(0)
self.name.pop(0)
if len(self.queue) >= 1:
await self.playSong(self.ctx, self.queue[0], self.name[0])
elif len(self.queue) == 0:
print("There are no more songs")
async def playSong(self, ctx, link, name):
self.ctx = ctx
# x = (await self.nextSong())
ctx.voice_client.play(discord.FFmpegPCMAudio(link, **self.ffmpeg_options),
after=lambda l:
await self.nextSong())
ctx.voice_client.source = discord.PCMVolumeTransformer(ctx.voice_client.source)
ctx.voice_client.source.volume = 0.50
em = discord.Embed(title="Queue", description=("You are listening to " + name))
await ctx.send(embed=em)
I'can't transform these two functions into synchronized function because I'm using "await ctx.send"
output:
await self.nextSong())
^
SyntaxError: 'await' outside async function