I'm implementing message_reads and encountering the following issue:
Given the default route method in BotController, for example:
def route
if current_session.present?
step_to session: current_session
else
step_to flow: 'hello', state: 'say_hello'
end
end
When a message_read event occurs, the bot will go into an infinite loop.
In order to mitigate this, I'm creating *_read states for every state and doing this in the BotController:
def route
if current_session.present?
if !in_read_state? && current_message&.read.try(:[], :watermark)
step_to_read_state
else
step_to session: current_session
end
else
step_to flow: 'hello', state: 'say_hello'
end
end
def step_to_read_state
update_session_to state: "#{current_session.state_string}_read"
end
def in_read_state?
current_session.state_string.match(/_read$/)
end
however, this simply leads to dropping through the CatchAll stack.
Ideally, stealth should be able to handle events like message_read in a different way than actual message received events.
I'm implementing
message_readsand encountering the following issue:Given the default
routemethod inBotController, for example:When a
message_readevent occurs, the bot will go into an infinite loop.In order to mitigate this, I'm creating
*_readstates for every state and doing this in theBotController:however, this simply leads to dropping through the
CatchAllstack.Ideally, stealth should be able to handle events like
message_readin a different way than actual message received events.