【发布时间】:2021-02-16 13:42:48
【问题描述】:
我想要一个方法来改变
async def check(reaction, user):
await x
return y
await self.bot.wait_for('reaction_add', check=check)
这会产生一条错误消息,指出未等待检查功能:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ExtensionFailed: Extension 'cogs.boost' raised an error: SyntaxError: 'await' outside async function
如果我将代码更改为:
async def check(reaction, user):
await x
return y
await self.bot.wait_for('reaction_add', check=await check)
我收到以下错误消息:
TypeError: object function can't be used in 'await' expression
有什么办法可以有异步检查功能吗?谢谢!当前帮助命令到自定义命令,在我的机器人中使用 discord.py
【问题讨论】:
-
将
check用于discord 1.5.1
标签: python bots discord.py