hellostealth / stealth

An open source Ruby framework for text and voice chatbots. 🤖

Home Page:https://hellostealth.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bot loop when use Stealth(1.1.6) and stealth-facebook(0.13.1)

luizcarvalho opened this issue · comments

Hello friends,

I'm trying Stealth 1.1.6 with stealth-facebook 1.13.1 and bot entered in loop, because of the reads_event (sorry for that, my fault).

The error occurs because Stealth understand that reads_events is a message, so, it send a "hello message" again, and when user views the message, Stealth receive reads_event again and...

Screenshot from 2019-03-28 17-31-51

We can solve this if a little verification, like this, in BotController

class BotController < Stealth::Controller

  helper :all

  def route
    if @current_message.message
      if current_session.present?
        step_to session: current_session
      else
        step_to flow: 'hello', state: 'say_hello'
      end
    end
  end

end