Skip to content

Instantly share code, notes, and snippets.

Jessica Dene Earley-Cha chatasweetie

Block or report user

Report or block chatasweetie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View selectSuggestionChips.js
/**
* Selects suggestion chips
* @param {obj} conv, the conversation object.
* @return [] array of suggestion chips.
*/
function selectSuggestionChips(conv) {
let suggestions = [];
for (let i=0; i < conv.data.intentFulfilled.length; i++) {
if (conv.data.intentFulfilled[i] === 0) {
suggestions.push(responses.SUGGESTIONS['MENU')[i]);
View recordsIntentFulfillment.js
/**
* Records which options the user has complete
* @param {obj} conv, the conversation object.
* @param num conv, the conversation object.
* @return {null} none.
*/
function recordsIntentFulfillment(conv, intentName) {
const convertIntentValue = {
'gdg': 0,
'next event': 1,
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.