Search in sources :

Example 1 with Options

use of io.discloader.discloader.common.start.Options in project DiscLoader by R3alCl0ud.

the class Main method main.

public static void main(String... args) throws IOException, InterruptedException, ExecutionException {
    System.setProperty("http.agent", "DiscLoader");
    logger.info("Attempting to read config");
    String content = "";
    if (new File("options.json").exists()) {
        Object[] lines = Files.readAllLines(Paths.get("./options.json")).toArray();
        for (Object line : lines) content += line;
        options = gson.fromJson(content, Options.class);
        token = options.auth.token;
        logger.info("Finished reading config");
    }
    DLOptions opt = new DLOptions();
    opt.loadMods(options.loadMods);
    opt.setToken(token);
    opt.setPrefix(options.prefix);
    opt.useDefaultCommands(options.defaultCommands);
    opt.setDebug(true);
    loader = new DiscLoader(opt);
    loader.addEventListener(new Listener());
    loader.login().exceptionally(ex -> {
        logger.severe("Test Failed");
        ex.printStackTrace();
        System.exit(1);
        return null;
    });
    CommandRegistry.registerCommand(new CommandRunTest(), "runtest");
    CommandRegistry.registerCommand(new CommandCreateGuild(), "createguild");
    CommandRegistry.registerCommand(new CommandDeleteGuild(), "deleteguild");
}
Also used : Options(io.discloader.discloader.common.start.Options) DLOptions(io.discloader.discloader.common.DLOptions) DLOptions(io.discloader.discloader.common.DLOptions) DiscLoader(io.discloader.discloader.common.DiscLoader) File(java.io.File)

Aggregations

DLOptions (io.discloader.discloader.common.DLOptions)1 DiscLoader (io.discloader.discloader.common.DiscLoader)1 Options (io.discloader.discloader.common.start.Options)1 File (java.io.File)1