Open iStooge opened 7 years ago
Ok i just found out that i have to add the Action directly into the hubot-wit.js file.
`// Example Action
findTheater({sessionId, context, text, entities}) {
console.log(`Session ${sessionId} received ${text}`);
console.log(`The current context is ${JSON.stringify(context)}`);
console.log(`Wit extracted ${JSON.stringify(entities)}`);
return Promise.resolve(context);
},`
Am I doing something wrong? Or does anyone have an idea howto automatically forward any action of a wit story to a Hubot event?
Hey!
Unfortunately this package still does not perform actions coming from Wit. It was initially created just for the purpose of conversation, but performs a specific action called "missing", passing to the hubot the value of the entity "command" in this case.
Look at the plugin code in hubot-wit.js
line 47:
missing(request) {
const { entities, context } = request;
console.log(entities);
const botCommand = firstEntityValue(entities, "command");
return new Promise(function(resolve, reject) {
robot.emit(botCommand, res);
return resolve();
});
}
In your case, you can do something like:
We also accept a "pull request" so that the package can execute an "emit" to the hubot of any action coming from "wit" :smile:
I will mark this issue as a feature request
label.
thanks
Ok :) I'll see what I can do!
Hey!
I just created the following storie:
Without the "Bot executes" command, the script seems to work fine. But as soon as i try to call a function (in this case
findTheater
) the script does not work correctly anymore!Here is my conversation:
And here the output of the console:
The first message always throws the error
No findTheater action found
. The second time it works but without calling the function.I created an event for Hubot:
But it is never called. I think the error of the not found action comes up before the script can even emit the event.
Does someone can help me to get this work?