Skip to content

Instantly share code, notes, and snippets.

@eblancoh
Last active October 23, 2018 07:34
Show Gist options
  • Save eblancoh/347dd4d117219e9b5da73a1a481984f3 to your computer and use it in GitHub Desktop.
Save eblancoh/347dd4d117219e9b5da73a1a481984f3 to your computer and use it in GitHub Desktop.
bot.dialog('locationBot', [
(session) => {
locationDialog.getLocation(session, {
prompt: "¿Para qué localización desea obtener una predicción?",
useNativeControl: false,
reverseGeocode: false,
skipFavorites: true,
skipConfirmationAsk: true,
requiredFields:
locationDialog.LocationRequiredFields.streetAddress |
locationDialog.LocationRequiredFields.locality |
locationDialog.LocationRequiredFields.region |
locationDialog.LocationRequiredFields.postalCode |
locationDialog.LocationRequiredFields.country
});
},
(session, results, next) => {
if (results.response) {
session.dialogData.place = results.response
session.send(session.dialogData.place.streetAddress + ", " + session.dialogData.place.locality + ", " +
session.dialogData.place.region + ", " + session.dialogData.place.country + " (" + session.dialogData.place.postalCode + ")");
} else {
session.cancelDialog();
}
session.endDialogWithResult({ response: session.dialogData.place });
}
]);
bot.library(locationDialog.createLibrary(BING_MAPS_KEY));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment