Skip to content

Instantly share code, notes, and snippets.

@stoneboyindc
Last active September 21, 2021 15:38
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 stoneboyindc/ee2857b550ca061285bfa9d77ffde087 to your computer and use it in GitHub Desktop.
Save stoneboyindc/ee2857b550ca061285bfa9d77ffde087 to your computer and use it in GitHub Desktop.
const { welcome, goodbye, tell } = require("../utils/fortune-teller");
function getFortune(question) {
tell(question).then(msg => {
console.log(`Your question was: ${question}`);
console.log(`Your fortune is: ${msg}`)})
.catch(err => console.log('There was an error: A question is required...'));
}
function fullSession(question) {
welcome().then(msg => console.log(msg))
getFortune(question)
if (!question) {
return;
}
goodbye().then(msg => console.log(msg));
}
module.exports = { getFortune, fullSession };
const { welcome, goodbye, tell } = require("../utils/fortune-teller");
async function getFortune(question) {
try{
let response = await tell(question)
console.log(`Your question was: ${question}`);
console.log(`Your fortune is: ${response}`);
}
catch(err){
console.log(`There was an error: ${err}`);
}
}
async function fullSession(question) {
let msg = await welcome();
console.log(msg);
msg = await getFortune(question);
console.log(msg)
msg = await goodbye();
console.log(msg);
}
module.exports = { getFortune, fullSession };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment