Python 我怎样才能让我的不和谐机器人用“回答”来回应;“跟进”;消息

Python 我怎样才能让我的不和谐机器人用“回答”来回应;“跟进”;消息,python,discord,discord.py,Python,Discord,Discord.py,我是discord.py的初学者,正在努力寻找答案。 我想让我的discord机器人只在我发送“message1”后才响应“message2”。 比如说, @client.event 异步def on_消息(消息): 如果message.content.lower()=='!rps': 等待message.channel.send(“输入您的选择!”) 在这里,我希望用户输入!rps,然后我想检查他对石头/布/剪刀的后续反应,让机器人相应地回答。如何让bot在用户输入“!rps”后等待用户的下

我是discord.py的初学者,正在努力寻找答案。 我想让我的discord机器人只在我发送“message1”后才响应“message2”。 比如说,

@client.event
异步def on_消息(消息):
如果message.content.lower()=='!rps':
等待message.channel.send(“输入您的选择!”)

在这里,我希望用户输入!rps,然后我想检查他对石头/布/剪刀的后续反应,让机器人相应地回答。如何让bot在用户输入“!rps”

后等待用户的下一条消息您可以通过函数让bot等待用户输入

async def on_message(message):
    if message.content.lower() == '!rps':
        await message.channel.send("Input your choice!")
        def check(m):
            return m.content in ['rock','paper','scissors'] and m.channel == channel and m.author == message.author
        msg = await client.wait_for('message', check=check)
        #msg variable stores the new user input(rock/paper/scissors) [your code down]
        await channel.send(f'User Choosed {msg.content}')
在上面的代码中,我使用了
wait_for
函数等待用户输入!在检查功能的帮助下,我用来检查输入是否有效,输入是否由正确的作者在正确的频道中进行!如果一切都有效,它将开始执行剩余的代码