Only adding users to known rooms.

This commit is contained in:
ThePendulum 2021-11-06 02:14:33 +01:00
parent c4f448ea12
commit 114555be66
2 changed files with 3 additions and 4 deletions

View File

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