Created
September 25, 2011 06:25
-
-
Save robbiet480/1240298 to your computer and use it in GitHub Desktop.
Robbie's Handy Dandy Twitter Streaming API to IRC Bot
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
//Robbie's handy dandy, super annoying, Twitter Streaming API To IRC bot! | |
//Just change all the settings to your liking. You could also repurpose this to send to places other then IRC | |
//npm install jerk twitter-node | |
var TwitterNode = require('twitter-node').TwitterNode, | |
jerk = require('jerk') | |
, sys = require('sys') | |
var options = | |
{ server: 'irc.freenode.net' | |
, nick: 'RobbieBot' | |
, channels: [ '#acemonstertoys' ] | |
} | |
var twit = new TwitterNode({ | |
user: 'YOURUSERNAME', | |
password: 'YOURPASSWORD', | |
track: ['apple', 'iphone 5'], // comma separated keywords, including hashtags and @users! | |
follow: ['47619'], // follow these random users (user id, NOT name) | |
}); | |
twit.addListener('error', function(error) { | |
console.log(error.message); | |
}); | |
var j = jerk( function(j) {} ).connect( options ) | |
twit | |
.addListener('tweet', function(tweet) { | |
sys.puts('@' + tweet.user.screen_name + ': ' + tweet.text); | |
var tweetURL = "http://twitter.com/#!/"+tweet.user.screen_name+"/status/"+tweet.id_str; | |
j.say('#acemonstertoys','@' + tweet.user.screen_name + ': ' + tweet.text + ' ' + tweetURL); | |
}) | |
.addListener('limit', function(limit) { | |
sys.puts('LIMIT: ' + sys.inspect(limit)); | |
}) | |
.addListener('delete', function(del) { | |
sys.puts('DELETE: ' + sys.inspect(del)); | |
}) | |
.addListener('end', function(resp) { | |
sys.puts('wave goodbye... ' + resp.statusCode); | |
}) | |
.stream(); | |
twit.stream(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment