示例#1
0
        public AkickModule(Client client, AKickModuleConfig config, BanRepository banRepository)
        {
            var channels = new List <AkickModuleChannel>();

            foreach (var channelConfig in config.Channels)
            {
                channels.Add(new AkickModuleChannel(client, config, channelConfig, banRepository));
            }

            this.Channels = channels;
        }
示例#2
0
        internal AkickModuleChannel(Client client, AKickModuleConfig moduleConfig, AkickModuleChannelConfig config, BanRepository banRepository)
        {
            this.client        = client ?? throw new ArgumentNullException(nameof(client));
            this.opChannel     = config.OpChannel ?? throw new ArgumentNullException(nameof(opChannel));
            this.adminChannels = config.AdminChannels ?? throw new ArgumentNullException(nameof(adminChannels));
            this.banRepository = banRepository ?? throw new ArgumentNullException(nameof(banRepository));
            this.moduleConfig  = moduleConfig ?? throw new ArgumentNullException(nameof(moduleConfig));

            this.client.AddPrivateMessageHandler(this.banCommand);
            foreach (var adminChannel in this.adminChannels)
            {
                adminChannel.AddPrivateMessageHandler(this.banCommand);
            }
        }