コード例 #1
0
        public DiscordTrainService(
            IConfiguration configuration,
            TrainAnimator trainController,
            CommandService commands,
            DiscordSocketClient socketClient,
            IServiceProvider serviceProvider,
            ILogger <DiscordTrainService> logger = null)
        {
            botToken = configuration[BotTokenKey];
            if (string.IsNullOrWhiteSpace(botToken))
            {
                throw new InvalidOperationException($"'{nameof(BotTokenKey)}' is missing!");
            }

            this.trainController = trainController ?? throw new ArgumentNullException(nameof(trainController));
            this.commands        = commands ?? throw new ArgumentNullException(nameof(commands));
            this.socketClient    = socketClient ?? throw new ArgumentNullException(nameof(socketClient));
            this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
            this.logger          = logger ?? NullLogger <DiscordTrainService> .Instance;
        }
コード例 #2
0
 public TrainSpeedModule(TrainAnimator trainController, ILogger <TrainSpeedModule> logger)
 {
     this.trainController = trainController ?? throw new ArgumentNullException(nameof(trainController));
     this.logger          = logger ?? NullLogger <TrainSpeedModule> .Instance;
 }