This code normally works for me when I use it, but it stopped working. First with other async definitions, but now on_message isn’t working!
JavaScript
x
10
10
1
async def on_ready():
2
print("WizBot is currently online! Go check your Discord server; the bot should be active."
3
4
@client.event
5
async def on_message(message):
6
if message.author == client.user:
7
return
8
if message.content.startswith('+test'):
9
await message.channel.send('WizBot is up and running!')
10
WizBot is the name of my bot.Also if it is helpful, I am using repl.it. on_ready() works though, but I get a pyflakes SyntaxError for the d
in the def on_message(message).
View error message
JavaScript
1
5
1
File "main.py", line 21
2
async def on_message(message):
3
^
4
SyntaxError: invalid syntax
5
Can someone help?
Advertisement
Answer
You miss a bracket in the line
JavaScript
1
2
1
print("WizBot is currently online! Go check your Discord server; the bot should be active."
2
It should be:
JavaScript
1
2
1
print("WizBot is currently online! Go check your Discord server; the bot should be active.")
2