Created
May 6, 2016 19:05
-
-
Save ws/9acea459cfdee49631eb0c8084cd4515 to your computer and use it in GitHub Desktop.
Automatically block users with the default profile image (eggheads) who @reply you. Super simple. Will probably be expanded at some point if I have time.
This file contains 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
var Twit = require('twit') | |
var T = new Twit({ | |
consumer_key: '...', | |
consumer_secret: '...', | |
access_token: '...', | |
access_token_secret: '...' | |
}) | |
var track = '@ws' // Also try 'trump' | |
var stream = T.stream('statuses/filter', { track: track }) | |
stream.on('tweet', function (tweet) { | |
if(tweet.user.default_profile_image){ | |
T.post('blocks/create', { user_id: tweet.user.id }, function(err, data, response) { | |
if(err){ | |
console.log('Error blocking @' + tweet.user.screen_name) | |
} | |
else { | |
console.log('Successfully blocked @' + tweet.user.screen_name) | |
} | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment