+ 3
Key concepts to creating a basic chat bot.
Requirements: - Method to get user input(s). - Method to display a response. - Conditional statements (If, else if, and else). - An error message if a condition is not met (Used by the else condition). Optional: - Use "x.indexOf('string to find from user's response')!=-1)" This will allow the code to find a match in the user's response. An example for this being useful would be... "/say (user's response here)" In combination with array, you can have the program "speak" what the user's "Response Here" is.
2 odpowiedzi
+ 2
(I was not able to add more...)
Another tip would be to convert the user's input string into all lowercase letters: "document.getElementById('input').value.toLowerCase();"
- 2
This isnt really a question.
Btw, I checked out your code and cookies don't work on SL mobile app.
Also. Take a look at how I used toUpperCase() to make input case insensitive in my chatBot.
https://code.sololearn.com/WELA9BYaWs7y/?ref=app