/** * Module Name: Remind * Description: Reminds you */ var crypto = require('crypto'), moment = require('moment'), _ = require('underscore')._; var remind = function(dbot) { var self = this; this.internalAPI = { 'getSeconds': function(number,interval) { switch(interval) { case "d": return number*24*60*60; case "h": return number*60*60; case "m": return number*60; case "s": return number; } }.bind(this), 'doReminder': function(event,user,time,message) { 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