From fcf235c9ce79c92a2c551e3b40645224ca9deaac Mon Sep 17 00:00:00 2001 From: Nero Date: Wed, 23 Sep 2020 12:34:54 +0200 Subject: [PATCH] Readd command not found with extra flag; add /66 --- app.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index f3b07d4..c2a2097 100644 --- a/app.js +++ b/app.js @@ -425,27 +425,35 @@ let kara = new Vue({ // Commands processCommands: function (message) { + let commandExecuted = false; + if (this.checkForCommands(message, 'todo')) { let todoToSave = this.checkForCommands(message, 'todo'); this.saveTodo(todoToSave); + commandExecuted = true; } if (this.checkForCommands(message, 'clear')) { this.clearChat(); + commandExecuted = true; } if (this.checkForCommands(message, 'weather')) { this.checkWeather(); + commandExecuted = true; } if (this.checkForCommands(message, 'joke')) { this.tellJoke(this.checkForCommands(message, 'joke')); + commandExecuted = true; } if (this.checkForCommands(message, 'meme')) { this.getRandomMeme(this.checkForCommands(message, 'meme')); + commandExecuted = true; } else if (this.checkForCommands(message, 'me ')) { this.meMessage(this.checkForCommands(message, 'me ')); + commandExecuted = true; } let animals = [ @@ -461,41 +469,60 @@ let kara = new Vue({ animals.forEach((animal) => { if (this.checkForCommands(message, animal.animal + 'Img')) { this.rsaRandomAnimalImage(animal.animal, animal.emoji); + commandExecuted = true; } if (this.checkForCommands(message, animal.animal + 'Fact')) { this.rsaRandomAnimalFact(animal.animal, animal.emoji); + commandExecuted = true; } }); animals.forEach((animal) => { if (this.checkForCommands(message, animal.animal)) { this.rsaRandomAnimalImage(animal.animal, animal.emoji); + commandExecuted = true; } }); if (this.checkForCommands(message, 'lyrics')) { this.rsaLyrics(this.checkForCommands(message, 'lyrics')); + commandExecuted = true; } if (this.checkForCommands(message, 'quiz')) { this.startQuiz(); + commandExecuted = true; } if (this.checkForCommands(message, 'jeopardy')) { this.startJeopardy(); + commandExecuted = true; } if (this.checkForCommands(message, 'dice')) { this.rollDice(); + commandExecuted = true; } if (this.checkForCommands(message, 'talk')) { this.talk = !this.talk; + commandExecuted = true; } if (this.checkForCommands(message, 'say')) { - this.botMessage(this.checkForCommands(message, 'say')) + this.botMessage(this.checkForCommands(message, 'say')); + commandExecuted = true; + } + + if (this.checkForCommands(message, '66')) { + this.botMessage("But the children.."); + commandExecuted = true; + } + + if (!commandExecuted) { + this.isTyping = false; + this.botMessage("I can't find that command, sorry. 😖"); } this.lastMessage = message;