Compare commits
No commits in common. "8ac844ecde216e9b4101e5084815e980e1bea2e7" and "533607024549e7f173b64a250d20e4f02600ac5e" have entirely different histories.
8ac844ecde
...
5336070245
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.4.3",
|
"version": "1.4.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.4.3",
|
"version": "1.4.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bhttp": "^1.2.8",
|
"bhttp": "^1.2.8",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.4.3",
|
"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": {
|
||||||
|
|
|
||||||
|
|
@ -123,9 +123,7 @@ function onJoin(data, bot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLeave(data, bot) {
|
function onLeave(data, bot) {
|
||||||
if (bot.rooms[data.roomId]) {
|
|
||||||
bot.rooms[data.roomId].users = bot.rooms[data.roomId].users.filter((userId) => userId !== data.userId);
|
bot.rooms[data.roomId].users = bot.rooms[data.roomId].users.filter((userId) => userId !== data.userId);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessage(message, bot, games) {
|
function onMessage(message, bot, games) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,11 @@ const timers = require('timers/promises');
|
||||||
|
|
||||||
const questions = require('../../assets/jeopardy.json');
|
const questions = require('../../assets/jeopardy.json');
|
||||||
|
|
||||||
const settings = { ...config.trivia };
|
const settings = {
|
||||||
|
rounds: config.trivia.rounds,
|
||||||
|
timeout: config.trivia.timeout,
|
||||||
|
mode: config.trivia.mode,
|
||||||
|
};
|
||||||
|
|
||||||
let game = null;
|
let game = null;
|
||||||
|
|
||||||
|
|
@ -96,8 +100,6 @@ async function playRound(context, round = 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await timers.setTimeout(2000);
|
|
||||||
|
|
||||||
const leaders = Object.entries(game.points).sort(([, scoreA], [, scoreB]) => scoreB - scoreA).map(([username, score], index) => {
|
const leaders = Object.entries(game.points).sort(([, scoreA], [, scoreB]) => scoreB - scoreA).map(([username, score], index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return `**@${username}** with **${score}** points`;
|
return `**@${username}** with **${score}** points`;
|
||||||
|
|
@ -105,7 +107,6 @@ async function playRound(context, round = 0) {
|
||||||
|
|
||||||
return `**@${username}** with **${score}** points`;
|
return `**@${username}** with **${score}** points`;
|
||||||
}).join(', ');
|
}).join(', ');
|
||||||
|
|
||||||
context.sendMessage(`That's the end of the game! Best players: ${leaders}`, context.room.id);
|
context.sendMessage(`That's the end of the game! Best players: ${leaders}`, context.room.id);
|
||||||
|
|
||||||
game = null;
|
game = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue