Added settings interface to trivia game.

This commit is contained in:
ThePendulum 2021-11-09 13:48:21 +01:00
parent 1ca03c3faa
commit 0a1512e639
1 changed files with 8 additions and 0 deletions

View File

@ -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) {