lmarkus/hubot-conversation

dialog "addChoice" never seems to timeout

Closed this issue · 2 comments

i use the latest package version, and my client is hipchat .. following your "clean the house example" .. here are the steps to reproduce:

#command 1

  • run command "clean the house"
  • ..do nothing greater than define timeout..
  • type: "kitchen" .. dialog times out .. expected behavior

#command 2

  • run command "clean the house"
  • respond: "kitchen"
  • bot replies: "on it boss"
  • ..wait longer than defined timeout period, default 30secs..
  • type "anything you want" in any room, anywhere, bot "sees it" but does nothing with it

how do i know this ?? because i use the hubot-audit package and it is logging EVERYTHING i type into my chat client, no matter what room i am in or if i am interacting with the bot or not ..

i tried tracking down the culprit but i cant seem to find it .. there is something about WHEN a match is legit, it doesn't seem to "notify" the bot that communication from the user is no longer considered direct communication .. MAYBE when a match occurs, we need to proactively remove the "_talkingTo[id]" variable ?? but would that then fooboo a nested dialog ??

anyway .. let me know how i can help ..

thanks for the great plugin ..
greg

sorry folks .. this was a fooboo by me .. i am now seeing the timeout .. don't know entirely why -- but it seems to be working as expected now .. must been some crappy code of mine ..

my solution was to force a timeout after the last dialog has ran .. hope this helps anyone else who might just be beginning their hubot-conversation journey ..

  dialog.addChoice(/(.+)/i, function (newMessage) {
    details.attempted = newMessage.match[1];
    summary(newMessage, details);
    dialog.emit('timeout', '');
  });

thanks @lmarkus for the great plugin !!

I love self-solving problems :)