コード例 #1
0
        public CommandHandlingService(IServiceProvider services)
        {
            _services = services;
            _logger   = _services.GetRequiredService <ILogger <CommandHandlingService> >();
            _client   = _services.GetRequiredService <DiscordSocketClient>();

            _configuration        = _services.GetRequiredService <IConfiguration>();
            _customCommandService = _services.GetRequiredService <CustomCommandService>();

            _commandService = _services.GetRequiredService <CommandService>();

            _commandPrefix = _configuration.GetValue <string>("prefix");

            _commandService.AddModulesAsync(Assembly.GetEntryAssembly(), _services).Wait();
            _commandService.CommandExecuted += CommandExecutedAsync;
        }
コード例 #2
0
 public CustomCommandModule(IServiceProvider services)
 {
     _services             = services;
     _customCommandService = _services.GetRequiredService <CustomCommandService>();
 }