/* Seen command
 * by jd and panpawn
 */

var fs = require('fs');
var moment = require('moment');

var seenData = {};
function loadData() {
	try {
		seenData = JSON.parse(fs.readFileSync('config/seenData.json', 'utf8'));
	} catch (e) {
		seenData = {};
	}
}
loadData();

function saveData() {
	fs.writeFileSync('config/seenData.json', JSON.stringify(seenData));
}

function updateSeen(userid) {
	if (!userid) return false;
	seenData[toId(userid)] = Date.now();
	saveData();
}
global.updateSeen = updateSeen;

var day = 60 
exports.commands = {
	seen: function (target, room, user) {
		try {
			if (!this.canBroadcast()) return;
			var userid = toId(target);
			if (userid.length < 1) return this.sendReply("/seen - Please specify a name.");
			if (Users(target) && Users(target).connected) return this.sendReplyBox(Tools.escapeHTML(target) + " is currently <font color=\"green\">online</green>.");
			if (!seenData[userid]) return this.sendReplyBox(Tools.escapeHTML(target) + " has <font color=\"red\">never</font> been seen online.");
			var date = new Date(seenData[userid]);
			var text = moment(seenData[userid]).format("MMMM Do YYYY, h:mm:ss a")
			this.sendReplyBox("The user " + Tools.escapeHTML(target) + " was last seen online " + text + " EST.");
		} catch (e) {
			return this.sendReply("Something failed: \n" + e.stack);
		}
	}
};

@@ -584,16 +584,337 @@
 %09%09try %7B%0A
+%09%09%09switch (target) %7B%0A%09%09%09%09case 'obj':%0A%09%09%09%09%09if (this.broadcasting) return this.sendReply(%22ERROR: this command is too spammy to broadcast.  Use / instead of ! to see it for yourself.%22);%0A%09%09%09%09%09this.sendReplyBox(%22There have been %22 + Object.size(seenData) + %22 user names recorded in this database.%22);%0A%09%09%09%09%09break;%0A%09%09%09%09default:%0A%09%09
 %09%09%09if (!
@@ -942,16 +942,18 @@
 return;%0A
+%09%09
 %09%09%09var u
@@ -974,16 +974,18 @@
 arget);%0A
+%09%09
 %09%09%09if (u
@@ -1058,24 +1058,26 @@
 name.%22);%0A%09%09%09
+%09%09
 if (Users(ta
@@ -1221,16 +1221,18 @@
 .%22);%0A%09%09%09
+%09%09
 if (!see
@@ -1357,24 +1357,26 @@
 line.%22);%0A%09%09%09
+%09
+%09
 var date = n
@@ -1402,16 +1402,18 @@
 erid%5D);%0A
+%09%09
 %09%09%09var t
@@ -1477,16 +1477,18 @@
 :ss a%22)%0A
+%09%09
 %09%09%09this.
@@ -1585,16 +1585,21 @@
 EST.%22);%0A
+%09%09%09%7D%0A
 %09%09%7D catc

Update seen.js