Exemple #1
0
 main: async message => {
   const s = Sherlock.parse(message.content);
   const relative = s.startDate.getTime() - Date.now();
   s.eventTitle = s.eventTitle.replace(/^me to ?|^me ?|^to ?/, '');
   message.channel.send(`I will remind you to ${s.eventTitle} ${moment().add(relative, 'ms').fromNow()}.`);
   setTimeout(() => {
     let final = `**REMINDER:** ${s.eventTitle}`;
     message.author.send(final).catch(() => message.channel.send(`${message.author} ${final}`));
   }, relative);
 },
Exemple #2
0
  function sherlockNParse (value) {
    var parsed = Sherlock.parse(value)

    if (parsed.startDate) {
      scope[attrs.start] = parsed.startDate 
    }

    if (parsed.endDate) {
      scope[attrs.end] = parsed.endDate
    }
  }
Exemple #3
0
        'LeavingIntent': function () {
            if (this.event.request.dialogState == "STARTED" || this.event.request.dialogState == "IN_PROGRESS") {
                this.context.succeed({
                    "response": {
                        "directives": [
                            {
                                "type": "Dialog.Delegate"
                            }
                        ],
                        "shouldEndSession": false
                    },
                    "sessionAttributes": this.attributes
                });
            } else {
		console.log(JSON.stringify(this.event.request.intent.slots.TIME, null, 3));
                let expected_time_string = this.event.request.intent.slots.TIME.value;
		console.log("expected_time_string: " + expected_time_string + "\n");
                let expected_time = null; 
		let parsed = Sherlock.parse(expected_time_string);
		expected_time = parsed.startDate;
		if(expected_time !== null) {
			try {
				expected_time = new moment(expected_time);
			} catch(err) {
				console.log(err);
				expected_time = null;
			}
		}
                if(expected_time === null) {
                    this.emit(':tell', "LogMyPos was unable to log your leaving time.");
                } else {
                    tracker.setLimit(expected_time);
                    this.emit(':tell', tracker.getStatus())
                }
            }
        },