ForcePilot/backend/package/yuxi/channels/adapters/googlechat/threads.py

19 lines
513 B
Python
Raw Normal View History

from __future__ import annotations
def parse_thread_key(message: dict) -> str | None:
return message.get("thread", {}).get("threadKey")
def extract_thread_metadata(message: dict) -> dict:
thread = message.get("thread", {})
return {
"thread_key": thread.get("threadKey"),
"thread_name": thread.get("name"),
"is_thread_root": not bool(thread.get("threadKey")),
}
def is_thread_message(message: dict) -> bool:
return bool(message.get("thread", {}).get("threadKey"))