From 0a1512e639086f1d0e4e304995508736bbe0f18b Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Tue, 9 Nov 2021 13:48:21 +0100 Subject: [PATCH] Added settings interface to trivia game. --- src/games/trivia.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/games/trivia.js b/src/games/trivia.js index 47551c0..488829c 100644 --- a/src/games/trivia.js +++ b/src/games/trivia.js @@ -148,6 +148,14 @@ function onCommand(args, context) { if (context.subcommand === 'stop' && !game) { context.sendMessage(`There is no game going on at the moment. Start one with ${config.prefix}trivia!`, context.room.id); } + + const subcommand = context.subcommand?.toLowerCase(); + + if (subcommand) { + settings[subcommand] = typeof settings[subcommand] === 'number' ? (Number(args[0]) || settings[subcommand]) : args[0]; + + context.sendMessage(`${subcommand} set to ${settings[subcommand]}`, context.room.id); + } } async function onMessage(message, context) {