Skip to content

Instantly share code, notes, and snippets.

Jessica Dene Earley-Cha chatasweetie

View GitHub Profile
View whiteboarding-solution-index.js
//index.js
app.intent('solution', (conv) => {
let message = choose(responses.solutions)[0];
// if the user doesn't have a screen, give them only the
// message plus info about getting url via a screen
if (!conv.screen){
conv.ask(message['text'] + ' To see the url switch ' +
'over to a screen');
return;
}
View whiteboarding-challengeHint-index.js
// index.js
app.intent('challengeHint', (conv) => {
// get the data that is saved on the user
let challengesName = conv.user.storage.currentChallenge;
let level = conv.user.storage.currentLevel;
// if they don't have a challengeName, then we tell them a
// message
if (!challengeName){
conv.ask(new SimpleResponse({
speech: noChallengeresponse['speech'},
View whiteboarding-askProblem-responses.js
// responses.js
beginnerChallenges = [
{
'problemName': 'matching_parens',
'text': 'Write the function …',
'speech': '<speak> Write the function…',
'hintText': 'If you remove all the letters…',
'hintSpeech': '<speak> If you remove all the letters…',
},
...
View whiteboarding-askProblem-index.js
// index.js
app.intent('askProblem', (conv, params) => {
let level = params.level;
// if level is random or not defined, I choose a random level
if (level === 'random' || !level) {
let keys = Object.keys(response.challenges);
level = choose(keys);
}
let questions = responses.challenge[level];
View whiteboarding-welcome-responses.js
//responses.js
export.greeting = {
'new': [
{'text': 'Hello, my name is Jessica…',
'speech': '<speak> Hello, <break time=".35 /> my name…',
},
],
'returning': [
{'text': 'Hi again! I'm excited to help…',
'speech': '<speak> Hi again! I'm excited to help…',
View whiteboarding-welcome-index.js
//index.js
const responses = require('./responses');
app.intent('Default Welcome Intent', (conv) => {
// the user has used this Action prior, let's give them the
// returning greeting
if (conv.user.last.seen) {
// the choose function is something that I wrote to return
// a list of random elements
let message = choose(responses.greeting['returning'])[0];
// creates an instance of a Simple Response and passes our
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.