+
Skip to content

create framework to allow for bot "dialogs" #149

Open
@gkspranger

Description

@gkspranger

as a YB dev,
i would like the ability to code multi-step dialogs,
so that my users can interact with YB in a "deeper" manner ..

right now, my user interactions with YB are very "shallow" -- meaning :: a command is issued (with or without args), YB does the thing, task complete .. this is great for 80% of the commands i create ..

that said, i would like for my users to have the ability to have "deeper", multi-step dialogs with YB, such that ::

  1. a YB command is invoked which triggers a response, that asks for additional data (i.e. question)
  2. additional data can be pulled from the user via a YB-question/USER-response format
    -- a USER-response may invoke additional YB-questions
  3. YB can alter the YB-question flow based on previous USER-responses
    -- IF response =~ YES; THEN do X; ELSE do Y ENDIF;
  4. the final outcome will have access to all USER-responses during the dialog
  5. at any point in time, the user should be able to STOP the dialog
  6. all dialog YB-questions should have a timeout setting, that will invoke some action
    -- that said, maybe it is possible to "save" a dialog that a YB user can restart ??

i don't expect this to be easy, and am willing to help however i can .. if i have any say on the impl details, it is that i have used both the HUBOT version of this (https://www.npmjs.com/package/hubot-conversation) and the ERRBOT version of this (https://github.com/errbotio/err-guess-a-number) -- and i much prefer the HUBOT approach ..

please forgive my pseudo code, but it would be great if the flow of the dialog could follow something like you see below .. ONE GLARING omission is being able to have nested questions based on responses .. for example ::

;; there needs to be a clean way to nest questions based on responses
{:question
 {:text "are you older than 60"
  :response
  [{:test "yes"
    :question
    {:text "are you older than 120"}
    :response
    [{:test "yes"
      :return "you are really old"}
     {:test "no"
      :return "you are old"}]}
   {:test "no"
    :return "you are young"}]}}
;; dopey attempt at what some code might look like
(defn greeting-dialog
  "greeting-dialog # converse with the bot so you can properly be greeted"
  [_]
  (dialog
   (question "what is your name?" :name
             (response #".+"))
   
   (question "are you older than 40? (yes or no)" :older-than-40
             (response-if #"y(i|u)p|yes|y" true)
             (response-if #".+" false))
   
   (final
    (str "Hello " ((:name responses)) ". I hear you are "
         (when (not (:older-than-40 responses)) "not ")
         "older than 40."))))

(cmd-hook #"greeting-dialog"
          _ greeting-dialog)

anyway -- just wanted to open this and get the ball rolling .. thanks !!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载