How to use the botbuilder-dialogs.Dialog.EndOfTurn 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.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotBuilder-Samples / experimental / qnamaker-prompting / javascript_nodejs / dialogs / functionDialogBase.js View on Github external
async beginDialog(dc) {
        // Don't do anything for non-message activities.
        if (dc.context.activity.type !== ActivityTypes.Message) {
            return Dialog.EndOfTurn;
        }

        // Run dialog logic.
        return await this.runStateMachine(dc);
    }
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / generator-botbuilder-assistant / generators / skill / templates / sample-skill / src / dialogs / _mainDialog.ts View on Github external
protected async route(dc: DialogContext): Promise {
        const localeConfig: Partial | undefined = this.services.getCognitiveModel();

        // Populate state from SkillContext slots as required
        await this.populateStateFromSemanticAction(dc.context);

        // Get skill LUIS model from configuration
        if (localeConfig.luisServices !== undefined) {

            const luisService: LuisRecognizerTelemetryClient | undefined = localeConfig.luisServices.get(this.solutionName);

            if (luisService === undefined) {
                throw new Error('The specified LUIS Model could not be found in your Bot Services configuration.');
            } else {
                let turnResult: DialogTurnResult = Dialog.EndOfTurn;
                const result: RecognizerResult = await luisService.recognize(dc.context);
                const intent: string = LuisRecognizer.topIntent(result);

                switch (intent) {
                    case 'Sample': {
                        turnResult = await dc.beginDialog(SampleDialog.name);
                        break;
                    }
                    case 'None': {
                        // No intent was identified, send confused message
                        await dc.context.sendActivity(this.responseManager.getResponse(SharedResponses.didntUnderstandMessage));
                        turnResult = {
                            status: DialogTurnStatus.complete
                        };
                        break;
                    }
github howdyai / botkit / packages / botkit / src / conversation.ts View on Github external
public async resumeDialog(dc, reason, result): Promise {
        // Increment step index and run step
        if (dc.activeDialog) {
            const state = dc.activeDialog.state;
            return await this.runStep(dc, state.stepIndex + 1, state.thread || 'default', reason, result);
        } else {
            return Dialog.EndOfTurn;
        }
    }
github microsoft / botbuilder-js / libraries / botbuilder-dialogs-adaptive / src / adaptiveDialog.ts View on Github external
protected async onEndOfActions(sequence: SequenceContext): Promise {
        // End dialog and return result
        if (sequence.activeDialog) {
            if (this.shouldEnd(sequence)) {
                const state: AdaptiveDialogState = sequence.activeDialog.state;
                return await sequence.endDialog(state.result);
            }
            return Dialog.EndOfTurn;
        } else {
            return { status: DialogTurnStatus.cancelled };
        }
    }
github howdyai / botkit / packages / botbuilder-dialogs-botkit-cms / src / index.ts View on Github external
async continueDialog(dc) {

        // Don't do anything for non-message activities
        if (dc.context.activity.type !== ActivityTypes.Message) {
            return Dialog.EndOfTurn;
        }

        // Run next step with the message text as the result.
        return await this.resumeDialog(dc, DialogReason.continueCalled, dc.context.activity.text);
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 19.custom-dialogs / dialogs / slotFillingDialog.js View on Github external
async continueDialog(dc) {
        // Skip non-message activities.
        if (dc.context.activity.type !== ActivityTypes.Message) {
            return Dialog.EndOfTurn;
        }

        // Call runPrompt, which will find the next slot to fill.
        return await this.runPrompt(dc);
    }
github microsoft / botbuilder-js / libraries / botbuilder-dialogs-adaptive / src / input / inputDialog.ts View on Github external
protected async onEndOfPlan(planning: PlanningContext): Promise {
        // Evaluate current status
        const state = planning.activeDialog.state as InputDialogState;
        if (state.fulfilled) {
            // Return result
            return await planning.endDialog(state.result);
        } else if (state.continuingAction) {
            // The action just completed so we need to re-evaluate our state and re-prompt as
            // needed.
            delete state.continuingAction;
            await this.onValidateSlot(planning);
            return await this.continuePlan(planning);
        } else {
            // Just wait for user to reply
            return Dialog.EndOfTurn;
        }
    }
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / samples / sample-skill / src / dialogs / mainDialog.ts View on Github external
// No intent was identified, send confused message
                        await dc.context.sendActivity(this.responseManager.getResponse(SharedResponses.didntUnderstandMessage));
                        turnResult = {
                            status: DialogTurnStatus.complete
                        };
                        break;
                    }
                    default: {
                        // intent was identified but not yet implemented
                        await dc.context.sendActivity(this.responseManager.getResponse(MainResponses.featureNotAvailable));
                        turnResult = {
                            status: DialogTurnStatus.complete
                        };
                    }
                }
                if (turnResult !== Dialog.EndOfTurn) {
                    await this.complete(dc);
                }
            }
        }
    }
github microsoft / botbuilder-js / libraries / botbuilder-dialogs-adaptive / src / actions / endTurn.ts View on Github external
public async beginDialog(dc: DialogContext): Promise {
        return Dialog.EndOfTurn;
    }