public CommandHandler(DiscordSocketClient client, CommandService commands, ConfigJson configFile, IServiceProvider provider)
 {
     _provider = provider;
     _commands = commands;
     _client   = client;
     _json     = configFile;
 }
Beispiel #2
0
        public async Task MainAsync()
        {
            _client     = new DiscordSocketClient();
            _configJson = await Utility.ImportJson <ConfigJson>("config.json");

            _quips = await Utility.ImportJson <QuipsService>("quips.json");

            _commands = new CommandService();

            _services = new ServiceCollection();
            _services.AddSingleton(_client);
            _services.AddSingleton(_commands);
            _services.AddSingleton(_configJson);
            _services.AddSingleton(_quips);
            _services.AddSingleton <CommandHandler>();
            _services.AddSingleton <StartupService>();


            IServiceProvider provider = _services.BuildServiceProvider();

            SubscribeToClientEvents();

            await provider.GetRequiredService <CommandHandler>().InstallCommandsAsync();

            await provider.GetRequiredService <StartupService>().SignInToDiscord();

            // await forever
            await Task.Delay(-1);
        }
Beispiel #3
0
 public TestModule(CommandService service, ConfigJson configJson, QuipsService quips, DiscordSocketClient client)
 {
     _client     = client;
     _service    = service;
     _configJson = configJson;
     _quips      = quips;
 }
Beispiel #4
0
 public StartupService(DiscordSocketClient client, ConfigJson config)
 {
     _client     = client;
     _configJson = config;
 }