How to use the botbuilder-dialogs.DialogTurnStatus.empty function in botbuilder-dialogs

To help you get started, we’ve selected a few botbuilder-dialogs examples, based on popular ways it is used in public projects.

github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 50.diceroller-skill / dialogs / diceRollerSkill.js View on Github external
// Show help card
                return await beginRootDialog(innerDC, HELP_DIALOG);
            } else if (/(cancel|close|goodbye)/i.test(utterance)) {
                // Send EndOfConversation to end the current skill invocation
                await innerDC.context.sendActivity({
                    type: ActivityTypes.EndOfConversation,
                    code: EndOfConversationCodes.UserCancelled
                });
                return await innerDC.cancelAllDialogs();
            }
        }

        // Continue any current dialog
        let result = await innerDC.continueDialog();
        // Show help card as a fallback
        if (result.status === DialogTurnStatus.empty && isMessage) {
            result = beginRootDialog(innerDC, HELP_DIALOG);
        }
        return result;
    }
}
github hinojosachapel / CorePlus / typescript_nodejs / src / dialogs / main / index.ts View on Github external
} // Else: We don't have an active dialog so nothing to continue here.
            } else {
                // No interruption. Continue any active dialogs.
                turnResult = await dc.continueDialog();
            }

            // If no active dialog or no active dialog has responded,
            if (!dc.context.responded) {
                const stepOptions = {
                    entities: results.entities
                };

                // Switch on return results from any active dialog.
                switch (turnResult.status) {
                // dc.continueDialog() returns DialogTurnStatus.empty if there are no active dialogs
                case DialogTurnStatus.empty:
                    // Determine what we should do based on the top intent from LUIS.
                    switch (topIntent) {
                    case GREETING_INTENT:
                        turnResult = await dc.beginDialog(GreetingDialog.name, stepOptions);
                        break;

                        // Basic code for intents and dialogs binding
                        // case SOME_OTHER_INTENT:
                        // turnResult = await dc.beginDialog(SomeOtherDialog.name, stepOptions);
                        // break;

                    case NONE_INTENT:
                    default:
                        // None or no intent identified, either way, let's query the QnA service.
                        turnResult = await dc.beginDialog(QnADialog.name);
                        break;
github microsoft / BotBuilder-Samples / javascript_nodejs / 20.cortana-skill / cortanaSkill.js View on Github external
async onRunTurn(innerDC, options) {
        // Attempt to continue the current dialog
        let result = await innerDC.continueDialog();

        // Start initial dialog if not running
        if (result.status === DialogTurnStatus.empty && innerDC.context.activity.type === ActivityTypes.Message) {
            result = await innerDC.beginDialog(this.initialDialogId, options);
        }
        return result;
    }
github microsoft / BotBuilder-Samples / generators / generator-botbuilder / generators / app / templates / core / bot.js View on Github external
if (interrupted) {
                if (dc.activeDialog !== undefined) {
                    // issue a re-prompt on the active dialog
                    dialogResult = await dc.repromptDialog();
                } // Else: We don't have an active dialog so nothing to continue here.
            } else {
                // No interruption. Continue any active dialogs.
                dialogResult = await dc.continueDialog();
            }

            // If no active dialog or no active dialog has responded,
            if (!dc.context.responded) {
                // Switch on return results from any active dialog.
                switch (dialogResult.status) {
                // dc.continueDialog() returns DialogTurnStatus.empty if there are no active dialogs
                case DialogTurnStatus.empty:
                    // Determine what we should do based on the top intent from LUIS.
                    switch (topIntent) {
                    case GREETING_INTENT:
                        await dc.beginDialog(GREETING_DIALOG);
                        break;
                    case NONE_INTENT:
                    default:
                        // None or no intent identified, either way, let's provide some help
                        // to the user
                        await dc.context.sendActivity(`I didn't understand what you just said to me.`);
                        break;
                    }
                    break;
                case DialogTurnStatus.waiting:
                    // The active dialog is waiting for a response from the user, so do nothing.
                    break;
github hinojosachapel / CorePlus / src / dialogs / main / index.js View on Github external
} // Else: We don't have an active dialog so nothing to continue here.
            } else {
                // No interruption. Continue any active dialogs.
                turnResult = await dc.continueDialog();
            }

            // If no active dialog or no active dialog has responded,
            if (!dc.context.responded) {
                const stepOptions = {
                    entities: results.entities
                };

                // Switch on return results from any active dialog.
                switch (turnResult.status) {
                // dc.continueDialog() returns DialogTurnStatus.empty if there are no active dialogs
                case DialogTurnStatus.empty:
                    // Determine what we should do based on the top intent from LUIS.
                    switch (topIntent) {
                    case GREETING_INTENT:
                        turnResult = await dc.beginDialog(GreetingDialog.name, stepOptions);
                        break;

                        // Basic code for intents and dialogs binding
                        // case SOME_OTHER_INTENT:
                        // turnResult = await dc.beginDialog(SomeOtherDialog.name, stepOptions);
                        // break;

                    case NONE_INTENT:
                    default:
                        // None or no intent identified, either way, let's query the QnA service.
                        turnResult = await dc.beginDialog(QnADialog.name);
                        break;
github microsoft / BotBuilder-Samples / MigrationV3V4 / Node / core-MultiDialogs-v4 / dialogs / main.js View on Github external
async run(turnContext, accessor) {
        const dialogSet = new DialogSet(accessor);
        dialogSet.add(this);

        const dialogContext = await dialogSet.createContext(turnContext);
        const results = await dialogContext.continueDialog();
        if (results.status === DialogTurnStatus.empty) {
            await dialogContext.beginDialog(this.id);
        }
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 21.corebot-app-insights / dialogs / mainDialog.js View on Github external
async run(turnContext, accessor) {
        const dialogSet = new DialogSet(accessor);
        dialogSet.add(this);

        const dialogContext = await dialogSet.createContext(turnContext);
        const results = await dialogContext.continueDialog();
        if (results.status === DialogTurnStatus.empty) {
            await dialogContext.beginDialog(this.id);
        }
    }
github microsoft / BotBuilder-Samples / samples / typescript_nodejs / 06.using-cards / src / dialogs / mainDialog.ts View on Github external
public async run(turnContext: TurnContext, accessor: StatePropertyAccessor) {
        const dialogSet = new DialogSet(accessor);
        dialogSet.add(this);

        const dialogContext = await dialogSet.createContext(turnContext);
        const results = await dialogContext.continueDialog();
        if (results.status === DialogTurnStatus.empty) {
            await dialogContext.beginDialog(this.id);
        }
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 13.core-bot / dialogs / mainDialog.js View on Github external
async run(turnContext, accessor) {
        const dialogSet = new DialogSet(accessor);
        dialogSet.add(this);

        const dialogContext = await dialogSet.createContext(turnContext);
        const results = await dialogContext.continueDialog();
        if (results.status === DialogTurnStatus.empty) {
            await dialogContext.beginDialog(this.id);
        }
    }
github microsoft / BotBuilder-Samples / samples / javascript_typescript / 13.core-bot / src / dialogs / mainDialog.ts View on Github external
public async run(context: TurnContext, accessor: StatePropertyAccessor<DialogState>) {
        const dialogSet = new DialogSet(accessor);
        dialogSet.add(this);

        const dialogContext = await dialogSet.createContext(context);
        const results = await dialogContext.continueDialog();
        if (results.status === DialogTurnStatus.empty) {
            await dialogContext.beginDialog(this.id);
        }
    }