Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static async buildNewUserGreetingCard(turnContext: TurnContext, data: any): Promise {
const introFileName: string = i18next.t('main.introGreetingFile');
const introPath: string = join(__dirname, '..', 'content', introFileName);
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config
const introCard: any = JSON.parse(readFileSync(introPath, 'UTF8'));
const attachment: Attachment = CardFactory.adaptiveCard(introCard);
// eslint-disable-next-line @typescript-eslint/tslint/config
const response: Partial = MessageFactory.attachment(attachment, '', attachment.content.speak, InputHints.AcceptingInput);
response.suggestedActions = {
actions: [
{
title: i18next.t('main.helpBtnText1'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue1')
},
{
title: i18next.t('main.helpBtnText2'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue2')
},
{
title: i18next.t('main.helpBtnText3'),
type: ActionTypes.OpenUrl,
value: i18next.t('main.helpBtnValue3')
}
],
to: []
};
public static buildNewUserGreetingCard(turnContext: TurnContext, data: any): Promise {
const introFileName: string = i18next.t('main.introGreetingFile');
const introPath: string = join(__dirname, '..', 'content', introFileName);
// tslint:disable-next-line:no-any non-literal-require
const introCard: any = require(introPath);
const attachment: Attachment = CardFactory.adaptiveCard(introCard);
const response: Partial = MessageFactory.attachment(attachment, '', attachment.content.speak, InputHints.AcceptingInput);
response.suggestedActions = {
actions: [
{
title: i18next.t('main.helpBtnText1'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue1')
},
{
title: i18next.t('main.helpBtnText2'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue2')
},
{
title: i18next.t('main.helpBtnText3'),
type: ActionTypes.OpenUrl,
value: i18next.t('main.helpBtnValue3')
}
],
to: []
};
public static async buildHelpCard(turnContext: TurnContext, data: any): Promise {
const title: string = i18next.t('main.helpTitle');
const text: string = i18next.t('main.helpText');
const attachment: Attachment = CardFactory.heroCard(title, text);
const response: Partial = MessageFactory.attachment(attachment, text, InputHints.AcceptingInput);
response.suggestedActions = {
actions: [
{
title: i18next.t('main.helpBtnText1'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue1')
},
{
title: i18next.t('main.helpBtnText2'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue2')
},
{
title: i18next.t('main.helpBtnText3'),
type: ActionTypes.OpenUrl,
value: i18next.t('main.helpBtnValue3')
}
],
to: []
};
return Promise.resolve(response);
}
private static getCardAction(action: any): CardAction
{
let cardAction: CardAction;
if (typeof action === 'string') {
cardAction = { type: ActionTypes.ImBack, value: action, title: action, channelData: undefined };
} else {
const type: string = this.getStructureType(action);
cardAction = {
type: ActionTypes.ImBack,
title: '',
value: ''
};
if(type === 'cardaction') {
for (const key of Object.keys(action)) {
const property: string = key.trim();
if (property === Evaluator.LGType) {
continue;
}
const value: any = action[key];
switch (property.toLowerCase()) {
case 'displaytext':
cardAction.displayText = value;
public static buildHelpCard(turnContext: TurnContext, data: any): Promise {
const title: string = i18next.t('main.helpTitle');
const text: string = i18next.t('main.helpText');
const attachment: Attachment = CardFactory.heroCard(title, text);
const response: Partial = MessageFactory.attachment(attachment, text, InputHints.AcceptingInput);
response.suggestedActions = {
actions: [
{
title: i18next.t('main.helpBtnText1'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue1')
},
{
title: i18next.t('main.helpBtnText2'),
type: ActionTypes.ImBack,
value: i18next.t('main.helpBtnValue2')
},
{
title: i18next.t('main.helpBtnText3'),
type: ActionTypes.OpenUrl,
value: i18next.t('main.helpBtnValue3')
}
],
to: []
};
return Promise.resolve(response);
}