Answer the question
In order to leave comments, you need to log in
How to fix SyntaxError: 'await' outside function?
When running, I get SyntaxError: 'await' outside function . The code:
def check(res):
return ctx.author == res.user and res.channel == ctx.channel
res = await self.bot.wait_for("button_click", check=check, timeout=60)
await res.respond(type=InteractionType.ChannelMessageWithSource, embed=discord.Embed(description=(f"{res.component.label} pressed")))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question