public static List <string> get_all_admin_keys() { List <string> keys = new List <string>(); foreach (IConfigurationSection admin in ConfigUtils.getConfig().GetSection("devs").GetChildren()) { keys.Add(admin.Value); } return(keys); }
public static string listConfig() { string info = ""; foreach (IConfigurationSection section in ConfigUtils.getConfig().GetChildren()) { info += ConfigSectionToString(section); } return(info); }
public async override Task startAsync() { activeCore = this; Program.client = new DiscordSocketClient(); IConfiguration _config = ConfigUtils.getConfig(); _services = ConfigureServices(); _services.GetRequiredService <LogService>(); await _services.GetRequiredService <CommandHandler>().loadAllModulesAsync(); await Program.client.LoginAsync(TokenType.Bot, _config["token"]); await Program.client.StartAsync(); }
private IServiceProvider ConfigureServices() { return(new ServiceCollection() // Base .AddSingleton(Program.client) .AddSingleton <CommandService>() .AddSingleton <CommandHandler>() // Logging .AddLogging() .AddSingleton <LogService>() // Extra .AddSingleton(ConfigUtils.getConfig()) // Add additional services here... .BuildServiceProvider()); }
public static IConfigurationSection getRepoSection(string prefix) => ConfigUtils.getConfig().GetSection("repos").GetChildren().Where(t => (t.GetValue <string>("prefix") == prefix)).First();