本文整理汇总了Python中engine.Engine.process_message_dev方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.process_message_dev方法的具体用法?Python Engine.process_message_dev怎么用?Python Engine.process_message_dev使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类engine.Engine
的用法示例。
在下文中一共展示了Engine.process_message_dev方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_message
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import process_message_dev [as 别名]
def on_message(self, sender=None, message=None):
logging.info("Recieved message from %s: %s", sender, message)
if sender is None or message is None or message == "":
raise Error("Invalid sender or message.")
# Admin start command requires 10 digit phone NOT prefixed with "+1"
if message.split(' ')[0].lower() == "start":
sender = "+1" + message.split(' ')[1]
logging.info("AdminStart for #: %s", sender)
message = "AdminStart"
student = Student.ensure_student(phone=sender)
try:
student.totalMsgReceived
except:
student.totalMsgReceived = 1
else:
student.totalMsgReceived += 1
student.put()
session = Session.ensure_session(student.get_id())
lesson = self.lessons.get(session.lesson_id)
if lesson is None:
raise Error("No such lesson: %s" % session.lesson_id)
json_data = open('hiragana.json')
data = json.load(json_data)
json_data.close()
eng = Engine(data)
messages = eng.process_message_dev(message, student)
#logging.info("Student's foo: %s" % student.questionHistory['foo'])
if session.state == -1:
session.key.delete()
else:
session.put()
self.send_SMS_replies(sender, messages)