Python 有没有办法为discord.py wait_for使用异步检查函数?

Python 有没有办法为discord.py wait_for使用异步检查函数?,python,bots,discord.py,Python,Bots,Discord.py,我想要一个改变的方法 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 'c

我想要一个改变的方法

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

有没有办法实现异步检查功能?谢谢当前帮助命令到acustom命令,在使用discord.py的my bot中(在discord.py 1.5.1上)通过深入研究代码,似乎没有办法使用协同程序作为检查功能。可能存在一个黑客解决方法,但它不是最佳实践,并且会导致比您通过实施它所能解决的问题多得多的问题。如果您想使用
check
,只需编写执行检查的函数的同步版本,并确保尽可能有效地防止阻塞。

使用
check
查看discord 1.5.1