mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added InputMediaType enum
This commit is contained in:
parent
6b27441b7b
commit
c60ee8e40e
10 changed files with 51 additions and 5 deletions
14
.butcher/enums/InputMediaType.yml
Normal file
14
.butcher/enums/InputMediaType.yml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
name: InputMediaType
|
||||
description: |
|
||||
This object represents input media type
|
||||
|
||||
Source: https://core.telegram.org/bots/api#inputmedia
|
||||
multi_parse:
|
||||
attribute: type
|
||||
regexp: 'must be ([a-z_]+)'
|
||||
entities:
|
||||
- InputMediaAnimation
|
||||
- InputMediaAudio
|
||||
- InputMediaDocument
|
||||
- InputMediaPhoto
|
||||
- InputMediaVideo
|
||||
|
|
@ -4,6 +4,7 @@ from .chat_member_status import ChatMemberStatus
|
|||
from .chat_type import ChatType
|
||||
from .content_type import ContentType
|
||||
from .dice_emoji import DiceEmoji
|
||||
from .input_media_type import InputMediaType
|
||||
from .menu_button_type import MenuButtonType
|
||||
from .message_entity_type import MessageEntityType
|
||||
from .parse_mode import ParseMode
|
||||
|
|
@ -18,6 +19,7 @@ __all__ = (
|
|||
"ChatType",
|
||||
"ContentType",
|
||||
"DiceEmoji",
|
||||
"InputMediaType",
|
||||
"MenuButtonType",
|
||||
"MessageEntityType",
|
||||
"ParseMode",
|
||||
|
|
|
|||
15
aiogram/enums/input_media_type.py
Normal file
15
aiogram/enums/input_media_type.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class InputMediaType(str, Enum):
|
||||
"""
|
||||
This object represents input media type
|
||||
|
||||
Source: https://core.telegram.org/bots/api#inputmedia
|
||||
"""
|
||||
|
||||
ANIMATION = "animation"
|
||||
AUDIO = "audio"
|
||||
DOCUMENT = "document"
|
||||
PHOTO = "photo"
|
||||
VIDEO = "video"
|
||||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional, Union
|
|||
|
||||
from pydantic import Field
|
||||
|
||||
from ..enums import InputMediaType
|
||||
from .base import UNSET
|
||||
from .input_media import InputMedia
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ class InputMediaAnimation(InputMedia):
|
|||
Source: https://core.telegram.org/bots/api#inputmediaanimation
|
||||
"""
|
||||
|
||||
type: str = Field("animation", const=True)
|
||||
type: str = Field(InputMediaType.ANIMATION, const=True)
|
||||
"""Type of the result, must be *animation*"""
|
||||
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>`"""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional, Union
|
|||
|
||||
from pydantic import Field
|
||||
|
||||
from ..enums import InputMediaType
|
||||
from .base import UNSET
|
||||
from .input_media import InputMedia
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ class InputMediaAudio(InputMedia):
|
|||
Source: https://core.telegram.org/bots/api#inputmediaaudio
|
||||
"""
|
||||
|
||||
type: str = Field("audio", const=True)
|
||||
type: str = Field(InputMediaType.AUDIO, const=True)
|
||||
"""Type of the result, must be *audio*"""
|
||||
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>`"""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional, Union
|
|||
|
||||
from pydantic import Field
|
||||
|
||||
from ..enums import InputMediaType
|
||||
from .base import UNSET
|
||||
from .input_media import InputMedia
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ class InputMediaDocument(InputMedia):
|
|||
Source: https://core.telegram.org/bots/api#inputmediadocument
|
||||
"""
|
||||
|
||||
type: str = Field("document", const=True)
|
||||
type: str = Field(InputMediaType.DOCUMENT, const=True)
|
||||
"""Type of the result, must be *document*"""
|
||||
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>`"""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional, Union
|
|||
|
||||
from pydantic import Field
|
||||
|
||||
from ..enums import InputMediaType
|
||||
from .base import UNSET
|
||||
from .input_media import InputMedia
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ class InputMediaPhoto(InputMedia):
|
|||
Source: https://core.telegram.org/bots/api#inputmediaphoto
|
||||
"""
|
||||
|
||||
type: str = Field("photo", const=True)
|
||||
type: str = Field(InputMediaType.PHOTO, const=True)
|
||||
"""Type of the result, must be *photo*"""
|
||||
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>`"""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional, Union
|
|||
|
||||
from pydantic import Field
|
||||
|
||||
from ..enums import InputMediaType
|
||||
from .base import UNSET
|
||||
from .input_media import InputMedia
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ class InputMediaVideo(InputMedia):
|
|||
Source: https://core.telegram.org/bots/api#inputmediavideo
|
||||
"""
|
||||
|
||||
type: str = Field("video", const=True)
|
||||
type: str = Field(InputMediaType.VIDEO, const=True)
|
||||
"""Type of the result, must be *video*"""
|
||||
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>`"""
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ Here is list of all available enums:
|
|||
chat_type
|
||||
content_type
|
||||
dice_emoji
|
||||
input_media_type
|
||||
menu_button_type
|
||||
message_entity_type
|
||||
parse_mode
|
||||
|
|
|
|||
9
docs/api/enums/input_media_type.rst
Normal file
9
docs/api/enums/input_media_type.rst
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
##############
|
||||
InputMediaType
|
||||
##############
|
||||
|
||||
|
||||
.. automodule:: aiogram.enums.input_media_type
|
||||
:members:
|
||||
:member-order: bysource
|
||||
:undoc-members: True
|
||||
Loading…
Add table
Add a link
Reference in a new issue