Example #1
0
        // If any services require the client, or the CommandService, or something else you keep on hand,
        // pass them as parameters into this method as needed.
        // If this method is getting pretty long, you can seperate it out into another file using partials.
        private IServiceProvider ConfigureServices()
        {
            _output = new DiscordOutput();
            var gameCommander = new GameCommander(_output);

            var map = new ServiceCollection()
                      // Repeat this for all the service classes
                      // and other dependencies that your commands might need.
                      .AddSingleton(gameCommander);

            // When all your required services are in the collection, build the container.
            // Tip: There's an overload taking in a 'validateScopes' bool to make sure
            // you haven't made any mistakes in your dependency graph.
            return(map.BuildServiceProvider());
        }
Example #2
0
 public GameModule(GameCommander gameCommander)
 {
     _gameCommander = gameCommander;
 }