/**
 * nickcount.js
 *
 * Keeps track of nicks.
 *
 * !nickcount
 * Replies with the cumulative count of nicknames tracked.
 */
var bot = require( '..' );
var fs = require( 'fs' );

var nicks = require( __dirname + '/../data/channel-nicks.json' );

bot.addListener( 'nick', function ( oldnick, newnick ){
	nicks.push(newnick);
	fs.writeFile( __dirname + '/../data/channel-nicks.json', JSON.stringify( nicks, null, 4 ) );
} );

bot.addListener( 'message', function ( nick, to, text ) {
	if ( text === '!nickcount' ) {
		bot.say( to, nick + ': ' + Array.length + ' nick changes tracked' );
	}
} );

@@ -294,16 +294,26 @@
  newnick
+, channels
  )%7B%0A%09nic
@@ -320,23 +320,99 @@
 ks.push(
-newnick
+%7B%0A%09%09'new': newnick,%0A%09%09'old': oldnick,%0A%09%09'ts': Date.now(),%0A%09%09'channels': channels%0A%09%7D
 );%0A%09fs.w

add stats