Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
await dc.context.sendActivity(`Nothing to cancel.`);
}
}
if (!dc.context.responded) {
// Continue the current dialog if one is pending.
await dc.continueDialog();
}
if (!dc.context.responded) {
// If no response has been sent, start the onboarding dialog.
await dc.beginDialog('root');
}
} else if (
turnContext.activity.type === ActivityTypes.ConversationUpdate &&
turnContext.activity.membersAdded[0].name !== 'Bot'
) {
// Send a "this is what the bot does" message.
const description = [
'This is a bot that demonstrates an alternate dialog system',
'which uses a slot filling technique to collect multiple responses from a user.',
'Say anything to continue.'
];
await turnContext.sendActivity(description.join(' '));
}
await this.conversationState.saveChanges(turnContext);
}
}
recipient: parserModel.recipient,
conversationId: parserModel.conversation.id
});
currentActivity.text = '';
}
aggregate = aggregate.substr(result.index);
if (type === ActivityTypes.Typing) {
let newActivity = createActivity({
type,
recipient: parserModel.recipient,
from: parserModel.from,
conversationId: parserModel.conversation.id
});
newActivity.timestamp = getIncrementedDate(100);
newActivities.push(newActivity);
} else if (type === ActivityTypes.ConversationUpdate) {
processConversationUpdate(parserModel, newActivities, unparsedSource);
}
} else if (instruction && instruction === Instructions.Delay) {
delay = ~~rest;
} else if (field) {
// As more activity fields are supported,
// this should become a util or helper class.
switch (field) {
case ActivityFields.Attachment:
await addAttachmentToActivity(currentActivity, unparsedSource);
break;
case ActivityFields.AttachmentLayout:
addAttachmentLayout(currentActivity, unparsedSource as AttachmentLayoutTypes);
break;
function createConversationUpdate(parserModel: TransientParserModel, membersAdded?: ChannelAccount[], membersRemoved?: ChannelAccount[]) {
let conversationUpdateActivity = createActivity({
type: ActivityTypes.ConversationUpdate,
recipient: parserModel.accounts.bot,
conversationId: parserModel.conversation.id
});
conversationUpdateActivity.membersAdded = membersAdded || [];
conversationUpdateActivity.membersRemoved = membersRemoved || [];
conversationUpdateActivity.timestamp = getIncrementedDate(100);
return conversationUpdateActivity;
}