/** * Module Name: Remind * Description: Reminds you */ var crypto = require('crypto'), moment = require('moment'), _ = require('underscore')._; var remind = function(dbot) { var self = this; this.api = { 'parseTime': function(time) { var now = Date.now(); var datesplits = time.match(/[0-9]+[dhms]/g); if(datesplits == null) { event.reply("The time parameter was not a valid time mah boy, it was "+time); return; } var timeinseconds = 0; for(var i=0;i 0) { var output = ''; _.each(reminders, function(reminder, i) { output += (i+1) + ': "' + reminder.message + '" in ' + moment(reminder.time).toNow(true) + '. '; }); event.reply('You have ' + _.size(reminders) + ' active reminders. ' + output); } else { event.reply('You have no currently active timers.'); } } }; this.onLoad = function() { if(!dbot.db.remindTimers) { dbot.db.remindTimers = {}; return; } for(var i=0;i