Skip to content

Commit

Permalink
fix(core.gbapp): EXIT keyword.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Dec 2, 2020
1 parent 4ab34f1 commit 3906c3d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core.gbapp/services/GBAPIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 7 additions & 0 deletions packages/core.gbapp/services/GBVMService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
});
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions packages/kb.gbapp/dialogs/AskDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3906c3d

Please sign in to comment.