Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.onMembersAdded(async (context, next) => {
const membersAdded = context.activity.membersAdded;
for (let cnt = 0; cnt < membersAdded.length; cnt++) {
if (membersAdded[cnt].id !== context.activity.recipient.id) {
const welcomeCard = CardFactory.adaptiveCard(WelcomeCard);
await context.sendActivity({ attachments: [welcomeCard] });
await dialog.run(context, conversationState.createProperty('DialogState'));
}
}
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
private static getAttachment(input: any): Attachment {
let attachment: Attachment = {
contentType: ''
};
const type: string = this.getStructureType(input);
if (ActivityChecker.genericCardTypeMapping.has(type)) {
attachment = this.getCardAttachment(ActivityChecker.genericCardTypeMapping.get(type), input);
} else if(type === 'adaptivecard') {
attachment = CardFactory.adaptiveCard(input);
} else if(type === 'attachment') {
attachment = this.getNormalAttachment(input);
} else {
attachment = {contentType: type, content: input};
}
return attachment;
}
this.onMembersAdded(async (context) => {
const membersAdded = context.activity.membersAdded;
for (const member of membersAdded) {
if (member.id !== context.activity.recipient.id) {
const welcomeCard = CardFactory.adaptiveCard(WelcomeCard);
await context.sendActivity({ attachments: [welcomeCard] });
}
}
});
}