Example #1
0
    def __init__(self, server):
        super(Module, self).__init__(server)

        # Hook Commands
        api.hook_command(';', self.set_spam_string, server, su = True)

        # Load/Set Settings
        self.hilight_limit = api.get_config_int('BlockBot', 'highlight-limit')
        findlist = api.get_config_str('BlockBot', 'spam-strings')
        self.mps_limit = api.get_config_float('BlockBot', 'mps-limit')
        self.storage_time = 25
        self.repeat_limit = 3
        self.repeat_1word = 4
        self.blacklistkickmsg = api.get_config_str('BlockBot','blacklist-kick-msg')
        self.floodkickmsg = api.get_config_str('BlockBot', 'flood-kick-msg')
        self.repeatkickmsg = api.get_config_str('BlockBot', 'repeat-kick-msg')
        self.masspingkickmsg = api.get_config_str('BlockBot', 'mass-ping-kick-msg')

        # Compile Spam Strings        
        self.findlist = []
        if findlist:
            for each in findlist.split('^^^@@@^^^'):
                self.findlist.append(re.compile(each))

        # Load Default Data
        self.msglist = []
        self.nicklists = {}
        self.lastnot = ('BBot', time.time(), '')
Example #2
0
    def __init__(self, server = config.network):
        self.blacklist = [] # Load Blacklist
        self.blconfig = open(os.path.join(config.PATH, 'trekbot', 'blacklist'), 'r').readlines()
        for each in self.blconfig:
            self.blacklist.append(each.strip('\r\n'))

        self.whitelist = [] # Load Whitelist
        self.wlconfig = open(os.path.join(config.PATH, 'trekbot', 'whitelist'), 'r').readlines()
        for each in self.wlconfig:
            self.whitelist.append(each.strip('\r\n'))
        del self.blconfig, self.wlconfig

        # Read config
        self.proxyscan = api.get_config_bool('trekbot', 'proxy-scan')
        self.charybdis = api.get_config_bool('trekbot', 'charybdis-net')

        # New Test Variables
        self.defkickmsg = api.get_config_str('trekbot', 'default-kick-msg')
        self.blacklistkickmsg = api.get_config_str('trekbot', 'blacklist-kick-msg')

        # Setup Variables
        self.pending_bans = {}
        self.pending_unbans = {}
    
        super(Module, self).__init__(server)

        # Hook Superuser Commands
        api.hook_command('op', self.op, server, su = True)
        api.hook_command('deop', self.deop, server, su = True)
        api.hook_command('voice', self.voice, server, su = True)
        api.hook_command('devoice', self.devoice, server, su = True)
        api.hook_command('nick', self.nick, server, su = True)
        api.hook_command('mode', self.mode, server, su = True)
        api.hook_command('echo', self.echo, server, su = True)
        api.hook_command('say', self.echo, server, su = True)
        api.hook_command('me', self.me, server, su = True)
        api.hook_command('topic', self.set_topic, server, su = True)
        api.hook_command('ban', self.set_ban, server, su = True)
        api.hook_command('unban', self.del_ban, server, su = True)
        api.hook_command('listbl', self.blacklist_list, server, su = True)
        api.hook_command('blacklist', self.blacklist_add, server, su = True)
        api.hook_command('unblacklist', self.blacklist_del, server, su = True)
        api.hook_command('listwl', self.whitelist_list, server, su = True)
        api.hook_command('whitelist', self.whitelist_add, server, su = True)
        api.hook_command('unwhitelist', self.whitelist_del, server, su = True)
        api.hook_command('kick', self.kick_user, server, su = True)
        api.hook_command('invite', self.invite_user, server, su = True)
        api.hook_command('kickban', self.kick_ban, server, su = True)
        # The following line gives an error when used, it might be better to
        #    make a load_whitelist method and hook a new command for it
        # api.hook_command('rehash_trekbot', self.__init__, server, su = True)
        
        #Defines charybdis only options.
        if (self.charybdis):
            api.hook_command('quiet', self.quiet, server, su = True)
            api.hook_command('unquiet', self.unquiet, server, su = True)
            api.hook_command('protect', self.protect_chan, server, su = True)
            api.hook_command('unprotect', self.unprotect_chan, server, su = True)
Example #3
0
    def __init__(self, server):
        super(Module, self).__init__(server)
        self.vars = {
            'main_channel':api.get_config_str('werewolf', 'main-channel'), 
            'wolf_channel':api.get_config_str('werewolf', 'wolf-channel'), 
            'seer_channel':api.get_config_str('werewolf', 'seer-channel'), 
        }
        # Setup type counts
        self.seers = 0
        self.wolves = 0
        self.villagers = 0

        # Manage players
        self.players = {}
        self.waiting = []

        # Setup state
        self.phase = 'waiting'