public CommandHandler(DiscordSocketClient client, CommandService commands, ConfigJson configFile, IServiceProvider provider) { _provider = provider; _commands = commands; _client = client; _json = configFile; }
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); }
public TestModule(CommandService service, ConfigJson configJson, QuipsService quips, DiscordSocketClient client) { _client = client; _service = service; _configJson = configJson; _quips = quips; }
public StartupService(DiscordSocketClient client, ConfigJson config) { _client = client; _configJson = config; }