示例#1
0
def text_message(text):
    """Handles answers to questions we've asked the user."""
    mail =  '*****@*****.**'
    g_user = users.User(mail)

    insert_history = TdmessagerHistory(google_user = g_user, history_string = text)
    insert_history.put()
    parser = DateTimeParser(text)
    if parser.parser_text():
        insert_status = RemindStatus(google_user = g_user, remind_at = parser.target_datetime, subject = parser.remind_content, full_message = text, is_remind = False)
        insert_status.put()
        td_reply = str(parser.local_datetime) + '   ' + parser.remind_content
        print td_reply
    else:
        print parser.err_msg
示例#2
0
    def text_message(self, message = None):
        """Handles answers to questions we've asked the user."""
        mail = message.sender[0:message.sender.find('/')]
        g_user = users.User(mail)
        text = message.body

        insert_history = TdmessagerHistory(google_user = g_user, history_string = text)
        insert_history.put()

        t = text.lower()
        if t == 'help':
            return self.help_command(message)
        elif t == 'list':
            return self.list_command(message)

        parser = DateTimeParser(text)
        if parser.parser_text():
            insert_status = RemindStatus(google_user = g_user, remind_at = parser.target_datetime, subject = parser.remind_content, full_message = text, is_remind = False)
            insert_status.put()
            td_reply = '将在' + str(parser.local_datetime) + '提醒你' + parser.remind_content
            message.reply(td_reply)
        else:
            message.reply(parser.err_msg + HINT_INFO)