forked from pneff/SkypeBot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempting damonbot => multibot abstraction
- Loading branch information
Christopher Joel
committed
Aug 26, 2011
1 parent
48f97e2
commit 5b76d49
Showing
4 changed files
with
30 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
var skype = require('./bridge'), | ||
log = require('./log'), | ||
bot = require('./bot'); | ||
var log = require('./log'), | ||
bridge = require('./bridge'); | ||
|
||
exports.run = function() { | ||
exports = module.exports = function() { | ||
|
||
var bridge = skype.createBridge(), | ||
damon = bot.createBot(); | ||
var handlers = Array.prototype.slice.call(arguments), | ||
interface = bridge.createBridge(); | ||
|
||
bridge.on( | ||
interface.on( | ||
'message', | ||
function(message) { | ||
|
||
log('Received message from ' + message.data.sender.name + ': "' + message.data.body + '"'); | ||
if(message.data.body.match(/^damonbot/i)) | ||
damon.parse(message); | ||
(function(index) { | ||
|
||
var next = arguments.callee; | ||
|
||
if(index < handlers.length) | ||
handlers[index](message, function() { next(index + 1); }); | ||
})(0); | ||
} | ||
); | ||
|
||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
{ | ||
"author": "Christopher Joel <chris@cloudflare.com> (http://www.cloudflare.com)", | ||
"name": "damonbot", | ||
"description": "Damonbot is a Skype chatbot", | ||
"version": "0.0.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/cdata/damonbot.git" | ||
"author" : "Christopher Joel <chris@cloudflare.com> (http://www.cloudflare.com)", | ||
"name" : "multibot", | ||
"description" : "Multibot is a universal chatbot framework.", | ||
"version" : "0.0.1", | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "git://github.com/cdata/damonbot.git" | ||
}, | ||
"engines": { | ||
"node": "~0.4.10" | ||
"engines" : { | ||
"node" : "~0.4.10" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
"dependencies" : { | ||
"optimist" : "~0.2.6", | ||
"websocket-server" : "~1.4.04" | ||
}, | ||
"devDependencies" : {} | ||
} |