Moved tweet functionality out to alert.js

This commit is contained in:
JayWll 2020-04-25 14:53:12 -06:00
parent 169c242e35
commit 61bb0066b0
1 changed files with 35 additions and 0 deletions

View File

@ -4,6 +4,41 @@ require('dotenv').config({path: path.join(__dirname, '../../.env')})
const alert = (type) => {
console.log('Alert triggered for type: ' + type)
switch(type) {
// Water is needed
case 'wantwater':
const tweet = [
'I\'m getting pretty thirsty over here, @JayWll',
'So. Very. Dry. You know I\'m a succulent not a cactus, right @JayWll? 🌵',
'Hey @JayWll, water me. 🥛',
'They say a man shall not live by bread alone, and a succulent won\'t live if you don\'t WATER ME @JAYWLL!!1! 🍞🚰💦',
'@JayWll seriously bro. A little water. That\'s all I ask.'
]
break;
// Water has been received
case 'gotwater':
const tweet = [
'Thanks to whoever watered me just now!! So moist.',
'So refreshing! Thank you, mysterious stranger, for the life-giving liquidy sustenance.',
'Whoever watered me (I\'m kind of guessing it was you, @Katheryn_mur), know that I appreciate it!'
]
break;
}
// Define options for the twitter API
const msg = new twit({
consumer_key: process.env.CONSUMER_KEY,
consumer_secret: process.env.CONSUMER_SECRET,
access_token: process.env.ACCESS_TOKEN,
access_token_secret: process.env.ACCESS_TOKEN_SECRET
})
// Post a tweet
//msg.post('statuses/update', { status: tweet[Math.floor(Math.random() * tweet.length)] })
console.log(tweet[Math.floor(Math.random() * tweet.length)])
}
}
module.exports = alert