Only adding users to known rooms.
This commit is contained in:
parent
c4f448ea12
commit
114555be66
|
@ -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) {
|
||||||
|
if (bot.rooms[data.roomId] && !bot.rooms[data.roomId]?.includes(data.user.id)) {
|
||||||
bot.users[data.user.id] = data.user;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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') {
|
||||||
|
|
Loading…
Reference in New Issue