Remind now supports messages with spaces and calls the user reminding you

This commit is contained in:
amki 2015-04-05 19:48:47 +02:00
parent 448309dc37
commit 7ac7817101

View File

@ -37,10 +37,19 @@ var remind = function(dbot) {
event.reply("The timer will be at "+then); event.reply("The timer will be at "+then);
} }
var cb = function() { var cb = function() {
if(message) if(message) {
event.reply(user+": This is your reminder. You left a message: "+message); if(event.user === user) {
else event.reply(user+": This is your reminder. You left a message: "+message);
event.reply(user+": This is your reminder. You did not leave a message."); } else {
event.reply(user+": This is your reminder. "+event.user+" left a message: "+message);
}
} else {
if(event.user === user) {
event.reply(user+": This is your reminder. You did not leave a message.");
} else {
event.reply(user+": This is your reminder. "+event.user+" did not leave a message.");
}
}
}; };
dbot.api.timers.addTimeout(then,cb,null); dbot.api.timers.addTimeout(then,cb,null);
if(message) if(message)
@ -56,14 +65,14 @@ var remind = function(dbot) {
event.reply("You need to give me a user and time dude."); event.reply("You need to give me a user and time dude.");
return; return;
} }
this.internalAPI.doReminder(event,event.params[1],event.params[2],event.params[3]); this.internalAPI.doReminder(event,event.params[1],event.params[2],event.params.splice(3, event.params.length-1).join(' ').trim());
}, },
'~remindme': function(event) { '~remindme': function(event) {
if(event.params.length < 2) { if(event.params.length < 2) {
event.reply("You need to give me a time dude."); event.reply("You need to give me a time dude.");
return; return;
} }
this.internalAPI.doReminder(event,event.user,event.params[1],event.params[2]); this.internalAPI.doReminder(event,event.user,event.params[1],event.params.splice(2, event.params.length-1).join(' ').trim());
} }
}; };
}; };