Skip to content

Instantly share code, notes, and snippets.

@squeeks
Created March 19, 2011 02:06
Show Gist options
  • Save squeeks/877150 to your computer and use it in GitHub Desktop.
Save squeeks/877150 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
/*
* Bullshit Bingo Bot.
* 1) Fix the configuration to your liking and run
* 2) Use "!bullshit" and the word you want on the pile
* 3) ????
* 4) BINGO!
*
* Send complaints, cheques or anthrax to privacymyass@gmail.com.
*
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
/*
* Configuration
*/
var ircServer = "irc.efnet.net";
var ircChannels = ["#seo"];
var ircNick = "bingobot";
// After this point, you break it, you buy it.
var irc = require("irc");
var sys = require("sys");
var noBullshit = true;
var bullshit = {};
var client = new irc.Client(ircServer, ircNick, { channels: ircChannels });
client.addListener("message", function(nick, channel, message) {
if(message.match(/^!bullshit/) && Object.keys(bullshit).length < 9) {
bullshitMatch = message.match(/!bullshit (.*)$/);
bullshit[bullshitMatch[1]] = 0;
noBullshit = false;
sys.puts(bullshitMatch[1] + ' is bullshit');
} else if(!noBullshit && Object.keys(bullshit).length >= 3) {
for(shit in bullshit) {
if(message.match(shit)){
delete bullshit[shit];
}
}
if(Object.keys(bullshit).length == 0) {
client.say(channel, nick + ': BINGO!');
sys.puts(channel + ' - ' + nick ' - BINGO!');
noBullshit = true;
}
}
});
client.addListener("error", function(error) {
console.log("IRC Error: " + error.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment