package com.robothand.highqualitybot;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Hashtable;
import java.util.Scanner;

/**
 * Config.java
 *
 * Reads in properties from a specified configuration file, and provides access to the values.
 */
public class Config {
    private final File configFile;

    public String TOKEN;
    public String PREFIX;


    public Config(String path) throws FileNotFoundException {
        configFile = new File(path);

        Scanner s = new Scanner(configFile);

        while (s.hasNextLine()) {
            String[] split = s.nextLine().split("=");
            String key, value;

            if (split.length < 2 || split[0].trim().startsWith("#")) {
                continue;
            }

            key = split[0].trim();
            value = split[1].trim();

            // place the property if it is known
            switch (key) {
                case "token":
                    TOKEN = value;
                    break;

                case "prefix":
                    PREFIX = value;
            }
        }
    }
}

@@ -440,16 +440,69 @@
 ption %7B%0A
+        // set default values%0A        PREFIX = %22.%22;%0A%0A
         
@@ -1127,24 +1127,473 @@
            %7D
+%0A%0A            // Check for values that would need user input%0A            if (TOKEN == null) %7B%0A                Scanner c = new Scanner(System.in);%0A%0A                System.out.println(%22Warning: OAuth token not set in config. Please enter your token below:%22);%0A                System.out.print(%22%3E %22);%0A                TOKEN = c.nextLine();%0A%0A                System.out.println(%22Token set. Recommend setting in config file for future runs.%22);%0A            %7D
 %0A        %7D%0A 

add default values for configuration options, and ask for user input if token is not set in config