コード例 #1
0
ファイル: statusbot.py プロジェクト: Mustapha-bdl/BBot
    def __init__(self, server):
        super(Module, self).__init__(server)
        self.statuses = {}

        # Hook commands
        api.hook_command('status', self.status, server)
        api.hook_command('whereis', self.whereis, server)
コード例 #2
0
ファイル: blockbot.py プロジェクト: xfix/BBot
    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(), '')
コード例 #3
0
ファイル: test_api.py プロジェクト: Mustapha-bdl/BBot
 def test_hook_command_function(self):
     '''Test to make sure that the hook_command function actually
     hooks the command to the proper server'''
     api.hooks = {'irc.pretendnetwork.example.com':{}}
     api.hook_command('blah',
                      self.null_callback, 'irc.pretendnetwork.example.com')
     self.assertEqual(api.hooks, {'irc.pretendnetwork.example.com':
                                      {'blah':self.null_callback}})
コード例 #4
0
ファイル: test_api.py プロジェクト: Mustapha-bdl/BBot
 def test_hook_server_must_exist(self):
     '''Make sure that the server the command is being hooked to is
     checked to exist before hooking the command'''
     api.hooks = {}
     api.hook_command('blah',
                      self.null_callback, 'irc.doesnotexist.com')
     self.assertEqual(api.hooks, {},
                      'Hooks are being created for nonexistant nets')
コード例 #5
0
ファイル: factoids.py プロジェクト: aj00200/BBot
    def __init__(self, address):
        super(Module, self).__init__(address)
        self.command_list = []
        self.command_start = ':' + config.cmd_char
        self.cmd_len = len(self.command_start)

        # Hook commands
        api.hook_command('writedb', self.su_writedb, address, su=True)
        api.hook_command('add', self.su_add, address, su=True)
        api.hook_command('del', self.su_del, address, su=True)
コード例 #6
0
ファイル: grepfwd.py プロジェクト: Mustapha-bdl/BBot
 def __init__(self, server):
     super(Module, self).__init__(server)
     api.hook_command('grepfwd', self.grepfwd, server, su = True)
     self.fwds = {}
コード例 #7
0
ファイル: BBot.py プロジェクト: aj00200/BBot
    def __init__(self, server):
        super(Module, self).__init__(server)

        self.command_list = []
        self.command_start = ':' + config.cmd_char
        self.cmd_len = len(self.command_start)

        # Let's hook up our commands
        api.hook_command('help', self.help, server)
        api.hook_command('nhelp', self.normal_help, server)
        api.hook_command('shelp', self.su_help, server)
        api.hook_command('version', self.version, server)
        # Superuser commands. Darn, we really need a better auth system
        api.hook_command('join', self.su_join, server, su=True)
        api.hook_command('quit', self.su_quit, server, su=True)
        api.hook_command('part', self.su_part, server, su=True)
        api.hook_command('raw', self.su_raw, server, su=True)
        api.hook_command('load', self.su_load, server, su=True)
        api.hook_command('reload', self.su_reload, server, su=True)
        api.hook_command('py', self.su_py, server, su=True)
        api.hook_command('connect', self.su_connect, server, su=True)
コード例 #8
0
ファイル: admin.py プロジェクト: aj00200/BBot
    def __init__(self, address):
        super(Module, self).__init__(address)

        # Hook Superuser Commands
        api.hook_command('join', self.join_cmd, address, su=True)
        api.hook_command('addaccess', self.add_access, address, su=True)
コード例 #9
0
ファイル: ddgbot.py プロジェクト: bbottheircbot/BBot
 def __init__(self, server):
     super(Module, self).__init__(server)
     api.hook_command('ddg', self.ddg, server)
     api.hook_command('define', self.ddg_define, server)
コード例 #10
0
ファイル: ddgbot.py プロジェクト: aj00200/BBot
 def __init__(self, server):
     super(Module, self).__init__(server)
     api.hook_command("ddg", self.ddg, server)
     api.hook_command("define", self.ddg_define, server)
コード例 #11
0
ファイル: mathbot.py プロジェクト: bbottheircbot/BBot
 def __init__(self, server):
     super(Module, self).__init__(server)
     api.hook_command('math', self.math, server)
コード例 #12
0
ファイル: trekbot.py プロジェクト: aj00200/BBot
    def __init__(self, server=config.network):
        self.blacklist = []  # Load Blacklist
        with open(os.path.join(config.PATH, 'trekbot', 'blacklist')) as blfile:
            for line in blfile.readlines():
                self.blacklist.append(line.strip('\r\n'))

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

        # 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)