Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	lib/damon/weather.js
  • Loading branch information...
2 parents fc83f68 + eb5c7a3 commit f36f2f1ea7636ddd210f32b70b4460231f5fbf35 @ram-nadella committed Sep 12, 2011
Showing with 45 additions and 11 deletions.
  1. +3 −3 lib/damon/basic.js
  2. +16 −0 lib/damon/command.js
  3. +1 −1 lib/damon/food.js
  4. +8 −0 lib/damon/help.js
  5. +4 −1 lib/damon/index.js
  6. +7 −0 lib/damon/learn.js
  7. +2 −2 lib/damon/weather.js
  8. +3 −3 lib/index.js
  9. +1 −1 package.json
View
@@ -1,4 +1,4 @@
-module.exports = exports = function() {
+module.exports = exports = function(damonbot) {
var funny = [
'Chris is infesting something. It might be my brain.',
@@ -19,15 +19,15 @@ module.exports = exports = function() {
var concluded = false;
if(message.data.body.indexOf('joke') !== -1 || message.data.body.indexOf('funny') !== -1) {
- message.respond(funny[Math.floor(Math.random() * 4)]);
+ message.respond(funny[Math.floor(Math.random() * funny.length)]);
concluded = true;
}
if(!concluded) {
if(message.data.body.indexOf('?') !== -1)
message.respond("Sorry, " + message.data.sender.name + ", but I'm not smart enough to know how to help you yet. Help make me smarter by forking me at http://github.com/cdata/damonbot!");
else
- message.respond(general[Math.floor(Math.random() * 4)].replace('$1', message.data.sender.name));
+ message.respond(general[Math.floor(Math.random() * general.length)].replace('$1', message.data.sender.name));
}
}
}
View
@@ -0,0 +1,16 @@
+var vm = require('vm');
+
+exports = module.exports = function(damonbot) {
+
+ damonbot.api = damonbot.api || {};
+
+ return function(message, next) {
+
+ var commandChecker = /^damonbot.([a-zA-Z]*)\((.*)\);/;
+
+ if(commandChecker.test(message.body))
+ vm.runInNewContext(message.body, damonbot.api);
+ else
+ next();
+ };
+};
View
@@ -1,6 +1,6 @@
var twitter = require('../augmentation/twitter');
-module.exports = exports = function() {
+module.exports = exports = function(damonbot) {
return function(message, next) {
View
@@ -0,0 +1,8 @@
+exports = module.exports = function(damonbot) {
+
+ damonbot.help = damonbot.help || {};
+
+ return function(message, next) {
+
+ };
+};
View
@@ -1,3 +1,6 @@
exports.basic = require('./basic');
exports.food = require('./food');
-exports.weather = require('./weather')
+exports.weather = require('./weather')
+exports.learn = require('./learn');
+exports.command = require('./command');
+exports.help = require('./help');
View
@@ -0,0 +1,7 @@
+exports = module.exports = function(damonbot) {
+
+ return function(message, next) {
+
+ next();
+ };
+};
@@ -35,5 +35,5 @@ module.exports = exports = function() {
} else {
next();
}
- }
-}
+ };
+};
View
@@ -2,7 +2,7 @@ var multibot = require('multibot'),
damon = require('./damon');
exports = module.exports = multibot(
- damon.food(),
- damon.basic(),
- damon.weather()
+ damon.weather,
+ damon.food,
+ damon.basic
);
View
@@ -12,7 +12,7 @@
},
"dependencies" : {
"multibot" : "~0.0.1",
- "xml2js" : "0.1.x"
+ "xml2js" : "~0.1.0"
},
"devDependencies" : {}
}

0 comments on commit f36f2f1

Please sign in to comment.