Discord.py eval命令:缩进错误:应为缩进块

Discord.py eval命令:缩进错误:应为缩进块,discord.py,Discord.py,我想为我的discord.py bot使用一个简单的eval命令,我找到的所有代码都不适用于我,我找到的最接近的代码是: async def say(content): await client.say(content) @commands.command() async def say(self, content): await self.client.say(content)``` This just returns an error 你在标题中描述的错误是不言自明的——也许你忘了在某

我想为我的discord.py bot使用一个简单的eval命令,我找到的所有代码都不适用于我,我找到的最接近的代码是:

async def say(content):
await client.say(content)

@commands.command()
async def say(self, content):
await self.client.say(content)```

This just returns an error

你在标题中描述的错误是不言自明的——也许你忘了在某个地方正确缩进。无论如何,就discordpy而言,看起来您可能使用了过时的语法。有关全面的文档(以及一些简单的示例),请阅读最新的文档。

此错误是d.py中最简单的错误之一。在线

@commands.command()
async def say(self, content):
await self.client.say(content)
我想这就是你出错的地方,也是我能看到的最明显的错误, 您需要:

@commands.command()
async def say(self, content):
    await self.client.say(content)
如果你在不知道如何修复的情况下遇到了这样的问题,我建议你学习Python或者刷新你的记忆,有很多关于discord.py和Python的教程,你也可以阅读discord.py文档。也许再温习一下d.py的重写分支,对我来说,你似乎仍在用旧式写作