Skip to content

Instantly share code, notes, and snippets.

@jamesgarrett
Created October 23, 2017 04:30
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 jamesgarrett/69df847c977c12faa74be65e60954ae8 to your computer and use it in GitHub Desktop.
Save jamesgarrett/69df847c977c12faa74be65e60954ae8 to your computer and use it in GitHub Desktop.
Project 01
module.exports = function(bot) {
// Set our larger variables -- these would be fed into this function ideally
var baseURL = "www.thirdhand.jamesgarrett.co";
var company = "storybook";
// Start building our asset variables
var logo = ["logo.png"];
// How to find our logos folder
var logoURL = baseURL + "/companies/" + company + "/logos/";
// Define our fonts
var fonts = {
headline : ['open-sans','bold'],
body : ['lato','book'],
}
// How to find our fonts
var headlineFont = baseURL + "/companies/" + company + "/fonts/" + fonts.headline[0] + ".zip";
var bodyFont = baseURL + "/companies/" + company + "/fonts/" + fonts.body[0] + ".zip";
// Define our brand colors
brandColors = {
primary : '#4ac3d1',
secondary : '#0F3247',
uiWhite : '#ffffff',
uiGray : '#d8d8d8',
}
// Supply our prompts
bot.hear(/thirdhand/i, function(res){
return res.send('Hello! try one of these: '+
'\n Can you send me the logo? ' +
'\n What font do we use? ' +
'\n What colors do we use? '
);
})
// Fetch the Logo
bot.hear(/Can you send me the (logo|logos)?/i, function(res){
return res.send("Here you go! " + logoURL + logo);
})
// Fetch the Font
bot.hear(/What (font|fonts) do we use?/i, function(res){
if (fonts.headline && fonts.body){
return res.send("We use different fonts in different places. \n"
+ "We use " + fonts.headline[0] + " " + fonts.headline[1]
+ " as our headline font. \n You can download it here: "
+ headlineFont + "\n"
+ "We use " + fonts.body[0] + " " + fonts.body[1]
+ " as our body font. \n You can download it here: "
+ bodyFont + "\n"
);
} else {
return res.send("We use " + fonts.headline[0] + " " + fonts.headline[1]
+ " as our headline font. \n You can download it here: "
+ headlineFont + "\n"
);
}
})
// Display Brand Colors
bot.respond(/What (color|colors) do we use?/i, function(res){
if (!brandColors){
return res.send("No brand colors have been uploaded.");
} else {
return res.send("Our brand colors are: \n"
+ "Pacific Noon: " + brandColors.primary + "\n"
+ "Atlantic Night: " + brandColors.secondary + "\n"
+ "UI White: " + brandColors.uiWhite + "\n"
+ "UI Gray: " + brandColors.uiGray
);
}
})
}
@donoage
Copy link

donoage commented Nov 3, 2017

Overall Thoughts

return res.send(`We use different fonts in different places.
We use ${fonts.headline[0]} ${fonts.headline[1]} as our headline font.
You can download it here: ${headlineFont}
We use ${fonts.body[0]} ${fonts.body[1]} as our body font.
You can download it here: ${bodyFont}`);

This way new lines and whitespaces between variables are respected and I think it makes for a better readability.

Rating

4/4

Let me know if you have questions.

Best,
Stephen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment