1

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!

async def on_ready():
    print("WizBot is currently online! Go check your Discord server; the bot should be active."

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    if message.content.startswith('+test'):
        await message.channel.send('WizBot is up and running!')

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

File "main.py", line 21
    async def on_message(message):
          ^
SyntaxError: invalid syntax

Can someone help?

3 Answers 3

1

I think it is because closing bracket is missing in

print("WizBot is currently online! Go check your Discord server; the bot should be active."
0
0

You miss a bracket in the line

print("WizBot is currently online! Go check your Discord server; the bot should be active."

It should be:

print("WizBot is currently online! Go check your Discord server; the bot should be active.")
1
  • Yeah, thanks. I must have accidentally deleted the bracket on accident.
    – Python
    Nov 27, 2021 at 18:58
0

You missed a parenthesis to close the print

print("WizBot is currently online! Go check your Discord server; the bot should be active."

while it should be

print("WizBot is currently online! Go check your Discord server; the bot should be active.")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.