예제 #1
0
파일: text.py 프로젝트: totalgood/errbot
    def __init__(self, config):
        super().__init__(config)
        log.debug("Text Backend Init.")

        if hasattr(
                self.bot_config,
                'BOT_IDENTITY') and 'username' in self.bot_config.BOT_IDENTITY:
            self.bot_identifier = self.build_identifier(
                self.bot_config.BOT_IDENTITY['username'])
        else:
            # Just a default identity for the bot if nothing has been specified.
            self.bot_identifier = self.build_identifier('@errbot')

        log.debug('Bot username set at %s.', self.bot_identifier)
        self._inroom = False
        self._rooms = []
        self._multiline = False

        self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(
            self.bot_config, 'TEXT_DEMO_MODE') else False
        if not self.demo_mode:
            self.md_html = xhtml()  # for more debug feedback on md
            self.md_text = text()  # for more debug feedback on md
            self.md_borderless_ansi = borderless_ansi()
            self.md_im = imtext()
            self.md_lexer = get_lexer_by_name("md", stripall=True)

        self.md_ansi = ansi()
        self.html_lexer = get_lexer_by_name("html", stripall=True)
        self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
        self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
        self._register_identifiers_pickling()
예제 #2
0
파일: text.py 프로젝트: apophys/errbot
    def __init__(self, config):
        super().__init__(config)
        log.debug("Text Backend Init.")

        if hasattr(self.bot_config, 'BOT_IDENTITY') and 'username' in self.bot_config.BOT_IDENTITY:
            self.bot_identifier = self.build_identifier(self.bot_config.BOT_IDENTITY['username'])
        else:
            # Just a default identity for the bot if nothing has been specified.
            self.bot_identifier = self.build_identifier('@errbot')

        log.debug('Bot username set at %s.', self.bot_identifier)
        self._inroom = False
        self._rooms = []
        self._multiline = False

        self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False
        if not self.demo_mode:
            self.md_html = xhtml()  # for more debug feedback on md
            self.md_text = text()  # for more debug feedback on md
            self.md_borderless_ansi = borderless_ansi()
            self.md_im = imtext()
            self.md_lexer = get_lexer_by_name("md", stripall=True)

        self.md_ansi = ansi()
        self.html_lexer = get_lexer_by_name("html", stripall=True)
        self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
        self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
        self._register_identifiers_pickling()
예제 #3
0
파일: text.py 프로젝트: vtpp2014/errbot
    def __init__(self, config):
        super().__init__(config)
        log.debug("Text Backend Init.")

        try:
            # Load readline for better editing/history behaviour
            import readline
        except ImportError:
            # Readline is Unix-only
            log.debug("Python readline module is not available")
            pass

        self.bot_identifier = self.build_identifier('Err')
        self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(
            self.bot_config, 'TEXT_DEMO_MODE') else False
        self._rooms = set()
        if not self.demo_mode:
            self.md_html = xhtml()  # for more debug feedback on md
            self.md_text = text()  # for more debug feedback on md
            self.md_borderless_ansi = borderless_ansi()
            self.md_im = imtext()
            self.md_lexer = get_lexer_by_name("md", stripall=True)

        self.md_ansi = ansi()
        self.html_lexer = get_lexer_by_name("html", stripall=True)
        self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
        self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
예제 #4
0
파일: text.py 프로젝트: garmann/errbot
    def __init__(self, config):
        super().__init__(config)
        log.debug("Text Backend Init.")

        try:
            # Load readline for better editing/history behaviour
            import readline
        except ImportError:
            # Readline is Unix-only
            log.debug("Python readline module is not available")
            pass

        self.bot_identifier = self.build_identifier('Err')
        self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False
        self._rooms = set()
        if not self.demo_mode:
            self.md_html = xhtml()  # for more debug feedback on md
            self.md_text = text()  # for more debug feedback on md
            self.md_borderless_ansi = borderless_ansi()
            self.md_im = imtext()
            self.md_lexer = get_lexer_by_name("md", stripall=True)

        self.md_ansi = ansi()
        self.html_lexer = get_lexer_by_name("html", stripall=True)
        self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
        self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
예제 #5
0
 def __init__(self, config):
     super().__init__(config)
     identity = config.BOT_IDENTITY
     self.token = identity.get('token', None)
     if not self.token:
         log.fatal(
             'You need to set your token (found under "Bot Integration" on Slack) in '
             'the BOT_IDENTITY setting in your configuration. Without this token I '
             'cannot connect to Slack.')
         sys.exit(1)
     self.sc = None  # Will be initialized in serve_once
     self.md = imtext()
예제 #6
0
파일: text.py 프로젝트: preoctopus/err
 def __init__(self, config):
     super().__init__(config)
     log.debug("Text Backend Init.")
     self.bot_identifier = self.build_identifier('Err')
     self.rooms = set()
     self.md_html = xhtml()  # for more debug feedback on md
     self.md_text = text()  # for more debug feedback on md
     self.md_ansi = ansi()
     self.md_im = imtext()
     self.md_lexer = get_lexer_by_name("md", stripall=True)
     self.html_lexer = get_lexer_by_name("html", stripall=True)
     self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
예제 #7
0
파일: text.py 프로젝트: nanorepublica/err
 def __init__(self, config):
     super().__init__(config)
     log.debug("Text Backend Init.")
     self.bot_identifier = self.build_identifier("Err")
     self.rooms = set()
     self.md_html = xhtml()  # for more debug feedback on md
     self.md_text = text()  # for more debug feedback on md
     self.md_ansi = ansi()
     self.md_im = imtext()
     self.md_lexer = get_lexer_by_name("md", stripall=True)
     self.html_lexer = get_lexer_by_name("html", stripall=True)
     self.terminal_formatter = Terminal256Formatter(style="paraiso-dark")
예제 #8
0
파일: slack.py 프로젝트: jperras/err
 def __init__(self, config):
     super().__init__(config)
     identity = config.BOT_IDENTITY
     self.token = identity.get('token', None)
     if not self.token:
         log.fatal(
             'You need to set your token (found under "Bot Integration" on Slack) in '
             'the BOT_IDENTITY setting in your configuration. Without this token I '
             'cannot connect to Slack.'
         )
         sys.exit(1)
     self.sc = None  # Will be initialized in serve_once
     self.md = imtext()
예제 #9
0
파일: text.py 프로젝트: dev-zero/errbot
    def __init__(self, config):
        super().__init__(config)
        log.debug("Text Backend Init.")
        self.bot_identifier = self.build_identifier('Err')
        self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False
        self._rooms = set()
        if not self.demo_mode:
            self.md_html = xhtml()  # for more debug feedback on md
            self.md_text = text()  # for more debug feedback on md
            self.md_borderless_ansi = borderless_ansi()
            self.md_im = imtext()
            self.md_lexer = get_lexer_by_name("md", stripall=True)

        self.md_ansi = ansi()
        self.html_lexer = get_lexer_by_name("html", stripall=True)
        self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
예제 #10
0
    def __init__(self, config):
        super().__init__(config)
        log.debug("Text Backend Init.")
        self.bot_identifier = self.build_identifier('Err')
        self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(
            self.bot_config, 'TEXT_DEMO_MODE') else False
        self._rooms = set()
        if not self.demo_mode:
            self.md_html = xhtml()  # for more debug feedback on md
            self.md_text = text()  # for more debug feedback on md
            self.md_borderless_ansi = borderless_ansi()
            self.md_im = imtext()
            self.md_lexer = get_lexer_by_name("md", stripall=True)

        self.md_ansi = ansi()
        self.html_lexer = get_lexer_by_name("html", stripall=True)
        self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')