Skip to content

Instantly share code, notes, and snippets.

View camelgod's full-sized avatar
🔬
Joining 3D Web and EduTech together

Edvard Ødegaard camelgod

🔬
Joining 3D Web and EduTech together
  • Oslo, Norway
View GitHub Profile
const express = require("express");
const app = express();
const fs = require('fs');
const fetch = require('node-fetch');
const tokenFile = './.ret.credentials'
const token = JSON.parse(fs.readFileSync(tokenFile, 'utf8')).token;
const accountURL = 'https://myhubsURL.com/api/v1/accounts'
app.use(express.json())
// Add this to the list of commands in message-dispatch.js
// Write /note <whatever you want> to spawn a 2D image with the text
// Also discovered that this can be done without modification in normal hubs by CTRL+Enter or clicking Create button after writing something
case "note":
if (args[0]) {
const sentence = args.join(" ");
spawnChatMessage(sentence);
}
break;
@camelgod
camelgod / gist:a712ce7d43f21260ae5b4971b9a58dfb
Last active February 14, 2023 18:10
[DUMMY CODE, NOT TESTED] Utopiah BestRoom script with scenes
// Warning this is pretty hacky as you need to change the URL for the room to end with the scene ID. Maybe there is a better way to query the scene ID based on the url, but the spoke only allows to set URL so this is what I imagined late in the evening.
// open-media-button.js
} else if (await isHubsRoomUrl(this.src)) {
// Get the 6 last letters of the name of the url (that you set up as the Scene ID)
let lastSix = this.src.substr(this.src.length - 6); // Should be something like "avC5IO"
// use modified Utopiah script
let bestRoom = getBestRoom(lastSix);
await exitImmersive();