【发布时间】:2022-01-04 22:09:25
【问题描述】:
当我使用此代码时,它通常对我有效,但它停止工作。首先使用其他异步定义,但现在 on_message 不起作用!
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 是我的机器人的名称。如果它有帮助,我正在使用 repl.it。虽然 on_ready() 有效,但我在 def on_message(message) 中得到了 d 的 pyflakes SyntaxError。
View error message
File "main.py", line 21
async def on_message(message):
^
SyntaxError: invalid syntax
有人可以帮忙吗?
【问题讨论】:
标签: python function discord discord.py