Last active
August 29, 2015 14:10
-
-
Save indiealexh/317abb8365e5283d04e0 to your computer and use it in GitHub Desktop.
Twitter bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by ahaslam on 26/11/2014. | |
*/ | |
var Twit = require('twit') | |
var T = new Twit({ | |
consumer_key: 'key', | |
consumer_secret: 'ssshitsasecret', | |
access_token: 'mymothersays', | |
access_token_secret: 'mydadsays' | |
}); | |
var stream = T.stream('statuses/filter', { track: '#DailySilhouette'}) | |
stream.on('tweet', function (tweet) { | |
if (tweet.entities.media) { | |
reTweet(tweet.id_str); | |
} | |
}); | |
stream.on('error', function (error) { | |
console.log(error); | |
}); | |
function reTweet(tweetid){ | |
T.post('statuses/retweet/:id', { id: tweetid }, function (err, data, response) { | |
console.log("Retweeted: "+tweetid); | |
}) | |
} |
Author
indiealexh
commented
Nov 26, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment