fix(core.gbapp): EXIT keyword.

This commit is contained in:
Rodrigo Rodriguez 2020-12-02 17:20:38 -03:00
parent 4ab34f18ac
commit 3906c3de53
3 changed files with 12 additions and 0 deletions

View file

@ -482,6 +482,9 @@ export class DialogClass {
public async isAffirmative(step, text) {
return text.toLowerCase().match(Messages[step.context.activity.locale].affirmative_sentences);
}
public async exit(step) {
await step.endDialog();
}
public async getNow(step) {
const nowUTC = new Date();

View file

@ -212,6 +212,10 @@ export class GBVMService extends GBService {
return `transfer (step)\n`;
});
code = code.replace(/(exit)/gi, () => {
return `exit (step)\n`;
});
code = code.replace(/(talk to)(\s)(.*)/gi, ($0, $1, $2, $3) => {
return `sys().talkTo(${$3})\n`;
});
@ -382,6 +386,9 @@ export class GBVMService extends GBService {
code = code.replace(/("[^"]*"|'[^']*')|\btransfer\b/gi, ($0, $1) => {
return $1 === undefined ? 'this.transfer' : $1;
});
code = code.replace(/("[^"]*"|'[^']*')|\bexit\b/gi, ($0, $1) => {
return $1 === undefined ? 'this.exit' : $1;
});
// await insertion.

View file

@ -93,6 +93,8 @@ export class AskDialog extends IGBDialog {
text = Messages[locale].ask_first_time;
} else if (step.options && step.options.isReturning) {
text = Messages[locale].anything_else;
} else if (step.options && step.options.emptyPrompt) {
text = "";
} else if (user.subjects.length > 0) {
text = Messages[locale].which_question;
} else {