import re MAX_MESSAGE_CHARS = 12_000 def is_owner(user_id: int | None, owner_id: int) -> bool: return user_id is not None and user_id == owner_id def is_allowed_chat(chat_id: int, chat_type: str, project_group_id: int, owner_id: int) -> bool: return chat_id == project_group_id or (chat_type == "private" and chat_id == owner_id) def redact_for_logs(text: str) -> str: return f"" def clean_user_text(text: str) -> str: return text.strip()[:MAX_MESSAGE_CHARS] def safe_filename(name: str) -> str: return re.sub(r"[^A-Za-z0-9._-]", "_", name).strip(".") or "attachment"