From 2577f47504628bcfe88d8e73fc0d187352803815 Mon Sep 17 00:00:00 2001 From: Rafael Arenario Pereira da Silva Date: Sat, 18 Aug 2018 23:10:33 -0300 Subject: [PATCH] =?UTF-8?q?Ajustes=20para=20corrigir=20o=20problema=20de?= =?UTF-8?q?=20inicializa=C3=A7=C3=A3o=20do=20class,=20al=C3=A9m=20de=20pre?= =?UTF-8?q?parar=20a=20aplica=C3=A7=C3=A3o=20para=20funcionar=20com=20o=20?= =?UTF-8?q?Whatsapp.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/core.gbapp/services/GBMinService.ts | 6 +++--- deploy/default.gbui/public/index.html | 2 +- deploy/whatsapp.gblib/services/WhatsappDirectLine.ts | 2 +- tsconfig.json | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/deploy/core.gbapp/services/GBMinService.ts b/deploy/core.gbapp/services/GBMinService.ts index e4239be3..9d55af70 100644 --- a/deploy/core.gbapp/services/GBMinService.ts +++ b/deploy/core.gbapp/services/GBMinService.ts @@ -141,7 +141,7 @@ export class GBMinService { let options = { url: - "https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken", + "https://api.cognitive.microsoft.com/sts/v1.0/issueToken", method: "POST", headers: { "Ocp-Apim-Subscription-Key": instance.speechKey @@ -191,9 +191,9 @@ export class GBMinService { GBKBPackage, GBCustomerSatisfactionPackage, GBWhatsappPackage].forEach(sysPackage => { logger.trace(`Loading sys package: ${sysPackage.name}...`); let p = Object.create(sysPackage.prototype) as IGBPackage; - p.loadBot(min); - e.sysPackages.push(p); + //e.sysPackages.push(p); if (sysPackage.name === "GBWhatsappPackage") { + p.loadBot(min); let url = "/instances/:botId/whatsapp"; server.post(url, (req, res) => { p["channel"].received(req, res); diff --git a/deploy/default.gbui/public/index.html b/deploy/default.gbui/public/index.html index 6d13aa1b..436ea80b 100644 --- a/deploy/default.gbui/public/index.html +++ b/deploy/default.gbui/public/index.html @@ -53,7 +53,7 @@ -
+
diff --git a/deploy/whatsapp.gblib/services/WhatsappDirectLine.ts b/deploy/whatsapp.gblib/services/WhatsappDirectLine.ts index 8ca02d13..44583d2e 100644 --- a/deploy/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/deploy/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -204,7 +204,7 @@ export class WhatsappDirectLine extends GBService { // Ignore own messages. // TODO: this.botId instead of "general-bot-9672a8d3" - activities = activities.filter((m) => { return m.from.id === "general-bot-9672a8d3" && m.type === "message" }); + activities = activities.filter((m) => { return (m.from.id === "GeneralBot-Netshoes" || m.from.id.includes("4vqtLx3cFJgBAELkRib2K8")) && m.type === "message" }); if (activities.length) { diff --git a/tsconfig.json b/tsconfig.json index 67fd63f7..b02300c9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, + "keyofStringsOnly": true, "mapRoot": "./dist/", "module": "commonjs", "moduleResolution": "node",