dialogflow-botkit-client
dialogflow-botkit-client copied to clipboard
Implement a catch all
Hi,
Implement a catch all could be a great idea, I've imported an agent in dialogflow but I don't use all actions, so if dialog get some action that I don't use I'll get nothing.
This is my suggestion
if (isDefined(response.result)) {
let action = response.result.action;
if (isDefined(action)) {
if (worker.actionCallbacks[action]) {
worker.actionCallbacks[action].forEach((callback) => {
callback(message, response, bot);
});
}else{
worker.actionCallbacks['anythingelse'].forEach((callback) => {
callback(message, response, bot);
});
}
}
}