Basic question here!
We're creating a chat bot using JavaScript which responds to certain words contained in messages posted by users on the chat.
Currently it responds to:
if(input.includes('bot') {}
however this also makes it respond to other words such as "bother" "bottle" and so on. We have tried the following
if(input.includes('bot ') || input.includes(' bot ') || input.includes(' bot')) {}
which actually stops it from responding to the stand-alone word "bot" and still responds to sentences such as "we both are" (because of ' bot'h are)
It's been a while since I've programmed things and would like some help with this, thanks!
Aucun commentaire:
Enregistrer un commentaire