Skip to content

Instantly share code, notes, and snippets.

@ikr7
Last active December 27, 2015 15:59
Show Gist options
  • Save ikr7/7352270 to your computer and use it in GitHub Desktop.
Save ikr7/7352270 to your computer and use it in GitHub Desktop.
sasamijpのあれ ntwitterが必要です
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