Compare commits

...

2 Commits

Author SHA1 Message Date
ThePendulum 5336070245 1.4.2 2021-11-06 02:14:36 +01:00
ThePendulum 114555be66 Only adding users to known rooms. 2021-11-06 02:14:33 +01:00
4 changed files with 6 additions and 7 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.4.1", "version": "1.4.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.4.1", "version": "1.4.2",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"bhttp": "^1.2.8", "bhttp": "^1.2.8",

View File

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

View File

@ -116,9 +116,8 @@ function onRooms({ rooms, users }, bot) {
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
function onJoin(data, bot) { function onJoin(data, bot) {
bot.users[data.user.id] = data.user; if (bot.rooms[data.roomId] && !bot.rooms[data.roomId]?.includes(data.user.id)) {
bot.users[data.user.id] = data.user;
if (!bot.rooms[data.roomId].includes(data.user.id)) {
bot.rooms[data.roomId].push(data.user.id); bot.rooms[data.roomId].push(data.user.id);
} }
} }

View File

@ -78,7 +78,7 @@ async function playRound(context, round = 0) {
const scores = scoreRound(context, round); const scores = scoreRound(context, round);
if (game.mode === 'first') { if (game.mode === 'first') {
context.sendMessage(`**${question.answer}** is the right answer after **${((new Date() - now) / 1000).toFixed(3)}s**! ${scores}`, context.room.id); context.sendMessage(`**${question.answer}** is the right answer, played in **${((new Date() - now) / 1000).toFixed(3)}s**! ${scores}`, context.room.id);
} }
if (game.mode === 'timeout') { if (game.mode === 'timeout') {