(self, network)
return bot
Create, register, and return a new bot for `network`.
Create, register, and return a new bot for `network`.
Create register and return a new bot for network .
def _create_bot(self, network):
        """
        Create, register, and return a new bot for `network`.
        """
        nickname = self.free_nick()
        bot = self._bot_class(
            Identity(
                nickname,
                user=config.IRC_USERNAME,
                real=config.IRC_REALNAME,
                password=network.password
            ),
            network.host,
            port=network.port,
            ssl=network.ssl,
            plugins=[
                EasyProtocolPlugin(),
                HandshakePlugin(),
                NickInUsePlugin(self.free_nick),
                CTCPPlugin(self._ctcp_responses),
                LogPlugin(logger=logging.getLogger(
                    '({0}:{1}:{2})'.format(*network)
                ))
            ]
        )
        try:
            bot.connect()
        except Exception:
            logger.error(
                'An issue occured while connecting to a host',
                exc_info=True,
                extra={
                    'data': {
                        'host': network.host,
                        'port': network.port,
                        'ssl': network.ssl,
                        'password': network.password
                    }
                }
            )
            return None

        signals.on_disconnect.connect(self.remove_bot, sender=bot)
        self._active_bots[network._replace(ssl=False)].add(bot)
        return bot
def _create_bot ( self , network ) : nickname = self . free_nick ( ) bot = self . _bot_class ( Identity ( nickname , user = config . IRC_USERNAME , real = config . IRC_REALNAME , password = network . password ) , network . host , port = network . port , ssl = network . ssl , plugins = [ EasyProtocolPlugin ( ) , HandshakePlugin ( ) , NickInUsePlugin ( self . free_nick ) , CTCPPlugin ( self . _ctcp_responses ) , LogPlugin ( logger = logging . getLogger ( '({0}:{1}:{2})' . format ( * network ) ) ) ] ) try : bot . connect ( ) except Exception : logger . error ( 'An issue occured while connecting to a host' , exc_info = True , extra = { 'data' : { 'host' : network . host , 'port' : network . port , 'ssl' : network . ssl , 'password' : network . password } } ) return None signals . on_disconnect . connect ( self . remove_bot , sender = bot ) self . _active_bots [ network . _replace ( ssl = False ) ] . add ( bot ) return bot