def process_new(body, number): ''' process a text if the user does NOT exist in the db ''' # looks like a signup request if parse.valid_signup_request(body): new_name = parse.get_signup_name(body) create_user(new_name, number) send_welcome(number) # looks like anything else else: send_signup_request(number)
def process_existing(body, number): ''' process a text if the user does exist in the db''' # looks like a message if parse.valid_message_request(body): _process_valid_message(body, number) # looks like a guess elif parse.valid_guess_request(body): _process_valid_guess(body, number) # looks like a signup request elif parse.valid_signup_request(body): _process_valid_signup(body, number) # looks like a stop request elif parse.valid_stop_request(body): delete_user(number) # looks like some garbage we cant parse else: send_invalid(number)