forked from GitHub/dbot
helpful output
This commit is contained in:
parent
dc00730168
commit
8c06ec9dcf
@ -21,7 +21,9 @@ var commands = function(dbot) {
|
|||||||
var msTimeout = new Date(new Date().getTime() + (parseFloat(duration) * 60000));
|
var msTimeout = new Date(new Date().getTime() + (parseFloat(duration) * 60000));
|
||||||
if(_.has(dbot.modules, 'remind')) {
|
if(_.has(dbot.modules, 'remind')) {
|
||||||
msTimeout = dbot.api.remind.parseTime(duration);
|
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');
|
duration = duration.replace(/([\d]+)d/, '$1 days').replace(/([\d]+)h/, '$1 hours ').replace(/([\d]+)m/, '$1 minutes ').replace(/([\d]+)s/, '$1 seconds');
|
||||||
} else {
|
} else {
|
||||||
duration += ' minutes';
|
duration += ' minutes';
|
||||||
@ -176,6 +178,9 @@ var commands = function(dbot) {
|
|||||||
var msTimeout = new Date(new Date().getTime() + (parseFloat(timeout) * 3600000));
|
var msTimeout = new Date(new Date().getTime() + (parseFloat(timeout) * 3600000));
|
||||||
if(_.has(dbot.modules, 'remind')) {
|
if(_.has(dbot.modules, 'remind')) {
|
||||||
msTimeout = dbot.api.remind.parseTime(timeout);
|
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');
|
timeout = timeout.replace(/([\d]+)d/, '$1 days').replace(/([\d]+)h/, '$1 hours ').replace(/([\d]+)m/, '$1 minutes ').replace(/([\d]+)s/, '$1 seconds');
|
||||||
} else {
|
} else {
|
||||||
timeout += ' hours';
|
timeout += ' hours';
|
||||||
|
@ -15,7 +15,6 @@ var remind = function(dbot) {
|
|||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var datesplits = time.match(/[0-9]+[dhms]/g);
|
var datesplits = time.match(/[0-9]+[dhms]/g);
|
||||||
if(datesplits == null) {
|
if(datesplits == null) {
|
||||||
event.reply("The time parameter was not a valid time mah boy, it was "+time);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var timeinseconds = 0;
|
var timeinseconds = 0;
|
||||||
@ -43,6 +42,9 @@ var remind = function(dbot) {
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
'doReminder': function(event,user,time,message) {
|
'doReminder': function(event,user,time,message) {
|
||||||
var then = this.api.parseTime(time);
|
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)
|
if(dbot.config.debugMode)
|
||||||
event.reply("The timer will be at "+then);
|
event.reply("The timer will be at "+then);
|
||||||
|
Loading…
Reference in New Issue
Block a user