Skip to content

Commit

Permalink
scaffolding for arrival time
Browse files Browse the repository at this point in the history
  • Loading branch information
shuw committed Apr 26, 2016
1 parent 5364fc3 commit 3429c22
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ const listStops = (sessionId, context, cb) => {
);
}

const getArrivalTime = (sessionId, context, cb) => {
context.arrival_time = '8 minutes';
cb(context);
setTimeout(() => {
const recipientId = sessions.get(sessionId).fbid;
fbMessage(
recipientId,
"Your bus will be delayed by 5 minutes, and is arriving in 13 minutes."
);
}, 5 * 1000);
}

// Our bot actions
module.exports = {

Expand Down Expand Up @@ -97,11 +109,18 @@ module.exports = {
if (loc) {
context.loc = loc;
}

if (context.stops) {
context.stop_choice = firstEntityValue(entities, 'number');
}

cb(context);
},

'list-stops': listStops,

'get-arrival-time': getArrivalTime,

error: (sessionId, context, error) => {
console.log(error.message);
},
Expand Down

0 comments on commit 3429c22

Please sign in to comment.