Skip to content

Instantly share code, notes, and snippets.

@icalik
Created January 9, 2017 21:30
Show Gist options
  • Save icalik/9b569f32e3b6f44295a6072c4b84f83a to your computer and use it in GitHub Desktop.
Save icalik/9b569f32e3b6f44295a6072c4b84f83a to your computer and use it in GitHub Desktop.
var Twit = require('twit'); //This is import statement.
var config = require('./config');
var T = new Twit(config);
var stream = T.stream('user');
stream.on('follow',followed);
function followed(eventMsg) {
var name = eventMsg.source.name;
var screenName = eventMsg.source.screen_name;
var user_id = eventMsg.source.id;
tweetIt('@' + screenName + ' Takip ettiğin için teşekkürler, mobil bildirimleri açmayı unutma!');
follow_user(user_id);
}
function follow_user(user_id) {
T.post('friendships/create',{ user_id });
}
function tweetIt(txt) {
var tweet = {
status : txt
}
////
T.post('statuses/update',tweet,tweeted);
function tweeted(err,data,response) {
if (err) {
console.log("Something went wrong on tweet!");
}
else{
console.log("It Works!");
}
}
////
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment