Created
June 27, 2018 15:46
-
-
Save kenjosling/bb922edf9c65ac6dfbd24cff353ecf4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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