from common.networkservices import NickServ def process_event(self, connection, event): log.info('Nickname %s in use, attempting to recover: %s' % (self.network.nickname, connection.nickname)) # Log to console. connection.nick(connection.nickname + ''.join(random.choice(string.digits) for _ in range(3))) # Take temporary nick. In this state recovering via NickServ won't work without changing nickname. NickServ.recover_nick(connection, self.network.password) # Recover nick.