mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Override InputPaidMedia media type to str | InputFile
This commit is contained in:
parent
c59d328408
commit
7634587fa4
4 changed files with 28 additions and 5 deletions
11
.butcher/types/InputPaidMediaPhoto/replace.yml
Normal file
11
.butcher/types/InputPaidMediaPhoto/replace.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
annotations:
|
||||
media:
|
||||
parsed_type:
|
||||
type: union
|
||||
items:
|
||||
- type: std
|
||||
name: str
|
||||
- type: entity
|
||||
references:
|
||||
category: types
|
||||
name: InputFile
|
||||
11
.butcher/types/InputPaidMediaVideo/replace.yml
Normal file
11
.butcher/types/InputPaidMediaVideo/replace.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
annotations:
|
||||
media:
|
||||
parsed_type:
|
||||
type: union
|
||||
items:
|
||||
- type: std
|
||||
name: str
|
||||
- type: entity
|
||||
references:
|
||||
category: types
|
||||
name: InputFile
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Literal
|
||||
from typing import TYPE_CHECKING, Any, Literal, Union
|
||||
|
||||
from ..enums import InputPaidMediaType
|
||||
from .input_paid_media import InputPaidMedia
|
||||
from .input_file import InputFile
|
||||
|
||||
|
||||
class InputPaidMediaPhoto(InputPaidMedia):
|
||||
|
|
@ -15,7 +16,7 @@ class InputPaidMediaPhoto(InputPaidMedia):
|
|||
|
||||
type: Literal[InputPaidMediaType.PHOTO] = InputPaidMediaType.PHOTO
|
||||
"""Type of the media, must be *photo*"""
|
||||
media: str
|
||||
media: Union[str, InputFile]
|
||||
"""File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -26,7 +27,7 @@ class InputPaidMediaPhoto(InputPaidMedia):
|
|||
__pydantic__self__,
|
||||
*,
|
||||
type: Literal[InputPaidMediaType.PHOTO] = InputPaidMediaType.PHOTO,
|
||||
media: str,
|
||||
media: Union[str, InputFile],
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class InputPaidMediaVideo(InputPaidMedia):
|
|||
|
||||
type: Literal[InputPaidMediaType.VIDEO] = InputPaidMediaType.VIDEO
|
||||
"""Type of the media, must be *video*"""
|
||||
media: str
|
||||
media: Union[str, InputFile]
|
||||
"""File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
|
||||
thumbnail: Optional[Union[InputFile, str]] = None
|
||||
"""*Optional*. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
|
||||
|
|
@ -37,7 +37,7 @@ class InputPaidMediaVideo(InputPaidMedia):
|
|||
__pydantic__self__,
|
||||
*,
|
||||
type: Literal[InputPaidMediaType.VIDEO] = InputPaidMediaType.VIDEO,
|
||||
media: str,
|
||||
media: Union[str, InputFile],
|
||||
thumbnail: Optional[Union[InputFile, str]] = None,
|
||||
width: Optional[int] = None,
|
||||
height: Optional[int] = None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue