Exemple #1
0
def info_message(user_response, user_id):
    """1531"""
    response = advent.respond(user_id, "info").split("\n")
    message = response[0:3]
    smooch.send_message(user_id, "\n".join(message), True)
    smooch.send_links(user_id, response[3], [("More Info", "https://devinmcgloin.com/advent/info/")])
    return True
Exemple #2
0
def help_message(user_response, user_id):
    """1378"""
    response = advent.respond(user_id, "help").split("\n")
    message = response[0:2]
    smooch.send_message(user_id, "\n".join(message), True)
    smooch.send_links(user_id, response[2], [("More Help", "https://devinmcgloin.com/advent/help/"),
                                             ("Hints", "https://devinmcgloin.com/advent/hints/")])
    return True
Exemple #3
0
def info_message(user_response, user_id):
    """1531"""
    response = advent.respond(user_id, "info").split("\n")
    message = response[0:3]
    smooch.send_message(user_id, "\n".join(message), True)
    smooch.send_links(user_id, response[3],
                      [("More Info", "https://devinmcgloin.com/advent/info/")])
    return True
Exemple #4
0
def help_message(user_response, user_id):
    """1378"""
    response = advent.respond(user_id, "help").split("\n")
    message = response[0:2]
    smooch.send_message(user_id, "\n".join(message), True)
    smooch.send_links(user_id, response[2],
                      [("More Help", "https://devinmcgloin.com/advent/help/"),
                       ("Hints", "https://devinmcgloin.com/advent/hints/")])
    return True
Exemple #5
0
def restart(postback_payload, user_id):
    if postback_payload.endswith("yes"):
        advent.new_game(user_id)
        response = advent.respond(user_id, "no")
        smooch.send_message(user_id, response, True)
        r.delete("yesno:" + user_id)
        return True
    elif postback_payload.endswith("no"):
        r.delete("yesno:" + user_id)
        smooch.send_message(user_id, "Ok.", True)
        return True
    else:
        logging.error("Invalid postback={}".format(postback_payload))
        return False
Exemple #6
0
def respond(user_id, response):
    if response == "" or user_id == "":
        return

    smooch.send_message(user_id, response)