public override CommandResultType Handle(ConsoleParameter parameter) { if (_server == null) { SettingProvider settingProvider = new SettingProvider(); NecSetting setting = settingProvider.Load <NecSetting>(SETTING_FILE); if (setting == null) { Logger.Info($"No `{SETTING_FILE}` file found, creating new"); setting = new NecSetting(); settingProvider.Save(setting, SETTING_FILE); } else { Logger.Info($"Loaded Setting from: {settingProvider.GetSettingsPath(SETTING_FILE)}"); } SettingProvider secretsProvider = new SettingProvider(setting.secretsFolder); NecSecret secret = secretsProvider.Load <NecSecret>(SECRET_FILE); if (secret == null) { Logger.Info($"No `{SECRET_FILE}` file found, creating new"); secret = new NecSecret(); secretsProvider.Save(secret, SECRET_FILE); } else { Logger.Info($"Loaded Secrets from: {secretsProvider.GetSettingsPath(SECRET_FILE)}"); } setting.discordBotToken = secret.discordBotToken; setting.databaseSettings.password = secret.databasePassword; LogProvider.Configure <NecLogger>(setting); _server = new NecServer(setting); } if (parameter.arguments.Contains("start")) { _server.Start(); if (_service) { while (_server.running) { Thread.Sleep(TimeSpan.FromMinutes(5)); } return(CommandResultType.Exit); } return(CommandResultType.Completed); } if (parameter.arguments.Contains("stop")) { _server.Stop(); return(CommandResultType.Completed); } return(CommandResultType.Continue); }