fix(core.gbapp): Fix GET/SET in .gbdialog.

This commit is contained in:
Rodrigo Rodriguez 2020-11-06 15:23:56 -03:00
parent c6f3d52729
commit 8842bf7e4f
3 changed files with 18 additions and 4 deletions

View file

@ -13,7 +13,7 @@
"Dário Vieira <dario.junior3@gmail.com>"
],
"engines": {
"node": "=10.15.2"
"node": "=14.10.1"
},
"license": "AGPL-3.0",
"preferGlobal": true,

View file

@ -740,10 +740,16 @@ export class GBMinService {
} else if (context.activity.text.charAt(0) === '/') {
let text = context.activity.text;
let parts = text.split(' ');
let dialogName = parts[0];
let cmdOrDialogName = parts[0];
parts.splice(0, 1);
let args = parts.join(' ');
await step.beginDialog(dialogName, { args: args });
if (cmdOrDialogName === '/call'){
await GBVMService.callVM(args, min, step, this.deployer);
}
else{
await step.beginDialog(cmdOrDialogName, { args: args });
}
} else if (globalQuit(step.context.activity.locale, context.activity.text)) {
// TODO: Hard-code additional languages.
await step.cancelAllDialogs();

View file

@ -180,7 +180,15 @@ export class GBVMService extends GBService {
});
code = code.replace(/(\w+)\s*\=\s*get\s(.*)/gi, ($0, $1, $2) => {
if ($2.indexOf('http') !== -1) {
return `let ${$1} = sys().httpGet (${$2})`;
} else {
return `let ${$1} = sys().get (${$2})`;
}
});
code = code.replace(/set\s(.*)/gi, ($0, $1, $2) => {
return `sys().set (${$1})`;
});
code = code.replace(/(\w+)\s*\=\s*post\s*(.*),\s*(.*)/gi, ($0, $1, $2, $3) => {