From a8b9446dcb95af903c7475c4b9c07baa1911a880 Mon Sep 17 00:00:00 2001
From: Brian Peiris <brianpeiris@gmail.com>
Date: Fri, 11 May 2018 11:23:21 -0700
Subject: [PATCH] disable telemetry for bots

---
 src/hub.js | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/hub.js b/src/hub.js
index 80741c2e1..299845ca4 100644
--- a/src/hub.js
+++ b/src/hub.js
@@ -122,7 +122,11 @@ function qsTruthy(param) {
   return val === null || /1|on|true/i.test(val);
 }
 
-registerTelemetry();
+const isBotMode = qsTruthy("bot");
+
+if (!isBotMode) {
+  registerTelemetry();
+}
 
 AFRAME.registerInputBehaviour("trackpad_dpad4", trackpad_dpad4);
 AFRAME.registerInputBehaviour("joystick_dpad4", joystick_dpad4);
@@ -130,7 +134,6 @@ AFRAME.registerInputActivator("pressedmove", PressedMove);
 AFRAME.registerInputActivator("reverseY", ReverseY);
 AFRAME.registerInputMappings(inputConfig, true);
 
-const isBotMode = qsTruthy("bot");
 const concurrentLoadDetector = new ConcurrentLoadDetector();
 
 concurrentLoadDetector.start();
@@ -279,9 +282,11 @@ const onReady = async () => {
 
     if (!qsTruthy("offline")) {
       document.body.addEventListener("connected", () => {
-        hubChannel.sendEntryEvent().then(() => {
-          store.update({ activity: { lastEnteredAt: moment().toJSON() } });
-        });
+        if (!isBotMode) {
+          hubChannel.sendEntryEvent().then(() => {
+            store.update({ activity: { lastEnteredAt: moment().toJSON() } });
+          });
+        }
         remountUI({ occupantCount: NAF.connection.adapter.publisher.initialOccupants.length + 1 });
       });
 
-- 
GitLab