I'm trying to query from the database words at set interval and match them against Twitter API, I can't figure out how to the the variable
var bannedName = rows[0].name;
into this expression, right now just placing bannedName variable would result undentified
if(!tweetTextRetweet.match(/^RT|@TopU3DAssets|@LatestAssetBot|@IndieLeverage|@Parodossy|@GameArtSleuth|@Alex_TNT/))
to result like
if(!tweetTextRetweet.match(bannedName))
In order to have it work and match against the word. If I put the query outside interval It does not update the query leaving the result unmodified when changed in database
Here's what I currently have
setInterval(function() {
con.query("SELECT setting,name FROM droid_settings WHERE ID = 2", function(error,rows){
var bannedName = rows[0].name;
console.log('INFO ------- ',bannedName);
});
for (var i = 0; i < tweets.length; i++) {
var tweetTextRetweet = tweets[i].text;
if (!tweetTextRetweet.match(/^RT|@TopU3DAssets|@LatestAssetBot|@IndieLeverage|@Parodossy|@GameArtSleuth|@Alex_TNT/)) { // search for RT and @
console.log('INFO -------',tweets[i].id);
dateTime();
console.log('INFO -------',tweets[i].text);
tweets.length = 0;
}else{
//console.log('SKIPPED');
//dateTime();
}
}
// reset the tweets array
tweets.length = 0;
}, 4 * 1000);