public IServiceProvider BuildServiceProvider()
        {
            IConfigurationRoot config = new ConfigurationBuilder()
                                        .AddJsonFile("Config/BotConfig.json")
                                        .Build();

            CommandService cmdService = new CommandService(new CommandServiceConfig
            {
                CaseSensitiveCommands = false,
                IgnoreExtraArgs       = false,
                LogLevel = LogSeverity.Info,
            });

            DiscordSocketClient discordClient = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel = LogSeverity.Info,
            });


            ClashOfClansApi clashClient = new ClashOfClansApi(config["clash_token"]);

            ClanInformation   clanInformation   = new ClanInformation();
            PlayerInformation playerInformation = new PlayerInformation();

            _services = new ServiceCollection()
                        .AddSingleton(config)
                        .AddSingleton(cmdService)
                        .AddSingleton(discordClient)
                        .AddSingleton(clashClient)
                        .AddSingleton(clanInformation)
                        .AddSingleton(playerInformation)
                        .AddSingleton <CommandHandler>()
                        .AddSingleton <StartupBot>()
                        .BuildServiceProvider();

            return(_services);
        }
Пример #2
0
 public ClanSearchModule(ClashOfClansApi clashClient, ClanInformation clanInformation)
 {
     _clashClient     = clashClient;
     _clanInformation = clanInformation;
 }
Пример #3
0
 public PlayerSearchModule(ClashOfClansApi clashClient, PlayerInformation playerInfo)
 {
     _clashClient = clashClient;
     _playerInfo  = playerInfo;
 }