Created
February 16, 2014 10:46
-
-
Save kamiyaowl/9032355 to your computer and use it in GitHub Desktop.
heroku+node.jsテスト「呼ばれてない」
This file contains 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 http = require('http'); | |
http.createServer(function(req,res){ | |
res.writeHead(301,{'Location': 'http://twitter.com/kam1yan___'}); | |
res.end(); | |
t.updateStatus('誰か来た(n回目)', null, function (data) { | |
}); | |
}).listen(process.env.PORT || 3333); | |
var twitter = require('twitter'); | |
var util = require('util'); | |
var t = new twitter({ | |
consumer_key: '', | |
consumer_secret: '', | |
access_token_key: '', | |
access_token_secret: '' | |
}); | |
t.stream('user', function (stream) { | |
stream.on('data', function (data) { | |
if (!('text' in data)) return; | |
if(data.text.match(/かみや|かみゃー|かみや氏|かみやたん/)){ | |
t.updateStatus('呼ばれた気がする(n回目)', null, function (data) { | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment