13 lines
520 B
Python
13 lines
520 B
Python
|
|
from yuxi.channel.extensions.intercom.types import IntercomInboundEvent
|
||
|
|
|
||
|
|
|
||
|
|
class ConversationStateGuard:
|
||
|
|
@staticmethod
|
||
|
|
def should_respond(event: IntercomInboundEvent, account: dict) -> tuple[bool, str]:
|
||
|
|
state = event.conversation_state
|
||
|
|
if state == "closed" and account.get("auto_skip_closed", True):
|
||
|
|
return False, "conversation_closed"
|
||
|
|
if state == "snoozed" and account.get("auto_skip_snoozed", True):
|
||
|
|
return False, "conversation_snoozed"
|
||
|
|
return True, "ok"
|