Exemple #1
0
        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);
        }
Exemple #2
0
        public static string listConfig()
        {
            string info = "";

            foreach (IConfigurationSection section in ConfigUtils.getConfig().GetChildren())
            {
                info += ConfigSectionToString(section);
            }
            return(info);
        }
Exemple #3
0
        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();
        }
Exemple #4
0
 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());
 }
Exemple #5
0
 public static IConfigurationSection getRepoSection(string prefix)
 => ConfigUtils.getConfig().GetSection("repos").GetChildren().Where(t => (t.GetValue <string>("prefix") == prefix)).First();