Skip to content

Instantly share code, notes, and snippets.

@setkeh
Last active March 24, 2016 15:54
Show Gist options
  • Save setkeh/dc3c3172c24fcf998b0f to your computer and use it in GitHub Desktop.
Save setkeh/dc3c3172c24fcf998b0f to your computer and use it in GitHub Desktop.
gitter.js test
var Gitter = require("node-gitter");
var gitter = new Gitter(apitokenhere);
gitter.currentUser()
.then(function(user) {
console.log("Your are logged in as:", user.username);
});
var roomId = roomidhere;
gitter.rooms.find(roomId)
.then(function(room) {
var events = room.streaming().chatMessages();
var fs = require('fs');
for (var i = 0; i < events.Length; i++)
{
var eString = events[i];
fs.appendFile('/tmp/test', eString, function (err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
}
console.log(events);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment