Exemplo n.º 1
0
 public virtual void ReloadConfiguration(JObject newConfig)
 {
     Config = new CountersConfig(newConfig);
     PostConfigReload();
 }
Exemplo n.º 2
0
        public CountersPlugin(IConnectionManager connMgr, JObject config)
        {
            ConnectionManager = connMgr;
            Config            = new CountersConfig(config);
            CurrentCommands   = new HashSet <Command>();
            ChannelsMessages  = new Dictionary <string, RingBuffer <ChannelMessage> >();

            ReregisterCommands();

            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("uncount"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker // counter name
                        ),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleUncountCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("regexcount"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker, // counter name
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker, // nickname
                        RestTaker.Instance                                 // regex
                        ),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleRegexCountCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("counted"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker // counter name
                        ),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleCountedCommand
                );
            ConnectionManager.CommandManager.RegisterChannelMessageCommandHandler(
                new Command(
                    CommandUtil.MakeNames("counterstats"),
                    CommandUtil.NoOptions,
                    CommandUtil.MakeArguments(
                        CommandUtil.NonzeroStringMatcherRequiredWordTaker // counter name
                        ),
                    CommandUtil.MakeTags("fun"),
                    forbiddenFlags: MessageFlags.UserBanned
                    ),
                HandleCounterStatsCommand
                );

            ConnectionManager.ChannelMessage  += HandleChannelMessage;
            ConnectionManager.BaseNickChanged += HandleBaseNickChanged;
        }