示例#1
0
 def __init__(self, conn, conf):
     super().__init__(conn)
     self._channel = conf['CONNECTION']['channel'].lower()
     quote_section = config.GetSection(conf, 'quotes')
     if 'db_file' not in quote_section:
         raise Exception('"db_file" not found in QUOTE config section')
     self._db = sqlite3.connect(quote_section['db_file'])
     self._table = quote_section['db_table']
示例#2
0
 def __init__(self, conn, config):
     super().__init__(conn)
     self._cfg = config_lib.GetSection(config, 'RATELIMITER')
     self._pool = _MessagePool(self._cfg.getint('max_age'))
     self._sender_rate = self._cfg.getint('rate_per_sender') or None
     self._text_rate = self._cfg.getint('rate_per_text') or None
     self._text_filter = self._cfg.get('text_filter') or None
     if self._text_filter:
         self._text_filter = re.compile(self._text_filter)
示例#3
0
 def __init__(self, conn, conf):
     super().__init__(conn)
     chain_section = config.GetSection(conf, 'chain')
     if 'plugins' not in chain_section:
         raise Exception('"plugins" setting not found')
     self._handlers = self._LoadPlugins(chain_section['plugins'], conn,
                                        conf)
     if not self._handlers:
         raise Exception('empty list of plugins to load')
示例#4
0
文件: show_text.py 项目: d1zzy/gogbot
    def __init__(self, conn, conf):
        super().__init__(conn)
        self._channel = conf['CONNECTION']['channel'].lower()

        show_text_section = config.GetSection(conf, 'show_text')
        if 'command' not in show_text_section:
            raise Exception('"command" not found in SHOW_TEXT config section')
        self._command = show_text_section['command']
        if 'template' not in show_text_section:
            raise Exception('"template" not found in SHOW_TEXT config section')
        self._template = show_text_section['template']
示例#5
0
    def __init__(self, conn, conf):
        super().__init__(conn)
        self._handlers = [irc.CoreHandler(conn)]

        section = config.GetSection(conf, 'GENERAL')
        if 'plugins' not in section:
            raise Exception('"plugins" setting not found')
        handlers = self._LoadPlugins(section['plugins'], conn, conf)
        if not handlers:
            raise Exception('empty list of plugins to load')
        self._handlers.extend(handlers)
示例#6
0
文件: quotes.py 项目: d1zzy/gogbot
 def __init__(self, conn, conf):
     super().__init__(conn)
     self._helix = helix.Helix(conf)
     self._channel = conf['CONNECTION']['channel'].lower()
     quote_section = config.GetSection(conf, 'quotes')
     if 'db_file' not in quote_section:
         raise Exception('"db_file" not found in QUOTE config section')
     self._db = sqlite3.connect(quote_section['db_file'])
     self._table = quote_section['db_table']
     self._report_errors = quote_section.getboolean('report_errors')
     self._use_whisper = quote_section.getboolean('use_whisper')
示例#7
0
文件: read_url.py 项目: d1zzy/gogbot
    def __init__(self, conn, conf):
        super().__init__(conn)
        self._channel = conf['CONNECTION']['channel'].lower()

        read_url_section = config.GetSection(conf, 'read_url')
        if 'command' not in read_url_section:
            raise Exception('"command" not found in READ_URL config section')
        self._command = read_url_section['command']
        if 'url' not in read_url_section:
            raise Exception('"url" not found in READ_URL config section')
        self._url = read_url_section['url']
示例#8
0
文件: trivia.py 项目: d1zzy/gogbot
 def __init__(self, conn, conf):
     super().__init__(conn)
     self._channel = conf['CONNECTION']['channel'].lower()
     trivia_section = config.GetSection(conf, 'trivia')
     if 'questions_file' not in trivia_section:
         raise Exception('"questions_file" not found in TRIVIA config '
                         'section')
     self._report_errors = trivia_section.getboolean('report_errors')
     self._use_whisper = trivia_section.getboolean('use_whisper')
     self._questions = self._ParseQuestions(
         trivia_section['questions_file'])
     if not self._questions:
         raise Exception('Question list is empty.')
     self._Restart()
     logging.info('plugin ready')