Yash030/claude-code-proxy
2
1"""Platform-agnostic message models."""2 3from dataclasses import dataclass, field4from datetime import UTC, datetime5from typing import Any6 7 8@dataclass9class IncomingMessage:10 """11 Platform-agnostic incoming message.12 13 Adapters convert platform-specific events to this format.14 """15 16 text: str17 chat_id: str18 user_id: str19 message_id: str20 platform: str # "telegram", "discord", "slack", etc.21 22 # Optional fields23 reply_to_message_id: str | None = None24 # Forum topic ID (Telegram); required when replying in forum supergroups25 message_thread_id: str | None = None26 username: str | None = None27 # Pre-sent status message ID (e.g. "Transcribing voice note..."); handler edits in place28 status_message_id: str | None = None29 timestamp: datetime = field(default_factory=lambda: datetime.now(UTC))30 31 # Platform-specific raw event for edge cases32 raw_event: Any = None33 34 def is_reply(self) -> bool:35 """Check if this message is a reply to another message."""36 return self.reply_to_message_id is not None37 