当我尝试运行我的机器人时,我收到一个错误:attributeError: 'Client' object has no attribute 'command'
它源自的代码是 @client.command() async def beg(ctx):
答案 0 :(得分:3)
documentation 建议:
from discord.ext import commands
bot = commands.Bot(command_prefix='$')
@bot.command()
async def test(ctx):
pass
# or:
@commands.command()
async def test(ctx):
pass
bot.add_command(test)
如果您想得到考虑到您的具体问题的答案,请发布minimal reproducible example。