Discord.py Rewrite Cog: TypeError: __init__() missing 1 required positional argument: 'func'

Discord.py Rewrite Cog: TypeError: __init__() missing 1 required positional argument: 'func'

我正在尝试创建一个简单的命令,在 discord.py 中用齿轮打招呼,但收到错误: TypeError: __init__() missing 1 required positional argument: 'func'。我知道应该使用 cogs 来组织一组相关的命令。我只是在测试,以便我可以创建一个更复杂的机器人。我查看了 docs,但没有发现任何重要信息。也许我错过了一件非常明显的事情。请帮忙。我是初学者。 这是我的代码:

class Test_Cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.Command()
    async def sayhi(self, ctx):
        await ctx.send('hi')


class Test_Application_Bot(commands.Bot):
    async def on_ready(self):
        print("Logged on as", self.user)

    async def on_message(self, message):
        # so that it doesn't respond to itself
        if message.author == self.user:
            return

        print(message.content)
        if message.content == "ping":
            await message.channel.send("pong")

        await self.process_commands(message)


def read_token():
    with open("token.txt", "r") as f:
        lines = f.readlines()
        return lines[0].strip()

def main():
    bot = Test_Application_Bot(command_prefix="!")
    bot.add_cog(Test_Cog(bot))
    bot.run(read_token())

if __name__ == "__main__":
    main()

装饰器要用小写字母书写 而不是 @commands.Command() 尝试 @commands.command()