Skip to content

Commit

Permalink
feat: data saturation for Forward entity
Browse files Browse the repository at this point in the history
  • Loading branch information
kutuzov13 committed Mar 21, 2024
1 parent e98a00d commit 6472122
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pybotx/models/message/forward.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dataclasses import dataclass
from datetime import datetime
from typing import Literal
from uuid import UUID

Expand All @@ -9,14 +10,18 @@
@dataclass
class Forward:
chat_id: UUID
chat_name: str
author_id: UUID
sync_id: UUID
inserted_at: datetime


class BotAPIForwardData(VerifiedPayloadBaseModel):
group_chat_id: UUID
sender_huid: UUID
source_sync_id: UUID
source_chat_name: str
source_inserted_at: datetime


class BotAPIForward(VerifiedPayloadBaseModel):
Expand Down
2 changes: 2 additions & 0 deletions pybotx/models/message/incoming_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ def convert_bot_api_entity_to_domain(api_entity: BotAPIEntity) -> Entity:

return Forward(
chat_id=api_entity.data.group_chat_id,
chat_name=api_entity.data.source_chat_name,
author_id=api_entity.data.sender_huid,
sync_id=api_entity.data.source_sync_id,
inserted_at=api_entity.data.source_inserted_at,
)

if api_entity.type == BotAPIEntityTypes.REPLY:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_incoming_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ async def default_handler(message: IncomingMessage, bot: Bot) -> None:
),
forward=Forward(
chat_id=UUID("918da23a-1c9a-506e-8a6f-1328f1499ee8"),
chat_name="Simple Chat",
inserted_at=datetime_formatter("2020-04-21T22:09:32.178Z"),
author_id=UUID("c06a96fa-7881-0bb6-0e0b-0af72fe3683f"),
sync_id=UUID("a7ffba12-8d0a-534e-8896-a0aa2d93a434"),
),
Expand Down

0 comments on commit 6472122

Please sign in to comment.