📜  对 discord.py wait_for 使用异步检查功能? - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:26.970000             🧑  作者: Mango

代码示例1
import asyncio

@client.command()
async def test(ctx):

    async def run(msg):
        await msg.send("This message is not yours!", hidden=True)
        return


    def check(msg):

        if msg.author.id == ctx.author.id:
            return True
        else:
            asyncio.create_task(run(msg))
            return False

    ctx = await client.wait_for("message", check=check)

    ...