Discord.py让机器人等待回复



如何制作一个命令,让我的机器人在键入命令后等待作者的回复?感谢

使用Client.wait_for等待on_message事件。

@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}!")

Fixator10发布的内容返回了"频道";对我来说是未定义的。我把它改为"return m.content == "hello" and m.channel == ctx.channel",它在上工作

最新更新