Skip to content

Commit

Permalink
Added an example of a catchall function.
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickTulskie committed Apr 7, 2011
1 parent 5a92d35 commit 1a7665e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 15 additions & 0 deletions examples/catchall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var marshmallow = require("../lib/marshmallow").marshmallow;

var config = {
token: process.env["CAMPFIRE_TOKEN"],
account: process.env["CAMPFIRE_ACCOUNT"],
ssl: process.env["CAMPFIRE_SSL"] == "true",
room_id: process.env["CAMPFIRE_ROOM"]
};

marshmallow(config, function(bot) {
// Reverse everything everyone says
bot.on('catchAll', function(rawMessage) {
this.speak(rawMessage.body.split(" ").reverse.join(" "));
});
});
4 changes: 1 addition & 3 deletions examples/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ marshmallow(config, function(bot) {
bot.on("^!ping", function(ping) {
this.speak("pong!");
});
});


});

0 comments on commit 1a7665e

Please sign in to comment.