Replace BusinessConnection.date type

This commit is contained in:
JRoot Junior 2024-04-08 02:24:40 +03:00
parent 61d1bcdd96
commit 8048a6428b
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
3 changed files with 9 additions and 3 deletions

View file

@ -0,0 +1,5 @@
annotations:
date:
parsed_type:
type: std
name: DateTime

View file

@ -2,6 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .custom import DateTime
from .base import TelegramObject
if TYPE_CHECKING:
@ -21,7 +22,7 @@ class BusinessConnection(TelegramObject):
"""Business account user that created the business connection"""
user_chat_id: int
"""Identifier of a private chat with the user who created the business connection. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier."""
date: int
date: DateTime
"""Date the connection was established in Unix time"""
can_reply: bool
"""True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours"""
@ -38,7 +39,7 @@ class BusinessConnection(TelegramObject):
id: str,
user: User,
user_chat_id: int,
date: int,
date: DateTime,
can_reply: bool,
is_enabled: bool,
**__pydantic_kwargs: Any,

View file

@ -548,7 +548,7 @@ class TestDispatcher:
id="qwerty",
user=User(id=42, is_bot=False, first_name="Test"),
user_chat_id=42,
date=int(time.time()),
date=datetime.datetime.now(),
can_reply=True,
is_enabled=True,
),