diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 8a4baaf..63a59d8 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -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'; diff --git a/modules/remind/remind.js b/modules/remind/remind.js index d37b851..bb91e12 100644 --- a/modules/remind/remind.js +++ b/modules/remind/remind.js @@ -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);