📜  discord bot 等待响应 - 无论代码示例

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

代码示例2
# Use Client.wait_for to wait for on_message event.

@commands.command()
async def greet(ctx):
    await ctx.send("Say hello!")

    def check(m):
        return m.content == "hello" and m.channel == channel

    msg = await bot.wait_for("message", check=check)
    await ctx.send(f"Hello {msg.author}!")