From: 2weiEmu Date: Wed, 11 Mar 2026 22:08:22 +0000 (+0100) Subject: update: reinitalise rooms using new config room names X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=a52e7199253c065ab78ca17c4f0ca54b7342cb19;p=binbsis50.git update: reinitalise rooms using new config room names --- diff --git a/lib/rooms.js b/lib/rooms.js index 9740715..6d0f03d 100644 --- a/lib/rooms.js +++ b/lib/rooms.js @@ -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. */