-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
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
endWhen 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$/)
endhowever, 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.
exadeci
Metadata
Metadata
Assignees
Labels
No labels