3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-28 05:32:50 +01:00
This commit is contained in:
reality 2015-01-09 01:43:20 +00:00
parent d732440e3e
commit 5621bad05c
2 changed files with 4 additions and 3 deletions

View File

@ -10,6 +10,7 @@
"bio": null,
"lastfm": null,
"steam": null,
"currency": null,
"goodreads": null,
"favourites": {
"colour": null

View File

@ -18,15 +18,15 @@ var gmaps = function(dbot) {
'key': this.config.api_key,
'oName': from,
'dName': to,
'currencyCode': 'GBP'
'currencyCode': event.rProfile.currency || 'gbp'
},
'json': true
}, function(err, response, body) {
if(!err && body && _.has(body, 'routes') && _.has(body.routes[0], 'duration') && _.has(body.routes[0], 'indicativePrice')) {
var route = body.routes[0];
event.reply('If you left right now, it would take you ' + Math.floor(route.duration / 60) + ' hours and ' +
(route.duration % 60) + ' minutes to get the ' + Math.floor(route.distance) + 'KM from ' + from + ' to ' + to + ', and cost you about £' +
route.indicativePrice.price);
(route.duration % 60) + ' minutes to get the ' + Math.floor(route.distance) + 'KM from ' + from + ' to ' + to + ', and cost you about ' +
route.indicativePrice.price + route.indicativePrice.currency);
} else {
event.reply('Apparently one cannot get from ' + from + ' to ' + to + ' using public transport. Do you accept the challenge?');
}