diff --git a/pybotx/models/system_events/event_edit.py b/pybotx/models/system_events/event_edit.py index ccfd17e8..2e0bd662 100644 --- a/pybotx/models/system_events/event_edit.py +++ b/pybotx/models/system_events/event_edit.py @@ -1,5 +1,6 @@ from dataclasses import dataclass from typing import Any, Dict, List, Literal, Optional +from uuid import UUID from pydantic import Field @@ -10,9 +11,9 @@ convert_api_attachment_to_domain, ) from pybotx.models.base_command import ( - BaseBotAPIContext, BotAPIBaseCommand, BotAPIBaseSystemEventPayload, + BotAPIUserContext, BotCommandBase, ) from pybotx.models.bot_account import BotAccount @@ -30,11 +31,17 @@ class EventEdit(BotCommandBase): Attributes: body: Updated message body. + sync_id: Updated message sync id. + chat_id: Updated message chat id. + huid: Updated message user huid. attachments: Attachments from updated message. entities: Entities from updated message. """ body: Optional[str] + sync_id: UUID + chat_id: UUID + huid: UUID attachments: List[IncomingAttachment] entities: List[Entity] @@ -48,9 +55,15 @@ class BotAPIEventEditPayload(BotAPIBaseSystemEventPayload): data: BotAPIEventEditData +class BotAPIBotContext(BotAPIUserContext): + """Bot context.""" + + group_chat_id: UUID + + class BotAPIEventEdit(BotAPIBaseCommand): payload: BotAPIEventEditPayload = Field(..., alias="command") - sender: BaseBotAPIContext = Field(..., alias="from") + sender: BotAPIBotContext = Field(..., alias="from") attachments: List[BotAPIAttachment] entities: List[BotAPIEntity] @@ -73,4 +86,7 @@ def to_domain(self, raw_command: Dict[str, Any]) -> EventEdit: convert_bot_api_entity_to_domain(api_entity=entity) for entity in self.entities ], + sync_id=self.sync_id, + chat_id=self.sender.group_chat_id, + huid=self.sender.user_huid, ) diff --git a/pyproject.toml b/pyproject.toml index 17451d83..e8894e90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybotx" -version = "0.66.0" +version = "0.66.1" description = "A python library for interacting with eXpress BotX API" authors = [ "Sidnev Nikolay ", diff --git a/tests/system_events/test_event_edit.py b/tests/system_events/test_event_edit.py index 6a07b1a6..9207a5ef 100644 --- a/tests/system_events/test_event_edit.py +++ b/tests/system_events/test_event_edit.py @@ -60,8 +60,8 @@ async def test__event_edit__succeed( }, ], "from": { - "user_huid": None, - "group_chat_id": None, + "user_huid": "fbc84c63-e432-4ff1-99bd-c3275f053866", + "group_chat_id": "6fe9b0e7-32e3-4843-8486-897eabd69422", "ad_login": None, "ad_domain": None, "username": None, @@ -123,4 +123,7 @@ async def event_edit_handler(event: EventEdit, _: Bot) -> None: name="Вася Иванов", ), ], + sync_id=UUID("a465f0f3-1354-491c-8f11-f400164295cb"), + huid=UUID("fbc84c63-e432-4ff1-99bd-c3275f053866"), + chat_id=UUID("6fe9b0e7-32e3-4843-8486-897eabd69422"), )