Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
Last active December 27, 2015 13:49
Show Gist options
  • Save JakubOboza/7336345 to your computer and use it in GitHub Desktop.
Save JakubOboza/7336345 to your computer and use it in GitHub Desktop.
mac campfire talking process
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