Skip to content

Commit

Permalink
tidied up name parsing + celebrity crush -> do you have a crush
Browse files Browse the repository at this point in the history
  • Loading branch information
agnescameron committed May 21, 2020
1 parent f9c7d6b commit 8c22721
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
16 changes: 16 additions & 0 deletions src/helpers/lib/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ export const tags =
{
"response": "not sure what you mean",
"context": ""
},
{
"response": "im not sure haha",
"context": ""
},
{
"response": "idk lol",
"context": ""
},
{
"response": "no idea, wbu",
"context": ""
}
]
},
Expand All @@ -68,6 +80,10 @@ export const tags =
{
"response": "kanye's",
"context": ""
},
{
"response": "like everything in this world, belongs to god",
"context": ""
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/lib/truths.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export const truths = [
},

{
"response": "what's your weirdest celebrity crush?",
"context": "celebrity"
"response": "do you have a crush right now?",
"context": "crush"
},

{
Expand Down
7 changes: 3 additions & 4 deletions src/helpers/textProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ function parseNameQueries(sent, bot, botName, playerName){
return output;
}
}
sent = sent.replace(botName, '')
}


Expand Down Expand Up @@ -334,7 +333,7 @@ async function parseGeneric(sent, bot, messages, botName, playerName) {

if(sent.includes(botName)){
const output = parseNameQueries(sent, bot, botName, playerName);
return output;
if (output) return output;
}

//checks against common forms of response
Expand All @@ -352,7 +351,6 @@ async function parseGeneric(sent, bot, messages, botName, playerName) {

export const changeConversation = async (sent, bot) => {
const roundType = bot.name === "intro_bot" ? 'intro' : 'later'

//gonna change the conversation now
const questions = genericParser.filter(type => type.name === roundType)[0]
const output = getResponse(questions.responses, bot)
Expand All @@ -377,7 +375,8 @@ export const textProcessor = async (sent, bot, messages, botName, playerName) =>

//if nothing send the bot
if(botResponse === undefined || botResponse === ''){
let botResponseObject = await runSample(sent, bot);
//get rid of the bot's name if we're not using it
let botResponseObject = await runSample(sent.replace(botName, '').trim(), bot);
botResponseObject = JSON.parse(botResponseObject);

//intervene if fallback and truth challenge
Expand Down

0 comments on commit 8c22721

Please sign in to comment.