Creating a bot that re-writes the last tweets from an specified account (NODE)

api

#1

Hey! I’m making a twitter bot to help my school, see, we have a twitter account wich posts the status of the college but it blocks everyone all the time so i’m setting up a bot that could get the tweets from that account and then post them without retweeting them or anything like that. I have a bot made who just searches for a word and then answer the post but i can’t figure out the way to do that.
`//gets tw module
var Twitter = require(‘twitter’);
//gets the json
var keys = require(’./keysBot.json’);

//sets up bot
var client = new Twitter(keys);

//word to search
var word = ‘cnbotayuda’;
//variables
var id_str, screen_name;
var

client.stream(‘statuses/filter’, {track: word}, function(stream) {
console.log('Bot searching for the word ’ + word + ‘.’);
stream.on(‘data’, function(tweet) {

var array = tweet.text.split('cnbotayuda')

{ //search the word

    console.log(tweet.text); //shows the tweet with the word
    //save
    id_str = tweet.id_str;
    screen_name = tweet.user.screen_name;

    //answer
    client.post('statuses/update', {in_reply_to_status_id: id_str,
    status: '@' + screen_name + ' Que la lluvia te bendiga'},
    function(error, tweet, response){
        if(error) throw error;
        console.log(tweet);  // cuerpo del tweet
    });
}

})

stream.on(‘error’, function(error) {
throw error;
});
});`


#2

Closing as a duplicate.


#3