this code is supposed to tweet a sentence in an array of sentences as per the interval. It tweets one sentence but the rest don't get tweeted.
Here is the code
var Twit = require('twit');
var config = require('./config')
var T = Twit(config)
let r = Math.floor(Math.random()*10)
setInterval(tweetIt, 1000*30)
words = ['God is good', 'Today is a good day', 'Make the rules. Its yr life', 'Pray', 'Learn- Everyday', 'Books?', 'Movies?', 'Adventure?', 'Niceness', 'Love']
function tweetIt(){
var tweet = {status: words[r]}
T.post('statuses/update', tweet,
function tweeted(err, data, response){
if(err){
console.log('it broke')}
else{console.log('worked');
}
}
)
}
This is the congif file
module.exports ={
consumer_key: "############",
consumer_secret: "############",
access_token: "############",
access_token_secret:"############"
}
In that array of sentences, only one sentence gets tweeted and the rest dont. Instead, it prints that string error; worked it broke it broke it broke it broke it broke