I try to make a simple chat bot. So far the bot answer is user type in defined question. But how can I make it that the chatbot gives out a "sorry I don't understand" if user ask something that is not defined?
function ai(message){
if (username.length<3){
username = message;
send_message("Nice to meet you " + username + ", how are you today?");
responsiveVoice.speak("Nice to meet you " + username + ", how are you today?");
}
if (message.toLowerCase().indexOf("how are you")>=0){
send_message("Thanks, Iam good!");
responsiveVoice.speak("Thanks, Iam good!");
}
if (message.toLowerCase().indexOf("time")>=0){
var date = new Date();
var h = date.getHours();
var m = date.getMinutes();
send_message("Current time is "+h+":"+m);
}
if (message.toLowerCase().indexOf("thanks")>=0){
send_message("You are welcome");
}
if (message.toLowerCase().indexOf("Thank you")>=0){
send_message("No Problem");
}
if (message.toLowerCase().indexOf("thank you very much")>=0){
send_message("Welcome Sir!");
}
}