ConfirmPrompt class

Prompts a user to confirm something with a "yes" or "no" response.

Extends
Prompt<boolean>

Remarks

By default the prompt will return to the calling dialog a boolean representing the users selection.

Constructors

ConfirmPrompt(string, PromptValidator<boolean>, string)

Creates a new ConfirmPrompt instance.

Properties

choiceOptions

Additional options passed to the ChoiceFactory and used to tweak the style of choices rendered to the user.

confirmChoices

Custom list of choices to send for the prompt.

defaultLocale

The prompts default locale that should be recognized.

EndOfTurn

Signals the end of a turn by a dialog method or waterfall/sequence step.

id

Unique ID of the dialog.

style

Style of the "yes" and "no" choices rendered to the user when prompting.

telemetryClient

Set the telemetry client for this dialog.

Methods

beginDialog(DialogContext, PromptOptions)
continueDialog(DialogContext)
endDialog(TurnContext, DialogInstance, DialogReason)

Called when the dialog is ending.

repromptDialog(TurnContext, DialogInstance)
resumeDialog(DialogContext, DialogReason, any)

Constructor Details

ConfirmPrompt(string, PromptValidator<boolean>, string)

Creates a new ConfirmPrompt instance.

new ConfirmPrompt(dialogId: string, validator?: PromptValidator<boolean>, defaultLocale?: string)

Parameters

dialogId
string

Unique ID of the dialog within its parent DialogSet or ComponentDialog.

validator
PromptValidator<boolean>

(Optional) validator that will be called each time the user responds to the prompt.

defaultLocale
string

(Optional) locale to use if TurnContext.activity.locale is not specified. Defaults to a value of en-us.

Property Details

choiceOptions

Additional options passed to the ChoiceFactory and used to tweak the style of choices rendered to the user.

choiceOptions: ChoiceFactoryOptions | undefined

Property Value

ChoiceFactoryOptions | undefined

confirmChoices

Custom list of choices to send for the prompt.

confirmChoices: string | Choice[] | undefined

Property Value

string | Choice | undefined[]

defaultLocale

The prompts default locale that should be recognized.

defaultLocale: string | undefined

Property Value

string | undefined

EndOfTurn

Signals the end of a turn by a dialog method or waterfall/sequence step.

static EndOfTurn: DialogTurnResult

Property Value

id

Unique ID of the dialog.

id: string

Property Value

string

style

Style of the "yes" and "no" choices rendered to the user when prompting.

style: ListStyle

Property Value

Remarks

Defaults to ListStyle.auto.

telemetryClient

Set the telemetry client for this dialog.

telemetryClient: BotTelemetryClient

Property Value

BotTelemetryClient

Method Details

beginDialog(DialogContext, PromptOptions)

function beginDialog(dc: DialogContext, options: PromptOptions)

Parameters

options
PromptOptions

Returns

Promise<DialogTurnResult>

continueDialog(DialogContext)

function continueDialog(dc: DialogContext)

Parameters

Returns

Promise<DialogTurnResult>

endDialog(TurnContext, DialogInstance, DialogReason)

Called when the dialog is ending.

function endDialog(context: TurnContext, instance: DialogInstance, reason: DialogReason)

Parameters

context
TurnContext

Context for the current turn of conversation.

instance
DialogInstance

The instance of the current dialog.

reason
DialogReason

The reason the dialog is ending.

Returns

Promise<void>

Remarks

SHOULD be overridden by dialogs that wish to perform some logging or cleanup action anytime the dialog ends.

repromptDialog(TurnContext, DialogInstance)

function repromptDialog(context: TurnContext, instance: DialogInstance)

Parameters

context
TurnContext
instance
DialogInstance

Returns

Promise<void>

resumeDialog(DialogContext, DialogReason, any)

function resumeDialog(dc: DialogContext, reason: DialogReason, result?: any)

Parameters

reason
DialogReason
result
any

Returns

Promise<DialogTurnResult>