Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(dialogId: string, private alarmsProperty: StatePropertyAccessor) {
super(dialogId);
// waterfall dialog for dealing with multiple dialogs
this.addDialog(new WaterfallDialog(DELETE_MULTI_DIALOG, [
this.chooseAlarmStep,
this.deleteChosenAlarmStep
]));
// waterfall dialog for deleting a single dialog
this.addDialog(new WaterfallDialog(DELETE_SINGLE_DIALOG, [
this.confirmDeleteSingleStep,
this.confirmedDeleteSingleAlarmStep
]));
// Add support prompts
this.addDialog(new ChoicePrompt(CHOOSE_ALARM_PROMPT));
this.addDialog(new ConfirmPrompt(CONFIRM_DELETE_PROMPT));
}
responseManager: ResponseManager,
stateAccessor: StatePropertyAccessor,
telemetryClient: BotTelemetryClient
) {
super(SampleDialog.name, settings, services, responseManager, stateAccessor, telemetryClient);
const sample: ((sc: WaterfallStepContext) => Promise)[] = [
// NOTE: Uncomment these lines to include authentication steps to this dialog
// GetAuthToken,
// AfterGetAuthToken,
this.promptForName.bind(this),
this.greetUser.bind(this),
this.end.bind(this)
];
this.addDialog(new WaterfallDialog(SampleDialog.name, sample));
this.addDialog(new TextPrompt(DialogIds.namePrompt));
this.initialDialogId = SampleDialog.name;
}
// Instructions for the user with information about commands that this bot may handle.
this.helpMessage = `You can type "send " to send an email, "recent" to view recent unread mail,` +
` "me" to see information about your, or "help" to view the commands` +
` again. Any other text will display your token.`;
// Create a DialogSet that contains the OAuthPrompt.
this.dialogs = new DialogSet(this.dialogState);
// Add an OAuthPrompt with the connection name as specified on the Bot's settings blade in Azure.
this.dialogs.add(OAuthHelpers.prompt(CONNECTION_SETTING_NAME));
this._graphDialogId = 'graphDialog';
// Logs in the user and calls proceeding dialogs, if login is successful.
this.dialogs.add(new WaterfallDialog(this._graphDialogId, [
this.promptStep.bind(this),
this.processStep.bind(this)
]));
};
}
}
return false;
}));
// Create a dialog that asks the user for their name.
this.dialogs.add(new WaterfallDialog(WHO_ARE_YOU, [
this.promptForName.bind(this),
this.confirmAgePrompt.bind(this),
this.promptForAge.bind(this),
this.captureAge.bind(this)
]));
// Create a dialog that displays a user name after it has been collected.
this.dialogs.add(new WaterfallDialog(HELLO_USER, [
this.displayProfile.bind(this)
]));
}
// creates a new state accessor property.
// See https://aka.ms/about-bot-state-accessors to learn more about the bot state and state accessors
this.conversationState = conversationState;
this.userState = userState;
this.dialogState = this.conversationState.createProperty(DIALOG_STATE_PROPERTY);
this.userName = this.userState.createProperty(USER_NAME_PROP);
this.dialogs = new DialogSet(this.dialogState);
// Add prompts
this.dialogs.add(new TextPrompt(NAME_PROMPT));
// Create a dialog that asks the user for their name.
this.dialogs.add(new WaterfallDialog(WHO_ARE_YOU, [
this.askForName.bind(this),
this.collectAndDisplayName.bind(this)
]));
// Create a dialog that displays a user name after it has been collected.
this.dialogs.add(new WaterfallDialog(HELLO_USER, [
this.displayName.bind(this)
]));
}
constructor(dialogId, currentGameProperty) {
super(dialogId);
this.currentGameProperty = currentGameProperty;
// Add control flow dialogs
this.addDialog(new WaterfallDialog(START_DIALOG, [
this.ensureGameStep.bind(this),
this.rollDiceStep.bind(this)
]));
}
constructor(logger) {
super('MainDialog');
if (!logger) {
logger = console;
logger.log('[MainDialog]: logger not passed in, defaulting to console');
}
this.logger = logger;
// Define the main dialog and its related components.
this.addDialog(new ChoicePrompt('cardPrompt'));
this.addDialog(new WaterfallDialog(MAIN_WATERFALL_DIALOG, [
this.choiceCardStep.bind(this),
this.showCardStep.bind(this)
]));
// The initial child Dialog to run.
this.initialDialogId = MAIN_WATERFALL_DIALOG;
}
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;
}
constructor(botServices: BotServices, telemetryClient: BotTelemetryClient) {
super(botServices, EscalateDialog.name, telemetryClient);
this.initialDialogId = EscalateDialog.name;
const escalate: ((sc: WaterfallStepContext<{}>) => Promise)[] = [
EscalateDialog.sendEscalationMessage.bind(this)
];
this.addDialog(new WaterfallDialog(this.initialDialogId, escalate));
}
constructor(id: string) {
super(id || 'dateResolverDialog');
this.addDialog(new DateTimePrompt(DATETIME_PROMPT, DateResolverDialog.dateTimePromptValidator.bind(this)))
.addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
this.initialStep.bind(this),
this.finalStep.bind(this)
]));
this.initialDialogId = WATERFALL_DIALOG;
}