diff --git a/scripts/bot/run-bot.js b/scripts/bot/run-bot.js index 2e37ccc3d62a5d6bea59efa64a8b11d9984ee1e0..d6851f97292f1cd978f9b3c72ad7d559dfccc0ee 100644 --- a/scripts/bot/run-bot.js +++ b/scripts/bot/run-bot.js @@ -4,9 +4,10 @@ Usage: ./run-bot.js [options] Options: - -h --host=<host> Hubs host [default: localhost:8080] - -r --room=<room> Room id [default: 234234]. - -h --help Show this screen. + -u --url=<url> URL + -o --host=<host> Hubs host if URL is not specified [default: localhost:8080] + -r --room=<room> Room id + -h --help Show this screen `; const docopt = require("docopt").docopt; @@ -22,12 +23,19 @@ const querystring = require("query-string"); page.on("error", err => console.error("ERROR: ", err)); page.on("pageerror", err => console.error("PAGE ERROR: ", err)); + const baseUrl = options["--url"] || `https://${options["--host"]}/hub.html`; + const params = { - room: options["--room"], - bot: true + bot: true, + allow_multi: true }; - console.log(params); - const url = `https://${options["--host"]}/hub.html?${querystring.stringify(params)}`; + const roomOption = options["--room"]; + if (roomOption) { + params.room = roomOption; + } + + const url = `${baseUrl}?${querystring.stringify(params)}`; + console.log(url); const navigate = async () => { try { diff --git a/scripts/bot/run-bot.sh b/scripts/bot/run-bot.sh index 7bd9b986a2463a2864403b81599a0e161206d58e..aa693b25a11eca48bb83d4cc51115fdf6138f2eb 100755 --- a/scripts/bot/run-bot.sh +++ b/scripts/bot/run-bot.sh @@ -9,7 +9,6 @@ yarn echo 'Building Hubs' yarn build > /dev/null -# install run-bot.js dependencies cd $script_directory echo 'Installing bot dependencies' yarn diff --git a/src/hub.js b/src/hub.js index b41b90d7eedf1dd9c82eb0c6d7dbaa1878e53221..27963943373e9b748120b861f902fe64adeda2b3 100644 --- a/src/hub.js +++ b/src/hub.js @@ -128,7 +128,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); @@ -137,7 +141,6 @@ AFRAME.registerInputActivator("pressedmove", PressedMove); AFRAME.registerInputActivator("reverseY", ReverseY); AFRAME.registerInputMappings(inputConfig, true); -const isBotMode = qsTruthy("bot"); const concurrentLoadDetector = new ConcurrentLoadDetector(); concurrentLoadDetector.start(); @@ -287,9 +290,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 }); });