ForcePilot/backend/package/yuxi/channel/extensions/bluebubbles/format.py

22 lines
691 B
Python
Raw Normal View History

def format_target_display(raw: str) -> str:
if raw.startswith("chat_guid:"):
guid = raw[len("chat_guid:") :]
parts = guid.split(";")
if len(parts) >= 3:
return parts[2]
return guid[:12] + "..."
return raw
def format_chat_display(chat_data: dict) -> str:
name = chat_data.get("displayName") or chat_data.get("chat_identifier") or chat_data.get("guid", "")
return name
def format_participant_display(participant: dict) -> str:
name = participant.get("displayName") or participant.get("name") or ""
if not name:
handle = participant.get("handle") or participant.get("id", "")
name = handle
return name