fix(whatsapp.gblib): Enabling Whatsapp.

This commit is contained in:
Rodrigo Rodriguez 2019-05-16 07:22:32 -03:00
parent 74f5936638
commit 4351b87973
3 changed files with 10 additions and 5 deletions

View file

@ -10,7 +10,7 @@
"Jorge Ramos <jramos@pobox.com>" "Jorge Ramos <jramos@pobox.com>"
], ],
"engines": { "engines": {
"node": "=10.13.0" "node": "=10.15.2"
}, },
"license": "AGPL-3.0", "license": "AGPL-3.0",
"preferGlobal": true, "preferGlobal": true,

View file

@ -136,7 +136,7 @@ export class DialogClass {
function random(low, high) { function random(low, high) {
return Math.random() * (high - low) + low return Math.random() * (high - low) + low
} }
const idCallback = random(0, 120000000);E const idCallback = random(0, 120000000);
this.min.cbMap[idCallback] = cb; this.min.cbMap[idCallback] = cb;
await this.step.beginDialog('/hear', { id: idCallback }); await this.step.beginDialog('/hear', { id: idCallback });
} }

View file

@ -259,11 +259,16 @@ export class GBVMService extends GBService {
async step => { async step => {
const cbId = step.activeDialog.state.cbId; const cbId = step.activeDialog.state.cbId;
const cb = min.cbMap[cbId]; const cb = min.cbMap[cbId];
step.activeDialog.state.cb = cb;
return await step.next();
},
async step => {
let cb = step.activeDialog.state.cb;
cb.bind({ step: step, context: step.context }); cb.bind({ step: step, context: step.context });
cb(step.result);
await step.endDialog(); return await step.next();
return await cb(step.result);
} }
]) ])
); );