Поправлено преобразование вложений для ответа на callback
This commit is contained in:
parent
b59d97da8a
commit
e922132319
@ -0,0 +1,25 @@
|
||||
from typing import Annotated, Union
|
||||
|
||||
from pydantic import Field
|
||||
from ..attachments.share import Share
|
||||
from ..attachments.buttons.attachment_button import AttachmentButton
|
||||
from ..attachments.sticker import Sticker
|
||||
from ..attachments.file import File
|
||||
from ..attachments.image import Image
|
||||
from ..attachments.video import Video
|
||||
from ..attachments.audio import Audio
|
||||
from ..attachments.location import Location
|
||||
from ..attachments.contact import Contact
|
||||
|
||||
|
||||
Attachments = Annotated[Union[
|
||||
Audio,
|
||||
Video,
|
||||
File,
|
||||
Image,
|
||||
Sticker,
|
||||
Share,
|
||||
Location,
|
||||
AttachmentButton,
|
||||
Contact
|
||||
], Field(discriminator='type')]
|
@ -1,9 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Annotated, Any, Optional, List, Union, TYPE_CHECKING
|
||||
from typing import Any, Optional, List, Union, TYPE_CHECKING
|
||||
|
||||
from ..types.attachments.contact import Contact
|
||||
from ..types.attachments import Attachments
|
||||
|
||||
from ..enums.text_style import TextStyle
|
||||
from ..enums.parse_mode import ParseMode
|
||||
@ -11,14 +11,6 @@ from ..enums.chat_type import ChatType
|
||||
from ..enums.message_link_type import MessageLinkType
|
||||
|
||||
from .attachments.attachment import Attachment
|
||||
from .attachments.share import Share
|
||||
from .attachments.buttons.attachment_button import AttachmentButton
|
||||
from .attachments.sticker import Sticker
|
||||
from .attachments.file import File
|
||||
from .attachments.image import Image
|
||||
from .attachments.video import Video
|
||||
from .attachments.audio import Audio
|
||||
from .attachments.location import Location
|
||||
|
||||
from .users import User
|
||||
|
||||
@ -28,19 +20,6 @@ if TYPE_CHECKING:
|
||||
from ..types.input_media import InputMedia, InputMediaBuffer
|
||||
|
||||
|
||||
Attachments = Annotated[Union[
|
||||
Audio,
|
||||
Video,
|
||||
File,
|
||||
Image,
|
||||
Sticker,
|
||||
Share,
|
||||
Location,
|
||||
AttachmentButton,
|
||||
Contact
|
||||
], Field(discriminator='type')]
|
||||
|
||||
|
||||
class MarkupElement(BaseModel):
|
||||
|
||||
"""
|
||||
|
@ -1,25 +1,18 @@
|
||||
from typing import List, Optional, Union
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from ...types.attachments.location import Location
|
||||
from ...types.attachments import Attachments
|
||||
|
||||
|
||||
from .update import Update
|
||||
|
||||
from ...enums.parse_mode import ParseMode
|
||||
|
||||
from ...types.message import NewMessageLink
|
||||
from ...types.attachments.share import Share
|
||||
from ...types.callback import Callback
|
||||
from ...types.message import Message
|
||||
|
||||
from ..attachments.buttons.attachment_button import AttachmentButton
|
||||
from ..attachments.sticker import Sticker
|
||||
from ..attachments.file import File
|
||||
from ..attachments.image import Image
|
||||
from ..attachments.video import Video
|
||||
from ..attachments.audio import Audio
|
||||
|
||||
|
||||
class MessageForCallback(BaseModel):
|
||||
|
||||
@ -37,18 +30,7 @@ class MessageForCallback(BaseModel):
|
||||
|
||||
text: Optional[str] = None
|
||||
attachments: Optional[
|
||||
List[
|
||||
Union[
|
||||
AttachmentButton,
|
||||
Audio,
|
||||
Video,
|
||||
File,
|
||||
Image,
|
||||
Sticker,
|
||||
Share,
|
||||
Location
|
||||
]
|
||||
]
|
||||
List[Attachments]
|
||||
] = Field(default_factory=list) # type: ignore
|
||||
link: Optional[NewMessageLink] = None
|
||||
notify: Optional[bool] = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user