Skip to content

Instantly share code, notes, and snippets.

View eblancoh's full-sized avatar
馃
Focusing

Enrique Blanco eblancoh

馃
Focusing
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const path = require('path');
const https = require('https');
const restify = require('restify');
const builder = require('botbuilder');
const locationDialog = require('botbuilder-location');
const moment = require('moment-timezone');
const qs = require("querystring");
const BING_MAPS_KEY = 'BING_MAPS_KEY';
// Receive messages from the user and respond by echoing each message back (prefixed with 'You said:')
const bot = new builder.UniversalBot(connector, [
(session, results, next) => {
session.preferredLocale('es', (err) =>聽{
if (err) {
session.error('error');
}
session.send("Bienvenido al Chatbot Eco de Luca");
next();
});
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 |
bot.dialog('locationfavorites', [
(session, results, next) => {
var msg = new builder.Message(session)
.text("驴Desea seleccionar una localizaci贸n predeterminada? Si no, diga o escriba 'no'")
.suggestedActions(
builder.SuggestedActions.create(
session, [
builder.CardAction.postBack(session, "orense_madrid", "Casa"),
builder.CardAction.postBack(session, "gran_via", "Trabajo"),
builder.CardAction.postBack(session, "distrito_telefonica", "Distrito"),
// log any bot errors into the console
bot.on('error', function (e) {
console.log('An error ocurred', e);
});