S
S
Sherrix2021-08-26 14:41:09
Python
Sherrix, 2021-08-26 14:41:09

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

1 answer(s)
0
0ralo, 2021-08-26
@0ralo

You need to place await in an async function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question