helpful output

This commit is contained in:
reality 2016-01-15 23:22:59 +00:00
parent dc00730168
commit 8c06ec9dcf
2 changed files with 9 additions and 2 deletions

View File

@ -21,7 +21,9 @@ var commands = function(dbot) {
var msTimeout = new Date(new Date().getTime() + (parseFloat(duration) * 60000));
if(_.has(dbot.modules, 'remind')) {
msTimeout = dbot.api.remind.parseTime(duration);
event.reply(msTimeout);
if(!msTimeout) {
return event.reply('Invalid time. Remember you must give e.g. 5m now.');
}
duration = duration.replace(/([\d]+)d/, '$1 days').replace(/([\d]+)h/, '$1 hours ').replace(/([\d]+)m/, '$1 minutes ').replace(/([\d]+)s/, '$1 seconds');
} else {
duration += ' minutes';
@ -176,6 +178,9 @@ var commands = function(dbot) {
var msTimeout = new Date(new Date().getTime() + (parseFloat(timeout) * 3600000));
if(_.has(dbot.modules, 'remind')) {
msTimeout = dbot.api.remind.parseTime(timeout);
if(!msTimeout) {
return event.reply('Invalid time. Remember you must give e.g. 5m now.');
}
timeout = timeout.replace(/([\d]+)d/, '$1 days').replace(/([\d]+)h/, '$1 hours ').replace(/([\d]+)m/, '$1 minutes ').replace(/([\d]+)s/, '$1 seconds');
} else {
timeout += ' hours';

View File

@ -15,7 +15,6 @@ var remind = function(dbot) {
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;
@ -43,6 +42,9 @@ var remind = function(dbot) {
}.bind(this),
'doReminder': function(event,user,time,message) {
var then = this.api.parseTime(time);
if(!then) {
return event.reply("The time parameter was not a valid time mah boy, it was "+time);
}
if(dbot.config.debugMode)
event.reply("The timer will be at "+then);