Last active
December 27, 2015 15:59
-
-
Save ikr7/7352270 to your computer and use it in GitHub Desktop.
sasamijpのあれ ntwitterが必要です
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
var ntwitter = require('ntwitter'); | |
var twi = new ntwitter({ | |
'consumer_key': '', | |
'consumer_secret': '', | |
'access_token_key': '', | |
'access_token_secret': '' | |
}); | |
var my_screen_name = ''; | |
twi.stream('user', function(stream){ | |
stream.on('data', function(data){ | |
if('text' in data && data.text.match('(@' + my_screen_name + ')')){ | |
var name = ''; | |
twi.post('/account/update_profile.json', { | |
'name': name | |
}, function(err, res){ | |
if(!err){ | |
twi.post('/statuses/update.json', { | |
'status': '@' + data.user.screen_name + ' ' + name + 'に改名しました', | |
'in_reply_to_status_id': data.id_str | |
}, function(err, res){ | |
if(!err){ | |
console.log(res); | |
}else{ | |
console.error(err); | |
} | |
}); | |
}else{ | |
console.error(err); | |
} | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment