Last active
December 27, 2015 13:49
-
-
Save JakubOboza/7336345 to your computer and use it in GitHub Desktop.
mac campfire talking process
This file contains hidden or 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
var exec = require("child_process").execFile; | |
var Campfire = require("./node_modules/campfire").Campfire; | |
var instance = new Campfire({ | |
ssl : true, | |
token : "key", | |
account : "domain" | |
}); | |
instance.join("577834", function(error, room) { | |
room.listen(function(message) { | |
// Ignore emotes, sounds, timestamps, etc. | |
console.log(message.body) | |
console.log("---------") | |
if (message.type != "TextMessage") { | |
return; | |
} | |
// Ignore your own messages. | |
// if (message.user.name == "YOUR_NAME") { | |
// return; | |
// } | |
// Only notify on keywords. | |
// var keywords = ["YOUR_NAME", "URGENT", "Whatever"]; | |
// | |
if (message.body.match(new RegExp(/http/i))) { | |
return; | |
} | |
//var command = "/usr/bin/say "; | |
var args = [ message.body ]; | |
exec("/usr/bin/say", args, { timeout: 50000 }); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment