Skip to content

Instantly share code, notes, and snippets.

@indiealexh
Last active August 29, 2015 14:10
Show Gist options
  • Save indiealexh/317abb8365e5283d04e0 to your computer and use it in GitHub Desktop.
Save indiealexh/317abb8365e5283d04e0 to your computer and use it in GitHub Desktop.
Twitter bot
/**
* 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);
})
}
@indiealexh
Copy link
Author

npm install twit
node gistfile1.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment