对编码非常陌生,所以请耐心等待。我想知道在处理不和谐机器人时是否可以对嵌套命令和响应进行排序。例如,您将使用命令查看您的选项,然后机器人将等待对其消息的响应并做出相应的回复。我在描述我的意思时遇到了一点麻烦,所以这里有一个例子:你问机器人一些事情机器人给你选项你从这些选项中选择机器人回应你的答案或者你要求机器人用你做的事情说下一个 机器人让你说些什么 你说些什么 机器人在它的回复中使用你所说的
我已经尝试将 on_message 命令嵌套到已经存在的 if 语句中,但这显然没有奏效。我还尝试添加另一个 if 语句,包含整个 message.content 内容,希望机器人在考虑到响应后会考虑该消息。
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("!ml"):
message.content = message.content.lower().replace(' ', '')
if message.content in command1:
response = "Hello! To start type !ml menu. You will be given your options. Don't forget to type !ml before " \
"everything you tell me, so I know it's me your talking to! Thanks : ) "
elif message.content in command2:
response = "test"
if message.content in top:
await message.channel.send(response)
我原以为机器人会在回复后考虑到该消息,但是机器人只是从头开始。
UYOU
相关分类