FredrikOseberg / react-chatbot-kit

MIT License
325 stars 155 forks source link

how to handle empty message with out rendering #52

Closed skmainwal closed 3 years ago

skmainwal commented 3 years ago

Hello Fredrik,thanks for your chatbot-kit .it helped me a lot . I am making a chatBot with a chatbot kit but I'm facing a problem that when I click on enter without message then chatbot kit render the empty message .I want to stop this one . here is the pic of issue. How can I remove this empty message .

image

FredrikOseberg commented 3 years ago

Hello Fredrik,thanks for your chatbot-kit .it helped me a lot . I am making a chatBot with a chatbot kit but I'm facing a problem that when I click on enter without message then chatbot kit render the empty message .I want to stop this one . here is the pic of issue. How can I remove this empty message .

image

Hi there!

You can pass a function to the chatbot to check if the client message is valid or not:

const validator = (input) => {
     if (input.length > 3) return true;
     return false
}

<Chatbot messageParser={messageParser} config={config) actionProvider={actionProvider} validator={validator} />
skmainwal commented 3 years ago

thanks Fredrik , it helped me .