Example #1
0
def getName(msg):
    if len(msg.text) < VALIDATE.min_name_len:
        return ReplyIntent(MSGS.include_name_alert, getName)
    temp_users.push(
        msg, {
            table_columns[0]: msg.txt,
            table_columns[-1]: str(datetime.datetime.now())[:-7]
        })
    return ReplyIntent(MSGS.include_age, getAge)
Example #2
0
def include(m, message):
    nick = message.sender_nick
    for user in users.data:
        if nick == user[table_columns[0]]:
            return MSGS.already_registered_error
    temp_users.push(
        message, {
            table_columns[0]: message.sender_nick,
            table_columns[-1]: str(datetime.datetime.now())[:-7]
        })
    if USE_NICK:
        return ReplyIntent(
            Message(channel=message.sender_nick,
                    sender_nick=message.sender_nick,
                    message=MSGS.include_age), getAge)
    else:
        return ReplyIntent(
            Message(channel=message.sender_nick,
                    sender_nick=message.sender_nick,
                    message=MSGS.include_name), getName)
Example #3
0
def getAge(msg):
    if not msg.text.isdigit():
        return ReplyIntent(MSGS.age_error, getAge)
    temp_users.get(msg)[table_columns[1]] = msg.text
    return ReplyIntent(MSGS.include_sex, getSex)
Example #4
0
def getSex(msg):
    if msg.text not in VALIDATE.sex:
        return ReplyIntent(MSGS.sex_error, getSex)
    temp_users.get(msg)[table_columns[2]] = msg.text.upper()
    return ReplyIntent(MSGS.include_orientation, getOrientation)
Example #5
0
def getOrientation(msg):
    if msg.text not in VALIDATE.orientation:
        return ReplyIntent(MSGS.orientation_error, getOrientation)
    temp_users.get(msg)[table_columns[3]] = msg.text.upper()
    return ReplyIntent(MSGS.include_city, getCity)
Example #6
0
def getCity(msg):
    city = msg.text.split()
    temp_users.get(msg)[table_columns[4]] = city[0] if city else ""
    return ReplyIntent(MSGS.include_description, getDescription)
Example #7
0
def getDescription(msg):
    if len(msg.text) < VALIDATE.min_description_len:
        return ReplyIntent(MSGS.description_error, getDescription)
    temp_users.get(msg)[table_columns[5]] = msg.text
    return finalizeInclude(msg)