UNPKG

relu-core

Version:
33 lines (31 loc) 1.21 kB
var botbuilder = require('../../modules/botbuilder'); module.exports.CreateHeroCards = function(session, nCards, title, text, nButtons, linkImages, buttonReturn, nameButton) { var i = 0; var k = 0; var j = 0; var array = []; var images = []; //For che va da 0 al numero di carte che si vogliono for (i = 0; i < nCards; i++) { //Creazione e inserimento della card nell'ultima posizione dell'array array.push(new botbuilder.HeroCard(session) //Creazione del titolo della card .title(title[i]) //Creazione del testo della card .text(text[i]) //Creazione dell'immagine della card .images([ botbuilder.CardImage.create(session, linkImages[i]) ]) ) var buttons = []; for (k = 0; k < nButtons; k++) { //creazione dei bottoni, ognuno con il suo nome e return buttons.push(botbuilder.CardAction.dialogAction(session, buttonReturn[j], null, nameButton[k])); j++; } //Assegnazione ad ogni card il suo bottone array[i].buttons(buttons); } return (array); }