@ commands.Cog.listener()on_ready(self)没有响应

时间:2020-08-05 17:27:50

标签: python discord.py

我在齿轮中有这样的代码,一旦我的机器人被加载,它应该在我的amounts.db文件夹中创建文件data,并在其中包含相关表

@commands.Cog.listener()
async def on_ready(self):
    dbamounts = await aiosqlite.connect("data//amounts.db", self.bot.loop)
    camounts = dbamounts.cursor()
    await camounts.execute("CREATE TABLE IF NOT EXISTS Amounts(id INTEGER, balance INTEGER, UNIQUE(id))")
    await dbamounts.commit()
    store["dbamounts"] = dbamounts
    store["camounts"] = camounts

即使我尝试了其他命令(例如仅打印),它也不起作用

@commands.Cog.listener()
async def on_ready(self):
    print("Ready!")

@ commands.command()和所有其他代码都可以使用,而@ commands.Cog.listener()标记的代码则无效。我安装的discord.py可能有问题,如果是,我应该如何重新安装它?

0 个答案:

没有答案