|
|
|
@ -425,27 +425,35 @@ let kara = new Vue({
@@ -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({
@@ -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; |
|
|
|
|