示例#1
0
 def post(self):
     msg = Message(request.data)
     command, body = parse_body(msg.Body)
     command = self.process_command(command)
     if not command in self.robot._commands:
         return ''
     handle = getattr(self.robot, command)
     return return_message(msg.To, msg.From, handle(body, msg))
示例#2
0
 def job(self, body, message):
     sub_command, sub_body = parse_body(body)
     if not sub_command in self.jobrobot._commands:
         return '机器人不知道你想干嘛哦~'
     handle = getattr(self.jobrobot, sub_command)
     return handle(sub_body, message)