I'm programming a simple Twitterbot with JavaScript, but I've hit a problem. For some reason some of my objects become undefined after getting results from Twitter, but some don't. I am using nodeJS and Twit. What could be behind this and how could I solve it?
var hashTags = {};
var dailyStats = {};
//prints out {}
console.log(dailyStats);
setInterval(function() {
//Prints out {}
console.log(dailyStats);
//Prints out {}
console.log(hashTags);
var params;
if(sinceLastTweet === 0){
params = {
count: 200
};
}
else{
params = {
since_id: sinceLastTweet,
};
}
bot.twit.get('statuses/home_timeline', params, function (err, reply) {
//Prints out undefined
console.log(dailyStats);
//Prints out {}
console.log(hashTags);
...
Aucun commentaire:
Enregistrer un commentaire