Skip to content

Instantly share code, notes, and snippets.

@ikr7
Last active August 29, 2015 14:10
Show Gist options
  • Save ikr7/7ddcd93f88a4d425892b to your computer and use it in GitHub Desktop.
Save ikr7/7ddcd93f88a4d425892b to your computer and use it in GitHub Desktop.
var Command = require('../lib/command.js');
var delay = function(tweet){
return tweet.text.length / 2 * 1000; //ms
};
var destroy = new Command(function(oauth, tweet, CONFIG){
var id = tweet.id_str;
// #keep って入ってたら消さない
if(tweet.text.indexOf('#keep') !== -1){
return;
}
setTimeout(function(){
oauth.post('/statuses/destroy/' + id + '.json', function(err, res){
if(!err){
console.log('Deleted \"', res.text, '\"');
}
});
}, delay(tweet));
});
destroy.setTrigger(function(data, CONFIG){
return data.user && data.user.screen_name === CONFIG.MY_SCREEN_NAME;
});
destroy.setPermission({
'me': true,
'following': true,
'others': true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment