Skip to content

Instantly share code, notes, and snippets.

@deoxxa
Created January 11, 2011 07:31
Show Gist options
  • Save deoxxa/774161 to your computer and use it in GitHub Desktop.
Save deoxxa/774161 to your computer and use it in GitHub Desktop.
twitter irc bot thing
var tn = require("twitter-node");
var irc = require("irc");
var sys = require("sys");
var client = new irc.Client("irc.wtfirc.com", "FloodBot", { channels: ["#bris2600"] });
client.addListener("message", function(from, to, message) {
sys.puts(from + " => " + to + ": " + message);
});
client.addListener("error", function(error) {
console.log("IRC Error: " + error.message);
});
var twit = new tn.TwitterNode({ user: "<username>", password: "<password>" });
twit.track("#bnefloods");
twit.addListener("error", function(error) {
console.log("Twitter Error: " + error.message);
});
twit.addListener("tweet", function(tweet) {
sys.puts("@" + tweet.user.screen_name + ": " + tweet.text);
if (!tweet.text.match(/rt/i)) {
client.say("#bris2600", "@" + tweet.user.screen_name + ": " + tweet.text);
}
});
twit.addListener("limit", function(limit) {
sys.puts("LIMIT: " + sys.inspect(limit));
});
twit.addListener("delete", function(del) {
sys.puts("DELETE: " + sys.inspect(del));
});
twit.addListener("end", function(resp) {
sys.puts("END: " + resp.statusCode);
});
twit.stream();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment