Exemple #1
0
        public EventHandlerService(DiscordSocketClient client)
        {
            _client = client;

            // assisting handlers
            _wordFilterService        = new WordFilterService();
            _nicknameAlertService     = new NicknameAlertService(new FloofDataContext());
            _raidProtectionService    = new RaidProtectionService();
            _userRoleRetentionService = new UserRoleRetentionService(new FloofDataContext());
            _welcomeGateService       = new WelcomeGateService(new FloofDataContext());

            // event handlers
            _client.MessageUpdated     += MessageUpdated;
            _client.MessageDeleted     += MessageDeleted;
            _client.UserBanned         += UserBanned;
            _client.UserUnbanned       += UserUnbanned;
            _client.UserJoined         += UserJoined;
            _client.UserLeft           += UserLeft;
            _client.GuildMemberUpdated += GuildMemberUpdated;
            _client.GuildMemberUpdated += _welcomeGateService.HandleWelcomeGate; // welcome gate handler
            _client.UserUpdated        += UserUpdated;
            _client.MessageReceived    += OnMessage;
            _client.MessageReceived    += RulesGate; // rfurry rules gate
            _client.ReactionAdded      += _nicknameAlertService.OnReactionAdded;

            // a list of announcement channels for auto publishing
            announcementChannels = BotConfigFactory.Config.AnnouncementChannels;
        }
 public RaidProtectionService()
 {
     raidConfig                    = BotConfigFactory.Config.RaidProtection;
     _wordFilterService            = new WordFilterService();
     maxMentionCount               = raidConfig["MaxMentionCount"];
     forgivenDuration              = raidConfig["ForgivenDuration"];
     durationForMaxMessages        = raidConfig["DurationForMaxMessages"];
     maxNumberOfPunishments        = raidConfig["MaxNumberOfPunishments"];
     botMessageDeletionDelay       = raidConfig["BotMessageDeletionDelay"];
     removePunishedUserDelay       = raidConfig["RemovePunishedUserDelay"];
     maxNumberPunishedUsers        = raidConfig["MaxNumberPunishedUsers"];
     maxNumberOfJoins              = raidConfig["MaxNumberOfJoins"];
     userJoinsDelay                = raidConfig["UserJoinsDelay"];
     maxNumberEmojis               = raidConfig["MaxNumberEmojis"];
     maxNumberSequentialCharacters = raidConfig["MaxNumberSequentialCharacters"];
     durationBetweenMessages       = raidConfig["DurationBetweenMessages"];
     maxMessageSpam                = raidConfig["MaxMessageSpam"];
 }
        public EventLoggerService(DiscordSocketClient client)
        {
            _client = client;

            // assisting handlers
            _wordFilterService    = new WordFilterService();
            _nicknameAlertService = new NicknameAlertService(new FloofDataContext());

            // event handlers
            _client.MessageUpdated     += MessageUpdated;
            _client.MessageDeleted     += MessageDeleted;
            _client.UserBanned         += UserBanned;
            _client.UserUnbanned       += UserUnbanned;
            _client.UserJoined         += UserJoined;
            _client.UserLeft           += UserLeft;
            _client.GuildMemberUpdated += GuildMemberUpdated;
            _client.MessageReceived    += OnMessage;
            _client.ReactionAdded      += _nicknameAlertService.OnReactionAdded;
        }