123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- from datetime import datetime
- from math import floor
- from typing import Any, List
- from pydantic import BaseModel
-
- class Reaction(BaseModel):
- reaction: str
- actor: str
-
- class AudioFile(BaseModel):
- uri: str
- creation_timestamp: int
-
- class Video(BaseModel):
- uri: str
- creation_timestamp: int
-
- class Photo(BaseModel):
- uri: str
- creation_timestamp: int
-
- class Gif(BaseModel):
- uri: str
-
- class Share(BaseModel):
- link: str
- share_text: str
-
- class Sticker(BaseModel):
- uri: str
- ai_stickers: List[Any]
-
- class Message(BaseModel):
- sender_name: str
- timestamp_ms: int
- content: str | None = None
- sticker: Sticker | None = None
- share: Share | None = None
- photos: List[Photo] | None = None
- videos: List[Video] | None = None
- gifs: List[Gif] | None = None
- audio_files: List[AudioFile] | None = None
- call_duration: int | None = None
- reactions: List[Reaction] | None = None
- is_unsent: bool | None = None
- is_geoblocked_for_viewer: bool
-
- def __str__(self) -> str:
- dt = datetime.fromtimestamp(self.timestamp_ms / 1000)
- dt_str = dt.strftime("%d/%m/%Y, %H:%M:%S")
- return f"{self.sender_name}({dt_str}) : {self.content}"
|