Created
October 23, 2017 04:30
-
-
Save jamesgarrett/69df847c977c12faa74be65e60954ae8 to your computer and use it in GitHub Desktop.
Project 01
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
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 | |
); | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overall Thoughts
+
and\n
, we can use template literals(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) we used in class to better organize your code.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