From d3f0ef4de0347a285a9289b015690c1c2bdeee05 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 24 Jan 2021 08:33:10 -0300 Subject: [PATCH] new(kb.gbapp): Whenever the bot is called with no text, start will be called. --- packages/kb.gbapp/dialogs/AskDialog.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index 7f9ee5e1..0fcab185 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -153,9 +153,19 @@ export class AskDialog extends IGBDialog { let text = step.options.query; text = text.replace(/<([^>]+?)([^>]*?)>(.*?)<\/\1>/gi, ''); + + // When no text is typed, the start dialog is invoked again + // when people type just the @botName in MSTEAMS for example. + if (!text) { - throw new Error(`/answer being called with no args query text.`); + const startDialog = + min.core.getParam(min.instance, 'Start Dialog', null); + await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer); + + return step.endDialog(); } + + const locale = step.context.activity.locale; // Stops any content on projector.