【发布时间】:2021-01-17 09:45:56
【问题描述】:
我正在制作一个不和谐的机器人,我是 python 新手,我已经查找但没有找到任何关于如何解决这个问题的答案,但我从这段代码中得到了错误
代码:
import discord
from discord.ext import commands
client = command.Bot(command_prefix="<")
@client.event
async def on_ready():
print("Bot is online")
@client.command()
synd def Test(ctx):
await ctx.send("Test successful")
client.run(Token)
有错误的行:
@client.event
async def on_ready():
print("Bot is online")
错误:
async def on_ready():
^
SyntaxError: invalid syntax
有谁知道如何解决这个问题?我正在使用 Python 版本:pip 19.2.3 (python 3.8)
【问题讨论】:
-
你100%确定你使用的是python3而不是python2吗?
标签: discord.py