]> git.example.dev Git - binbsis50.git/commitdiff
update: reinitalise rooms using new config room names
author2weiEmu <saalbach.robert@outlook.de>
Wed, 11 Mar 2026 22:08:22 +0000 (23:08 +0100)
committer2weiEmu <saalbach.robert@outlook.de>
Wed, 11 Mar 2026 22:08:22 +0000 (23:08 +0100)
lib/rooms.js

index 9740715b0083775cc6bb76b37d1be226976934cd..6d0f03dfb16d8f8eb6c50752fd28ca4af25ecbf1 100644 (file)
@@ -8,7 +8,7 @@ const updateStats = require('./stats');
 const utils = require('./utils');
 
 const fifolength = config.songsinarun * config.gameswithnorepeats;
-const rooms = {}; // The Object that contains all the room instances
+var rooms = {}; // The Object that contains all the room instances
 const songsdb = clients.songs;
 const usersdb = clients.users;
 const isString = utils.isString;
@@ -31,6 +31,16 @@ module.exports = function(options) {
 
 module.exports.rooms = rooms;
 
+/**
+ * Actively re-read the rooms from genres, so the config may be hot reloaded on that part, this will also reinitalize the rooms
+ */
+module.exports.reloadRooms = function() {
+  rooms = {}
+  config.rooms.forEach(function(room) {
+    rooms[room] = new Room(room)
+  }
+}
+
 /**
  * Room constructor.
  */