|
|
@ -135,8 +135,13 @@ let kara = new Vue({ |
|
|
|
body: imageObject.body, |
|
|
|
body: imageObject.body, |
|
|
|
bot: bot, |
|
|
|
bot: bot, |
|
|
|
src: imageObject.src |
|
|
|
src: imageObject.src |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.scrollDown(); |
|
|
|
|
|
|
|
}, 1000); |
|
|
|
|
|
|
|
|
|
|
|
this.updateStorage(); |
|
|
|
this.updateStorage(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
botMessage(message) { |
|
|
|
botMessage(message) { |
|
|
@ -437,17 +442,31 @@ let kara = new Vue({ |
|
|
|
this.meMessage(this.checkForCommands(message, 'me ')); |
|
|
|
this.meMessage(this.checkForCommands(message, 'me ')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.checkForCommands(message, 'cat')) { |
|
|
|
let animals = [ |
|
|
|
this.getRandomCat(); |
|
|
|
{animal: 'birb', emoji: '🐦'}, |
|
|
|
} |
|
|
|
{animal: 'dog', emoji: '🐶'}, |
|
|
|
|
|
|
|
{animal: 'cat', emoji: '🐱'}, |
|
|
|
|
|
|
|
{animal: 'fox', emoji: '🦊'}, |
|
|
|
|
|
|
|
{animal: 'panda', emoji: '🐼'}, |
|
|
|
|
|
|
|
{animal: 'red_panda', emoji: '🤩'}, |
|
|
|
|
|
|
|
{animal: 'koala', emoji: '🐨'} |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
if (this.checkForCommands(message, 'shiba')) { |
|
|
|
animals.forEach((animal) => { |
|
|
|
this.getRandomShiba(); |
|
|
|
if (this.checkForCommands(message, animal.animal + 'Img')) { |
|
|
|
} |
|
|
|
this.rsaRandomAnimalImage(animal.animal, animal.emoji); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.checkForCommands(message, 'birb')) { |
|
|
|
if (this.checkForCommands(message, animal.animal + 'Fact')) { |
|
|
|
this.getRandomBirb(); |
|
|
|
this.rsaRandomAnimalFact(animal.animal, animal.emoji); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
animals.forEach((animal) => { |
|
|
|
|
|
|
|
if (this.checkForCommands(message, animal.animal)) { |
|
|
|
|
|
|
|
this.rsaRandomAnimalImage(animal.animal, animal.emoji); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (this.checkForCommands(message, 'quiz')) { |
|
|
|
if (this.checkForCommands(message, 'quiz')) { |
|
|
|
this.startQuiz(); |
|
|
|
this.startQuiz(); |
|
|
@ -546,66 +565,6 @@ let kara = new Vue({ |
|
|
|
|
|
|
|
|
|
|
|
this.updateStorage(); |
|
|
|
this.updateStorage(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
getRandomCat() { |
|
|
|
|
|
|
|
let vue = this; |
|
|
|
|
|
|
|
let url = 'https://api.thecatapi.com/v1/images/search?apiKey=5666b3cc-a7a3-406f-904d-b13594780d7f'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.get(url) |
|
|
|
|
|
|
|
.then(function (response) { |
|
|
|
|
|
|
|
vue.addImageMessage({ |
|
|
|
|
|
|
|
caption: '', |
|
|
|
|
|
|
|
image: response.data[0].url |
|
|
|
|
|
|
|
}, true); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
vue.scrollDown(); |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch(function (error) { |
|
|
|
|
|
|
|
vue.botMessage("I can't find any images at the moment, sorry.. 😿"); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.updateStorage(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getRandomShiba() { |
|
|
|
|
|
|
|
let vue = this; |
|
|
|
|
|
|
|
let url = 'http://shibe.online/api/shibes'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.get(url) |
|
|
|
|
|
|
|
.then(function (response) { |
|
|
|
|
|
|
|
vue.addImageMessage({ |
|
|
|
|
|
|
|
caption: '', |
|
|
|
|
|
|
|
image: response.data[0].url |
|
|
|
|
|
|
|
}, true); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
vue.scrollDown(); |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch(function (error) { |
|
|
|
|
|
|
|
vue.botMessage("I can't find any images at the moment, sorry.. 🐶"); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.updateStorage(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getRandomBirb() { |
|
|
|
|
|
|
|
let vue = this; |
|
|
|
|
|
|
|
let url = '//random.birb.pw/tweet.json'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.get(url) |
|
|
|
|
|
|
|
.then(function (response) { |
|
|
|
|
|
|
|
vue.addImageMessage({ |
|
|
|
|
|
|
|
caption: '', |
|
|
|
|
|
|
|
image: 'https://random.birb.pw/img/' + response.data.file |
|
|
|
|
|
|
|
}, true); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
vue.scrollDown(); |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch(function (error) { |
|
|
|
|
|
|
|
vue.botMessage("I can't find any images at the moment, sorry.. 🐦"); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.updateStorage(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
tellJoke(category) { |
|
|
|
tellJoke(category) { |
|
|
|
let vue = this; |
|
|
|
let vue = this; |
|
|
|
let categorySet = false; |
|
|
|
let categorySet = false; |
|
|
@ -739,6 +698,37 @@ let kara = new Vue({ |
|
|
|
this.updateStorage(); |
|
|
|
this.updateStorage(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Some Random API Commands
|
|
|
|
|
|
|
|
rsaRandomAnimalImage(animal, emoji = '😄') { |
|
|
|
|
|
|
|
let vue = this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.post('/api/curlJson', { |
|
|
|
|
|
|
|
url: 'https://some-random-api.ml/img/' + animal |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
|
|
vue.botMessage("Sorry, i can't find any good pictures right now 🙁" + emoji); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then((response) => { |
|
|
|
|
|
|
|
vue.addImageMessage({ |
|
|
|
|
|
|
|
body: emoji, |
|
|
|
|
|
|
|
src: response.data.link |
|
|
|
|
|
|
|
}, true); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
rsaRandomAnimalFact(animal, emoji = '😄') { |
|
|
|
|
|
|
|
let vue = this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.post('/api/curlJson', { |
|
|
|
|
|
|
|
url: 'https://some-random-api.ml/facts/' + animal |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
|
|
vue.botMessage("Sorry, i can't think of any good facts right now 🙁" + emoji); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then((response) => { |
|
|
|
|
|
|
|
vue.botMessage(response.data.fact); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// LocalStorage
|
|
|
|
// LocalStorage
|
|
|
|
getSavedData() { |
|
|
|
getSavedData() { |
|
|
|
let savedName = localStorage.getItem('name'); |
|
|
|
let savedName = localStorage.getItem('name'); |
|
|
|