command.py 389 B

12345678910111213141516
  1. class command:
  2. def __init__(self):
  3. self.command_list = [
  4. {"number": 1, "text": "帮我填好导航"},
  5. ]
  6. # 根据用户输入返回对应的命令编号
  7. def get_command(self, userMsg):
  8. for cmd in self.command_list:
  9. if cmd["text"] in userMsg:
  10. return cmd["number"]
  11. return 0
  12. commandObj = command()