ForcePilot/backend/package/yuxi/channel/extensions/zoomchat/session.py

13 lines
496 B
Python
Raw Normal View History

def build_dm_session_key(email: str, account_id: str) -> str:
return f"zoomchat:dm:{account_id}:{email}"
def build_group_session_key(channel_id: str, account_id: str) -> str:
return f"zoomchat:group:{account_id}:{channel_id}"
def resolve_session_key(chat_type: str, peer_id: str, channel_id: str | None, account_id: str) -> str:
if chat_type == "1on1":
return build_dm_session_key(peer_id, account_id)
return build_group_session_key(channel_id or peer_id, account_id)