def setup_wizard(): """ Set-up wizard to prompt for user information to setup simulation and create a few test posts. :return: """ print("Welcome to MarkovMe, Version 1.0. \n") print("Please make sure that you have set up your .groupy.key file. For more information, see the Groupy API: \n" "http://groupy.readthedocs.org/en/master/pages/installation.html#prerequisites") print("Querying for your groups...") groups = GroupmeApiHandler.get_groups() print("Found the following groups:\n") for group in groups: print(group, "\n") old_group = None while old_group is None: original_group_name = input("Please type the name of the group you would like to simulate: ") old_group = GroupmeApiHandler.get_group(original_group_name) if old_group is None: print("Error. No groups found containing this string. Try again.") print("Downloading data from your GroupMe \n") messages = GroupmeApiHandler.get_all_available_messages(old_group) # Write all messages into separate text files file_names, user_names = write_messages(messages) # Create group GroupmeApiHandler.setup(old_group, user_names) # Create some test posts to get started. create_posts(user_names)
if __name__ == "__main__": # Read in sys input to determine which command to execute command = sys.argv[1] if command == "create_post": print("Querying for your groups...") groups = GroupmeApiHandler.get_group_contains("Simulator") print("Found the following simulator groups:\n") for group in groups: print(group, "\n") original_group = None while original_group is None: sim_name = input("Please type the name of the simulation you would like to run: ") original_name = sim_name.replace(" Simulator", "") original_group = GroupmeApiHandler.get_group(original_name) if original_group is None: print("Error. No groups found containing this string. Try again.") print("Getting users...") user_names = GroupmeApiHandler.get_user_names(original_group) print("Creating posts...") create_posts(user_names) # TODO: Allow command to train the simulator by getting the last week's messages elif command == "init": setup_wizard() else: print("Welcome to MarkovMe, Version 1.0. \n\n" "Run Scheduler.py <command> where \n" "Possible commands are: \n" "init - run set-up wizard for new chain \n" "train - query the GroupMe for the week's training data \n"