Esempio n. 1
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();
        }
Esempio n. 2
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());
 }
Esempio n. 3
0
 public static IConfigurationSection getRepoSection(string prefix)
 => ConfigUtils.getConfig().GetSection("repos").GetChildren().Where(t => (t.GetValue <string>("prefix") == prefix)).First();