Skip to content

Instantly share code, notes, and snippets.

@kenjosling
Created June 27, 2018 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenjosling/bb922edf9c65ac6dfbd24cff353ecf4b to your computer and use it in GitHub Desktop.
Save kenjosling/bb922edf9c65ac6dfbd24cff353ecf4b to your computer and use it in GitHub Desktop.
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