hi. i am trying to make a discord chat bot.
when i put in “await”
there is this error appearing : Syntax Error : ‘await’ outside function
awaitoutside of an
asyncfunction. The last two lines should be like this:
@client.event async def on_message(msg): if msg.author == client.user: return if msg.startswith('hello'): await ctx.send('yo, whats good.')
I also made some necessary changes. And you should put the token in a
.env file so that even if the repl is public you don't need to remove the token to show it to someone.