Skip to content

Instantly share code, notes, and snippets.

@kenjosling kenjosling/about.js
Created Jun 27, 2018

Embed
What would you like to do?
var fs = require('fs');
class About {
constructor(botName, iconUrl, companyName, botVersion, userGuideUrl) {
this.BotName = botName,
this.IconUrl = iconUrl,
this.CompanyName = companyName,
this.BotVersion = botVersion,
this.UserGuideUrl = userGuideUrl
}
toCard() {
var schema = fs.readFileSync(__dirname + '/cards/about.json', 'utf8');
var attributes = Object.keys(this);
for (var i = 0; i < attributes.length; i++) {
schema = schema.replace('%'+attributes[i]+'%', Object.values(this)[i]);
}
var card = {'contentType': 'application/vnd.microsoft.card.adaptive'}
card.content = JSON.parse(schema)
return card;
}
};
module.exports = About;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.