【发布时间】:2020-10-25 14:47:45
【问题描述】:
from discord.ext import commands
client = commands.Bot(command_prefix='{')
@client.command()
async def ping(ctx):
await ctx.send("Pong!")
我对 Python 非常陌生,目前正在学习如何使用 discord.py rewrite 编写一个不和谐机器人。我从一个名叫 Lucas 的 YouTuber 那里遵循了这段代码。这是他的确切代码。他似乎工作但由于某种原因,我的 PyCharm 仍然说客户端没有属性命令。有人可以教我怎么解决吗?
这是错误
Traceback (most recent call last):
File "C:/Users/danie/PycharmProjects/Discord Tutorial/bot.py", line 93, in <module>
@client.command()
AttributeError: 'Client' object has no attribute 'command'
【问题讨论】:
标签: python pycharm attributeerror discord.py-rewrite