You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We experimented with a DJ chatbot on venue/loungetable so that anyone can post a youtube link to switch the video being played there. It's probably good to add a bit more restriction on who can change the video, or allow each table to play a different video (currently not possible) but here is the code that I've deployed via pm2 on our server.
#!/usr/bin/env node
constadmin=require('firebase-admin');constconfig=require('./config');constnow=admin.firestore.Timestamp.now();admin.initializeApp(config.firebase);constdb=admin.firestore();consttarget="loungetables";db.collection('venues/'+target+'/chats').onSnapshot(doc=>{console.log("listening to messages on ",target);doc.docChanges().forEach(change=>{constdoc=change.doc.data();if(doc.ts_utc<now)return;//skip messages posted before we started the botconsole.log(doc);constyoutubeV="youtube.com/watch?v=";if(doc.text.includes(youtubeV)){lettoken="5BRc5zV4YKU";//abuse!consttokens=doc.text.split(youtubeV);if(tokens[1]){//does it look like youtube id?let_token=tokens[1].substring(0,11);if(_token.length==11)token=_token;}consturl="https://www.youtube.com/embed/"+token;console.log("switching iframe:",url);db.collection("venues").doc(target).update({iframeUrl: url});}});});
We observed that people really enjoyed this Juke-box-like capability. We mostly played BGM / live clips - mixed with occasional random youtube videos.
The text was updated successfully, but these errors were encountered:
We experimented with a DJ chatbot on venue/loungetable so that anyone can post a youtube link to switch the video being played there. It's probably good to add a bit more restriction on who can change the video, or allow each table to play a different video (currently not possible) but here is the code that I've deployed via pm2 on our server.
We observed that people really enjoyed this Juke-box-like capability. We mostly played BGM / live clips - mixed with occasional random youtube videos.
The text was updated successfully, but these errors were encountered: