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()
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()
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])
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])
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()
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')
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")
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()
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')
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')