Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

all-true is not working #2

Closed
mericda opened this issue Oct 5, 2017 · 6 comments
Closed

all-true is not working #2

mericda opened this issue Oct 5, 2017 · 6 comments

Comments

@mericda
Copy link

mericda commented Oct 5, 2017

Hi,

I am having trouble catching matched phrases with all-true. If I remove all-true, it seems like it is working. Any tips?

@mericda
Copy link
Author

mericda commented Oct 5, 2017

Specifically, I am trying the example bot.rb, and hints are not working. It seems like it can't trigger postback action.

@progapandist
Copy link
Owner

Can you provide an example please? I’ll look into it

@progapandist
Copy link
Owner

progapandist commented Oct 5, 2017

In the demo bot, the all: true means, for instance, that the prompt for user location can be triggered by any of the phrases "Where am I", "Tell me where I am", etc, as long as all words "I", "where" and "am" are present in the sentence in any order. If one of them is missing — prompt won't be triggered. What's your use case?

@mericda
Copy link
Author

mericda commented Oct 5, 2017

Hi @progapandist, I am basically trying to work with the example bot.rb that you have provided, but it does not work when I try to click the hint words: where I am or take questionnaire.

I am not sure what is the problem. Maybe the quick replies can't catch the postback? or all:true does not work properly? In order to solve it temporarily, I have altered the code like this:

    bind "take questionnaire", "sample questionnaire", to: :start_questionnaire, start_thread: {
      message: questionnaire_welcome,
      quick_replies: questionnaire_replies
    }

    bind "Where am I?", to: :lookup_location, start_thread: {
      message: 'Let me know your location',
      quick_replies: LOCATION_PROMPT
    }

where is the original was:

    bind 'questionnaire', to: :start_questionnaire, start_thread: {
      message: questionnaire_welcome,
      quick_replies: questionnaire_replies
    }

    bind 'where', 'am', 'I', all: true, to: :lookup_location, start_thread: {
      message: 'Let me know your location',
      quick_replies: LOCATION_PROMPT
    }

I have also individually tried the code below, and when I type 'all true', it won't give me a response. so I believe all:true is somehow is not working.

    bind 'all', 'true', all:true do
      say "all true really"
    end

Thank you for your quick response!

@progapandist
Copy link
Owner

progapandist commented Oct 5, 2017

Hi, I guess it's my fault, I introduced a bug, here's how to fix it if you already cloned the boilerplate and adopted it for your project:

Change this line in message_dispatch.rb to:

regexps = regex_strings.map { |rs| /\b#{rs}/i }

Then please confirm that it worked and I'm going to update the boilerplate on GH too 😌

@mericda
Copy link
Author

mericda commented Oct 5, 2017

Yes, that solves the problem! Thank you so much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants