Skip to content

Commit

Permalink
small correction
Browse files Browse the repository at this point in the history
  • Loading branch information
agnescameron committed Feb 5, 2020
1 parent 7159e7f commit 9fd657a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ class App extends Component {
}
}

processResponse = async (text) => {
processResponse = (text) => {

let messages;
//check if message pure punctuation, let it pass if so
if(text.match(/[a-zA-Z\s]/g)){
if(text.match(/[a-zA-Z]/g)){
//breaks sentences into different messages
messages = text
.match(/[^.!?]+[.!?]*/g)
.map(str => str.trim());
}
else messages = text;

//error handling
if(!messages) messages = "huh??";

this.botQueue = this.botQueue.concat(messages);

// start processing bot queue
Expand Down

0 comments on commit 9fd657a

Please sign in to comment.