How to use the botbuilder-dialogs.ConfirmPrompt 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-js / samples / luis-bot-es6 / app.js View on Github external
const reminder = user.reminders[0];
        await dc.prompt('confirmPrompt', `Are you sure you want to delete the "${reminder.title}" reminder?`);
    },
    async function(dc, confirm) {
        if (confirm) {
            const user = state.user(dc.context);
            user.reminders = [];
            await dc.context.sendActivity(`reminder deleted...`);
        } else {
            await dc.context.sendActivity(`ok...`);
        }
    }
]);

dialogs.add('choicePrompt', new ChoicePrompt());
dialogs.add('confirmPrompt', new ConfirmPrompt());

//-----------------------------------------------
// Show Reminders
//-----------------------------------------------

dialogs.add('showReminders', [
    async function(dc) {
        let msg = `No reminders found.`;
        const user = state.user(dc.context);
        if (user.reminders.length > 0) {
            msg = `**Current Reminders**\n\n`;
            let connector = '';
            user.reminders.forEach(reminder => {
                msg += connector + `- ${reminder.title} (${reminder.time})`;
                connector = '\n';
            });
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 51.cafe-bot / dialogs / whoAreYou / index.js View on Github external
this.askForUserName.bind(this),
                this.greetUser.bind(this)
            ]));

            // Add get user name prompt
            this.addDialog(new GetUserNamePrompt(ASK_USER_NAME_PROMPT,
                botConfig,
                userProfileAccessor,
                conversationState,
                onTurnAccessor));

            // This dialog is multi-turn capable and also interruptable. Add interruptionDispatcherDialog
            this.addDialog(new InterruptionDispatcher(onTurnAccessor, conversationState, userProfileAccessor, botConfig, reservationAccessor));

            // When user decides to abandon this dialog, we need to confirm user action. Add confirmation prompt.
            this.addDialog(new ConfirmPrompt(CONFIRM_CANCEL_PROMPT));
        }
        /**
github microsoft / botbuilder-js / samples / dialogs / inside-middleware-ts / lib / goodbyeMiddleware.js View on Github external
},
            function (dc, value) {
                return __awaiter(this, void 0, void 0, function* () {
                    if (value) {
                        // Clear conversation state
                        yield dc.context.sendActivity(`Ok... Goodbye`);
                        conversationState.clear(dc.context);
                    }
                    else {
                        yield dc.context.sendActivity(`Ok...`);
                    }
                    return dc.endDialog();
                });
            }
        ]);
        this.dialogs.add('confirmPrompt', new botbuilder_dialogs_1.ConfirmPrompt());
    }
    onTurn(context, next) {
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 51.cafe-bot / dialogs / bookTable / index.js View on Github external
this.getAllRequiredProperties.bind(this),
                this.bookTable.bind(this)
            ]));

            // Get location, date, time & party size prompt.
            this.addDialog(new GetLocDateTimePartySizePrompt(GET_LOCATION_DATE_TIME_PARTY_SIZE_PROMPT,
                botConfig,
                reservationsAccessor,
                onTurnAccessor,
                userProfileAccessor));

            // This dialog is interruptable. So add interruptionDispatcherDialog
            this.addDialog(new InterruptionDispatcher(onTurnAccessor, conversationState, userProfileAccessor, botConfig, reservationsAccessor));

            // When user decides to abandon this dialog, we need to confirm user action. Add confirmation prompt
            this.addDialog(new ConfirmPrompt(CONFIRM_CANCEL_PROMPT));
        }
github microsoft / botbuilder-js / samples / dialogs / prompts-ts / src / app.ts View on Github external
// Continue the current dialog
            await dc.continueDialog();

            // Show menu if no response sent
            if (!context.responded) {
                await dc.beginDialog('mainMenu');
            }
        }
    });
});

const dialogs = new DialogSet();
    
// Add prompts
dialogs.add('choicePrompt', new ChoicePrompt());
dialogs.add('confirmPrompt', new ConfirmPrompt());
dialogs.add('datetimePrompt', new DatetimePrompt());
dialogs.add('numberPrompt', new NumberPrompt());
dialogs.add('textPrompt', new TextPrompt());
dialogs.add('attachmentPrompt', new AttachmentPrompt());

    
//-----------------------------------------------
// Main Menu
//-----------------------------------------------

dialogs.add('mainMenu', [
    async function(dc) {
        function choice(title: string, value: string): Choice {
            return {
                value: value,
                action: { type: ActionTypes.ImBack, title: title, value: title }
github microsoft / botbuilder-js / samples / dialogs / inside-middleware-ts / src / goodbyeMiddleware.ts View on Github external
async function (dc) {
                await dc.prompt('confirmPrompt', `This will end any active tasks. Are you sure?`);
            },
            async function (dc, value: boolean) {
                if (value) {
                    // Clear conversation state
                    await dc.context.sendActivity(`Ok... Goodbye`);
                    conversationState.clear(dc.context);
                } else {
                    await dc.context.sendActivity(`Ok...`);
                }
                return dc.endDialog();
            }
        ]);
        
        this.dialogs.add('confirmPrompt', new ConfirmPrompt());
    }
github microsoft / BotBuilder-Samples / generators / generator-botbuilder / generators / app / templates / core / dialogs / bookingDialog.ts View on Github external
constructor(id: string) {
        super(id || 'bookingDialog');

        this.addDialog(new TextPrompt(TEXT_PROMPT))
            .addDialog(new ConfirmPrompt(CONFIRM_PROMPT))
            .addDialog(new DateResolverDialog(DATE_RESOLVER_DIALOG))
            .addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
                this.destinationStep.bind(this),
                this.originStep.bind(this),
                this.travelDateStep.bind(this),
                this.confirmStep.bind(this),
                this.finalStep.bind(this)
            ]));

        this.initialDialogId = WATERFALL_DIALOG;
    }
github microsoft / botframework-solutions / templates / Enterprise-Template / src / typescript / enterprise-bot / src / dialogs / cancel / cancelDialog.ts View on Github external
constructor() {
        super(CancelDialog.name);
        this.initialDialogId = CancelDialog.name;

        const cancel = [
            CancelDialog.AskToCancel.bind(this),
            CancelDialog.FinishCancelDialog.bind(this)
        ];

        this.addDialog(new WaterfallDialog(this.initialDialogId, cancel));
        this.addDialog(new ConfirmPrompt(DialogIds.CancelPrompt));
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 13.core-bot / dialogs / bookingDialog.js View on Github external
constructor(id) {
        super(id || 'bookingDialog');

        this.addDialog(new TextPrompt(TEXT_PROMPT))
            .addDialog(new ConfirmPrompt(CONFIRM_PROMPT))
            .addDialog(new DateResolverDialog(DATE_RESOLVER_DIALOG))
            .addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
                this.destinationStep.bind(this),
                this.originStep.bind(this),
                this.travelDateStep.bind(this),
                this.confirmStep.bind(this),
                this.finalStep.bind(this)
            ]));

        this.initialDialogId = WATERFALL_DIALOG;
    }
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 21.corebot-app-insights / dialogs / bookingDialog.js View on Github external
constructor() {
        super('bookingDialog');

        const textPrompt = new TextPrompt(TEXT_PROMPT);

        const confirmPrompt = new ConfirmPrompt(CONFIRM_PROMPT);

        const dateResolveDialog = new DateResolverDialog(DATE_RESOLVER_DIALOG);

        const waterFallDialog = new WaterfallDialog(WATERFALL_DIALOG, [
            this.destinationStep.bind(this),
            this.originStep.bind(this),
            this.travelDateStep.bind(this),
            this.confirmStep.bind(this),
            this.finalStep.bind(this)
        ]);

        this.addDialog(textPrompt)
            .addDialog(confirmPrompt)
            .addDialog(dateResolveDialog)
            .addDialog(waterFallDialog);