Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support for non case-sensitive ircd's #70

Closed
wants to merge 4 commits into from

1 participant

@willwh

data.to swapped for data.to.toLowerCase()

willwh and others added some commits
willwh Changed data.to to data.to.toLowerCase() to support IRC servers that …
…are not case sensitive

Added console.log for printing data recieved by the bot to console
c6a7e29
William Hetherington Removed debug; console.log 6f3a055
William Hetherington added feedsub, beginnings of server status for df servers
need to wrap parser in a hook.
stratics config
bd066f0
William Hetherington fixing up 875d657
@willwh willwh closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 8, 2011
  1. Changed data.to to data.to.toLowerCase() to support IRC servers that …

    willwh authored
    …are not case sensitive
    
    Added console.log for printing data recieved by the bot to console
  2. Removed debug; console.log

    William Hetherington authored
Commits on Dec 2, 2011
  1. added feedsub, beginnings of server status for df servers

    William Hetherington authored
    need to wrap parser in a hook.
    stratics config
Commits on Dec 12, 2011
  1. fixing up

    William Hetherington authored
This page is out of date. Refresh to see the latest.
View
1  .gitignore
@@ -1 +1,2 @@
+config.json
node_modules
View
1  bin/kohai 100755 → 100644
@@ -1,5 +1,4 @@
#!/usr/bin/env node
-
var Kohai = require('../lib/kohai').Kohai;
var kohai = new Kohai({
View
105 config.json
@@ -3,28 +3,20 @@
"children": [
"irc",
"twitter",
- "mailer"
+ "mailer",
+ "feedsub"
],
"access": {
"admin": [
- "AvianFlu",
- "Marak",
- "indexzero",
- "hij1nx"
+ "willwh"
],
"employee": [
- "SubStack",
- "bradleymeck",
- "jameson",
- "jesusabdullah",
- "slickplaid"
+ "Goune",
+ "Mifun",
+ "Anubis",
+ "Phineus"
],
- "friend": [
- "isaacs",
- "indutny",
- "ryah",
- "TheJH"
- ]
+ "friend": []
},
"ranks": [
"admin",
@@ -41,26 +33,22 @@
"%% actually looks rather nice today."
],
"help": {
- "password": "To reset your password, type `jitsu users forgot [username]`. To change it, type `jitsu users changepassword`.",
- "handbook": "The complete Nodejitsu handbook can be read at http://github.com/nodejitsu/handbook",
- "support": "If no one is here to help you, type `!support [msg]` to send an email to support@nodejitsu.com.",
- "blog": "Our blog can be viewed at http://blog.nodejitsu.com - a number of tutorials can be found there.",
- "forever": "Run and monitor your node.js processes forever - http://github.com/indexzero/forever",
- "http-proxy": "A robust, full-featured HTTP proxy for Node.js with full websocket support - http://github.com/nodejitsu/node-http-proxy",
- "jitsu": "A CLI tool for deploying your apps to the Nodejitsu hosting platform - http://github.com/nodejitsu/jitsu",
- "hook.io": "A distributed cross-platform namespaced event system using dnode and EventEmitter2 - http://github.com/hookio/hook.io",
- "node-prompt": "An easy-to-use library for getting input from users while your program is running - http://github.com/nodejitsu/node-prompt",
- "gh": "Link to GitHub repositories, issues and commits: `!gh [user]`, `!gh [user]/[project]`, `!gh [user]/[project]@[sha]`, `!gh [user]/[project]#[issue]` are supported",
+ "blog": "http://www.embersofcaerus.com/blog.php",
+ "forum": "http://www.embersofcaerus.com/forum/forum.php",
+ "site": "http://www.forsakenstudios.com/",
"like": "Type !like [drink] to select drink you get when you receive karma"
},
- "irc-server": "irc.freenode.net",
+ "irc-server": "irc.stratics.com",
"port": 6667,
- "nick": "kohai-default",
- "channels": ["#nodebombrange", "#kohai"],
+ "nick": "forsakenbot",
+ "password": "3176df2k11&3@%",
+ "channels": [
+ "#forsakenstudios"
+ ],
"showErrors": "true",
- "userName": "kohai",
- "realName": "the lovable IRC bot",
- "idCheck": true,
+ "userName": "ForsakenBot",
+ "realName": "www.forsakenstudios.com",
+ "idCheck": false,
"channelDefaults": {
"commandString": "!",
"messageCount": 0,
@@ -71,26 +59,55 @@
"rate": 0,
"autoVolume": true,
"active": true,
- "wantsTweets": true
+ "wantsTweets": "true",
+ "wantsRSS": "true"
},
"auth": {
"twitter": {
- "consumer_key": "Public key for Streaming API access",
- "consumer_secret": "Secret key for Streaming API access",
- "access_token_key": "Public key for REST API access",
- "access_token_secret": "Secret key for REST API access"
+ "consumer_key": "A0Rg9zs3fCB7MLbwqFIDYA",
+ "consumer_secret": "oiifN7jQl5NjAC1qMxxUdfgzMX8u8tIuhdwEtnUBh8",
+ "access_token_key": "121676942-TOuet5UnHFTIb9qtsEcbeuEnW6gicfRyvazjGdBy",
+ "access_token_secret": "CuTGNdVTUnN0hHaDJMOK83wzSMNN1oE97t9XNyjq8I"
},
"bitly": {
- "user": "nodejitsu",
- "key": "R_067ef6cdcfc2b223ea26a986395b420c"
+ "user": "ilovedf",
+ "key": "R_1013e8c9107d6c33ee18096f06b77575"
}
},
"track": [
- "Node.js",
- "Nodejitsu",
- "#nodejs",
- "NodeKohai"
+ "forsaken studios",
+ "embers of caerus",
+ "@forsakenstudios"
],
"follow": [],
- "recentTweets": []
+ "recentTweets": [
+ null,
+ null
+ ],
+ "feeds": [
+ {
+ "name": "emberblog",
+ "url": "http://www.embersofcaerus.com/external.php",
+ "interval": 1,
+ "emitOnStart": false
+ }
+ ],
+ "karma": {
+ "values": {
+ "willwh": 9128,
+ "laugh": 1,
+ "Slash_Redhand": 0,
+ "DaveB": 10000,
+ "Yeti": 1,
+ "forsakenbot": 0,
+ "Kirst": 1,
+ "Kristy": 0,
+ "Wulvgar": 1
+ },
+ "preferences": {
+ "willwh": "elephant",
+ "Slash_Redhand": "apples",
+ "[WSX]Thradok": "water"
+ }
+ }
}
View
8 lib/comments.js
@@ -9,16 +9,16 @@
var comments = module.exports = function (data) {
switch(true) {
- case /\bkohai\b.*\bbot\b.*/i.test(data.text):
+ case /\bforsakenbot\b.*\bbot\b.*/i.test(data.text):
this.emit('sendMsg', {
dest: data.to,
msg: '\'Bot\' is a derogatory term, and I\'m offended.'
});
break;
- case /.*\bkohai:(?:\s|$).*/i.test(data.text):
+ case /.*\bforsakenbot:(?:\s|$).*/i.test(data.text):
this.emit('sendMsg', {
dest: data.to,
- msg: 'I am Kohai, semi-useful communications-facilitating pseudointelligence!'
+ msg: 'I am forsakenbot, semi-useful MMO communications-facilitating pseudointelligence!'
});
break;
default:
@@ -26,4 +26,4 @@ var comments = module.exports = function (data) {
break;
}
-}
+}
View
21 lib/kohai.js
@@ -54,9 +54,9 @@ Kohai.prototype.gotMessage = function (data) {
var idCheck = this.idCheck ? '\\+' : '',
trigger = new RegExp('^'
+ idCheck
- + this.channels[data.to].commandString
+ + this.channels[data.to.toLowerCase()].commandString
+ '\\w+\\s?\\w*.*');
- this.channels[data.to].messageCount++;
+ this.channels[data.to.toLowerCase()].messageCount++;
if (trigger.test(data.text)) {
this.checkAuth(data);
}
@@ -91,7 +91,7 @@ Kohai.prototype.checkAuth = function (data) {
}
});
});
- if (data.to === self.nick) {
+ if (data.to.toLowerCase() === self.nick) {
return self._dispatchPM(data);
}
return self._dispatcher(data);
@@ -100,8 +100,8 @@ Kohai.prototype.checkAuth = function (data) {
Kohai.prototype._dispatcher = function (data) {
var self = this,
replace = self.idCheck
- ? '+' + self.channels[data.to].commandString
- : self.channels[data.to].commandString,
+ ? '+' + self.channels[data.to.toLowerCase()].commandString
+ : self.channels[data.to.toLowerCase()].commandString,
command = data.text.replace(replace, '').split(' ');
if ((command[0] !== 'config')&&(typeof triggers[command[0]] !== 'undefined')) {
triggers[command[0]].call(self, data, command);
@@ -118,7 +118,7 @@ Kohai.prototype._dispatchPM = function (data) {
triggers[command[0].slice(1)].call(this, data, command);
}
else if (typeof triggers[command[0]] !== 'undefined') {
- data.to = data.nick;
+ data.to = data.nick.toLowerCase();
triggers[command[0]].call(this, data, command);
}
}
@@ -132,6 +132,7 @@ Kohai.prototype.checkComment = function (data) {
comments.call(this, data);
}
+
Kohai.prototype.sayTweet = function (data) {
var self = this;
Object.getOwnPropertyNames(self.channels).forEach(function (channel) {
@@ -144,3 +145,11 @@ Kohai.prototype.sayTweet = function (data) {
});
}
+Kohai.prototype.sayRSS = function (data) {
+ var self = this;
+ Object.getOwnPropertyNames(self.channels).forEach(function (channel) {
+ if (self.channels[channel].wantsRSS === 'true') {
+ self.emit('sendMsg', {dest: channel, msg: data});
+ }
+ });
+}
View
15 lib/listeners/feedsub.js
@@ -0,0 +1,15 @@
+/*
+ *
+ * listeners/feedsub.js - Event listeners for Hook.io-feedsub.
+ *
+ *
+ * Written by willwh.
+ *
+ */
+
+var feedsub = module.exports = function () {
+ var self = this;
+ self.on('feedsub::*::item', function (data) {
+ self.sayRSS(data.title + ' - ' + data.link);
+ });
+};
View
44 lib/listeners/pars0r.js
@@ -0,0 +1,44 @@
+var select = require('soupselect').select,
+ htmlparser = require("htmlparser"),
+ http = require('http'),
+ util = require('util');
+
+// fetch some HTML...
+var http = require('http');
+var host = 'www.us1.darkfallonline.com';
+var client = http.createClient(80, host);
+var request = client.request('GET', '/news/',{'host': host});
+
+request.on('response', function (response) {
+ response.setEncoding('utf8');
+
+ var body = "";
+ response.on('data', function (chunk) {
+ body = body + chunk;
+ });
+
+ response.on('end', function() {
+
+ // now we have the whole body, parse it and select the nodes we want...
+ var handler = new htmlparser.DefaultHandler(function(err, dom) {
+ if (err) {
+ util.debug("Error: " + err);
+ } else {
+
+ // soupselect happening here...
+ var accesslvl = select(dom, 'img');
+ if(accesslvl.indexOf("players_online" !=-1)) {
+ util.puts("US1: Online for players");
+ }
+ else {
+ util.puts("US1: Offline for players");
+ }
+
+ }
+ });
+
+ var parser = new htmlparser.Parser(handler);
+ parser.parseComplete(body);
+ });
+});
+request.end();
View
4 lib/plugins/support.js
@@ -13,8 +13,8 @@ var support = module.exports = function (data, command) {
source = ' [' + data.nick + ']';
emailOptions = {
- to : 'support@nodejitsu.com',
- from : 'kohai@nodejitsu.com',
+ to : 'admin@ilovedarkfall.com',
+ from : 'kohai@ilovedarkfall.com',
subject : '[IRC]' + source,
body : new Date() + ' ' + msg
};
View
5 lib/triggers.js
@@ -121,9 +121,10 @@ var triggers = module.exports = {
+ ' has exceeded specified telemetry parameters. Irrevocable '
+ timer + ' second mute has been initiated.'
});
- self.emit('command', 'mode ' + dest + ' +q ' + command[1]);
+ self.emit('command', 'mode' + dest + ' +b ' + command[1]);
+ console.log('command', 'mode' + dest + ' +b ' + command[1]);
setTimeout(function () {
- self.emit('command', 'mode ' + dest + ' -q ' + command[1]);
+ self.emit('command', 'mode' + dest + ' -b ' + command[1]);
self.emit('sendMsg', {
dest: dest,
msg: 'Noobosity telemetry data now below thresholds. Removing mute for ' + command[1] + '.'
View
3  package.json
@@ -16,7 +16,8 @@
"colors": "0.5.x",
"hook.io-irc": "0.4.x",
"hook.io-twitter": "0.2.x",
- "hook.io-mailer": "0.3.x"
+ "hook.io-mailer": "0.3.x",
+ "hook.io-feedsub": "0.1.x"
},
"engines": {
"node": ">= 0.4.x < 0.7.x"
Something went wrong with that request. Please try again.