botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

bot not waiting for Prompts.text input

Open bearnshaw opened this issue 10 years ago • 3 comments

Running the following (intentionally simplified) code example:

...
var intents = new builder.IntentDialog();
bot.dialog('/', intents);

intents.matches(/^hi/i,
    function (session, args, next) {
      session.beginDialog('/getname');
      next();
    }
);

bot.dialog('/getname', [
    function (session) {
      builder.Prompts.text(session, 'Hi! What is your name?');
    },
    function (session, results) {
      session.userData.name = results.response;
      session.send('Nice to meet you %s.', session.userData.name);
      session.endDialog();
    }
]);

results in the following (I'm using the Emulator here):

Send message to bot:
hi
User1 said:
 hi
Bot1 said:
 Hi! What is your name?
Bot1 said:
 Nice to meet you undefined.

Notice that the bot did not wait at the Prompts.text for input. Is this a bug, or am I doing something wrong?

I'm using node 7.0.0, botbuilder 3.4.2

bearnshaw avatar Nov 01 '16 11:11 bearnshaw

Nevermind, I guess it's because of the next() function.

bearnshaw avatar Nov 01 '16 14:11 bearnshaw

Ran the following code and the prompt was not waiting for the client's selection of choice.

bot.dialog('/Choices',[
                        function(session){
                                session.send("Please select one of the following Choices")
                                builder.Prompts.choice(session," ","Choice1|Choice2|Choice3");
                        },
                        function(session,results){
                            var selection = results.response.entity
                            console.log("Prompt Response")
                            session.beginDialog("/"+results.response.entity
                        }
                        ])

Bot was taking the " undefined " as the choice and giving the following Error

Error: Dialog[*:/undefined] not found. at Session.beginDialog (/home/user/node_modules/botbuilder/lib/Session.js:134:19) at Array.<anonymous> (/home/user/workspace/XCubeLabsBOT/BOT2.js:141:35) at SimpleDialog.waterfallAction [as fn] (/home/user/node_modules/botbuilder/lib/dialogs/DialogAction.js:116:32) at SimpleDialog.dialogResumed (/home/user/node_modules/botbuilder/lib/dialogs/SimpleDialog.js:20:14) at Session.endDialog (/home/user/node_modules/botbuilder/lib/Session.js:214:28) at Array.<anonymous> (/home/user/workspace/XCubeLabsBOT/BOT2.js:65:33) at SimpleDialog.waterfallAction [as fn] (/home/user/node_modules/botbuilder/lib/dialogs/DialogAction.js:116:32) at SimpleDialog.dialogResumed (/home/user/node_modules/botbuilder/lib/dialogs/SimpleDialog.js:20:14 at Session.endDialogWithResult (/home/user/node_modules/botbuilder/lib/Session.js:237:28) at SimpleDialog.waterfallAction [as fn] (/home/user/node_modules/botbuilder/lib/dialogs/DialogAction.js:123:19)

rampratheek avatar Nov 02 '16 13:11 rampratheek

@rampratheek did u get the solution for this ?

vishmonne avatar Nov 09 '18 07:11 vishmonne