Compare commits

..

No commits in common. "a46ffb431b3cf73ebf9b394d6bd804ec0eb2e337" and "a45d00c1054b8ff8686383e786917855f8b3e917" have entirely different histories.

3 changed files with 4 additions and 23 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "schat2-clive",
"version": "1.26.9",
"version": "1.26.8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "schat2-clive",
"version": "1.26.9",
"version": "1.26.8",
"license": "ISC",
"dependencies": {
"better-sqlite3": "^8.3.0",

View File

@ -1,6 +1,6 @@
{
"name": "schat2-clive",
"version": "1.26.9",
"version": "1.26.8",
"description": "Game host for SChat 2-powered chat sites",
"main": "src/app.js",
"scripts": {

View File

@ -60,27 +60,8 @@ async function onRooms({ rooms }, bot) {
const usersRes = await bhttp.get(`${config.api}/room/${rooms.map((room) => room.id).join(',')}/users`);
const users = usersRes.body;
const userIdsByRoom = Object.values(users).reduce((acc, user) => {
user.sharedRooms.forEach((roomId) => {
if (!acc[roomId]) {
acc[roomId] = [];
}
acc[roomId].push(user.id);
});
return acc;
}, {});
/* eslint-disable no-param-reassign */
bot.rooms = rooms.reduce((acc, room) => ({
...acc,
[room.id]: {
...room,
userIds: userIdsByRoom[room.id],
},
}), {});
bot.rooms = rooms.reduce((acc, room) => ({ ...acc, [room.id]: room }), {});
bot.users = { ...bot.users, ...users };
/* eslint-enable no-param-reassign */