我从命令切换。不和谐。Bot可以获取斜杠命令以及带前缀的命令。它给出错误
File "/home/-/Desktop/Stuff/CODING/Discord-Bot-OrbiBot/cogs/economy.py", line 270, in setup
bot.add_cog(Economy(bot))
File "/home/-/.local/lib/python3.9/site-packages/discord/cog.py", line 546, in add_cog
cog = cog._inject(self)
File "/home/-/.local/lib/python3.9/site-packages/discord/cog.py", line 454, in _inject
raise e
File "/home/-/.local/lib/python3.9/site-packages/discord/cog.py", line 448, in _inject
bot.add_command(command)
AttributeError: 'Bot' object has no attribute 'add_command'
是否有不同的命令可供使用?(我使用的是py跳线2.0.0b4(
因为discord.Bot
不支持前缀命令,而这正是add_command()
试图制作的。
您想要做的是使用commands.Bot
,通过from discord.ext import commands
导入命令