Skip to content

Instantly share code, notes, and snippets.

@ikr7
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikr7/dc53c2fc0574c386d345 to your computer and use it in GitHub Desktop.
Save ikr7/dc53c2fc0574c386d345 to your computer and use it in GitHub Desktop.
ツイート読み上げ
var Command = require('../lib/command.js'),
exec = require('child_process').exec,
MeCab = require('mecab-async'),
mecab = new MeCab();
var say = new Command(function(twit, status, CONFIG){
if(status.retweeted_status) status = status.retweeted_status;
mecab.parse(status.text, function(err, result){
if(!err){
var kana = result.map(function(e){
return e[8];
}).join('');
exec('say ' + status.user.screen_name, function(){
exec('saykana -s 180 \"' + kana + '\"');
})
}
});
});
say.setTrigger(function(data, CONFIG){
return 'text' in data;
});
say.setPermission({
'me': true,
'following': true,
'others': true
});
module.exports = say;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment