Coder Social home page Coder Social logo

all-true is not working about rubotnik HOT 6 CLOSED

progapandist avatar progapandist commented on June 19, 2024
all-true is not working

from rubotnik.

Comments (6)

mericda avatar mericda commented on June 19, 2024

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

from rubotnik.

progapandist avatar progapandist commented on June 19, 2024

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

from rubotnik.

progapandist avatar progapandist commented on June 19, 2024

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?

from rubotnik.

mericda avatar mericda commented on June 19, 2024

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!

from rubotnik.

progapandist avatar progapandist commented on June 19, 2024

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 😌

from rubotnik.

mericda avatar mericda commented on June 19, 2024

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

from rubotnik.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.