You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I add the wit.ai middleware and pass it as a parameter in the $bot->middleware->received($wit_middleware)
I listen all the hears commands inside of a group function passing the wit middleware as a value for the key 'middleware'
$botman->group(['middleware' => $wit_middleware], function ($botman_object) {
//? incident_create is an intent in wit.ai
$botman_object->hears('incident_create', function (BotMan $bot) {
$user = $bot->getUser();
$message = $bot->getMessage()->getExtras()['entities'];
$message = $message['incident_create:incident_create'][0]['value'];
$bot->reply($message);
});
});
and I have a normal listened command
$botman->hears('conversation', function ($bot) {
$bot->startConversation(new IncidentConversation($bot));
});
and lastly I have a fallback
//? Fallback
$botman->fallback(function (BotMan $bot) {
//? The fallback can access the heard middleware information like getExtras
$user = $bot->getMessage()->getExtras('user');
$date = $bot->getMessage()->getExtras('date');
$message = $bot->getMessage()->getText();
$bot->reply('On '. $date . ', the message provided from "'.$user. '" could not be processed!');
$bot->reply('Original message: "'. $message. '"');
});
The problem is when I send a command that is not listened on wit.ai but on botman like the command conversation
then the matching function in wit middleware matches the pattern as if I have sent the wit.ai command instead.
How can I implement local commands with wit.ai commands, or should all the commands go directly to wit.ai and therefor local commands cannot be used locally when wit.ai is used ?
Steps To Reproduce:
1-Added wit middleware and configured it with the token and added it using received $botman->middleware->received($wit_middleware);
2-Added a command that is bound to the wit middleware using group
$botman->group(['middleware' => $wit_middleware], function ($botman_object) {
//? incident_create is an intent in wit.ai
$botman_object->hears('incident_create', function (BotMan $bot) {
$user = $bot->getUser();
$message = $bot->getMessage()->getExtras()['entities'];
$message = $message['incident_create:incident_create'][0]['value'];
$bot->reply($message);
});
});
3-Added a normal command using botman
$botman->hears('conversation', function ($bot) {
$bot->startConversation(new IncidentConversation($bot));
});
4-Added a fallback
//? Fallback
$botman->fallback(function (BotMan $bot) {
//? The fallback can access the heard middleware information like getExtras
$user = $bot->getMessage()->getExtras('user');
$date = $bot->getMessage()->getExtras('date');
$message = $bot->getMessage()->getText();
$bot->reply('On '. $date . ', the message provided from "'.$user. '" could not be processed!');
$bot->reply('Original message: "'. $message. '"');
});
The text was updated successfully, but these errors were encountered:
Description:
When I add the wit.ai middleware and pass it as a parameter in the
$bot->middleware->received($wit_middleware)
I listen all the hears commands inside of a group function passing the wit middleware as a value for the key
'middleware'
and I have a normal listened command
and lastly I have a fallback
The problem is when I send a command that is not listened on wit.ai but on botman like the command
conversation
then the matching function in wit middleware matches the pattern as if I have sent the wit.ai command instead.
How can I implement local commands with wit.ai commands, or should all the commands go directly to wit.ai and therefor local commands cannot be used locally when wit.ai is used ?
Steps To Reproduce:
1-Added wit middleware and configured it with the token and added it using received
$botman->middleware->received($wit_middleware);
2-Added a command that is bound to the wit middleware using group
3-Added a normal command using botman
4-Added a fallback
The text was updated successfully, but these errors were encountered: