From 9ba484af2cdebc83bc8b494ed350cb9b4965746b Mon Sep 17 00:00:00 2001 From: Nero Ignis Date: Sun, 20 Sep 2020 03:32:33 +0200 Subject: [PATCH] Add chat-interactions for new games; --- app.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index b504870..4d9f22a 100644 --- a/app.js +++ b/app.js @@ -282,6 +282,23 @@ let kara = new Vue({ return false; } + if (this.includesAllOf(keywords, ['play']) && + this.includesOneOf(keywords, ['quiz', 'trivia']) + ) { + this.startQuiz(); + return false; + } + + if (this.includesAllOf(keywords, ['play', 'jeopardy'])) { + this.startJeopardy(); + return false; + } + + if (this.includesAllOf(keywords, ['clear', 'chat'])) { + this.clearChat(); + return false; + } + if (this.includesAllOf(keywords, ['weather']) && this.includesOneOf(keywords, ['how', 'whats']) ) { @@ -423,7 +440,7 @@ let kara = new Vue({ } if (this.checkForCommands(message, 'quiz')) { - this.getRandomTriviaQuestion(); + this.startQuiz(); } if (this.checkForCommands(message, 'jeopardy')) { @@ -614,7 +631,7 @@ let kara = new Vue({ this.updateStorage(); }, - getRandomTriviaQuestion() { + startQuiz() { let vue = this; let url = 'https://jservice.io/api/random';