diff --git a/.butcher/enums/ChatType.yml b/.butcher/enums/ChatType.yml index 34a4f7aa..39125b26 100644 --- a/.butcher/enums/ChatType.yml +++ b/.butcher/enums/ChatType.yml @@ -7,3 +7,5 @@ parse: entity: Chat attribute: type regexp: "'([a-z]+)'" +static: + SENDER: sender diff --git a/.butcher/enums/InlineQueryResultType.yml b/.butcher/enums/InlineQueryResultType.yml new file mode 100644 index 00000000..8ff8ee0c --- /dev/null +++ b/.butcher/enums/InlineQueryResultType.yml @@ -0,0 +1,29 @@ +name: InlineQueryResultType +description: | + The part of the face relative to which the mask should be placed. + + Source: https://core.telegram.org/bots/api#maskposition +multi_parse: + attribute: type + regexp: "must be ([a-z_]+)" + entities: + - InlineQueryResultCachedAudio + - InlineQueryResultCachedDocument + - InlineQueryResultCachedGif + - InlineQueryResultCachedMpeg4Gif + - InlineQueryResultCachedPhoto + - InlineQueryResultCachedSticker + - InlineQueryResultCachedVideo + - InlineQueryResultCachedVoice + - InlineQueryResultArticle + - InlineQueryResultAudio + - InlineQueryResultContact + - InlineQueryResultGame + - InlineQueryResultDocument + - InlineQueryResultGif + - InlineQueryResultLocation + - InlineQueryResultMpeg4Gif + - InlineQueryResultPhoto + - InlineQueryResultVenue + - InlineQueryResultVideo + - InlineQueryResultVoice diff --git a/.butcher/enums/MaskPositionPoint.yml b/.butcher/enums/MaskPositionPoint.yml new file mode 100644 index 00000000..4b1da922 --- /dev/null +++ b/.butcher/enums/MaskPositionPoint.yml @@ -0,0 +1,9 @@ +name: MaskPositionPoint +description: | + The part of the face relative to which the mask should be placed. + + Source: https://core.telegram.org/bots/api#maskposition +parse: + entity: MaskPosition + attribute: point + regexp: "'([a-z_]+)'" diff --git a/aiogram/enums/__init__.py b/aiogram/enums/__init__.py index c6620f0b..7d70d0c9 100644 --- a/aiogram/enums/__init__.py +++ b/aiogram/enums/__init__.py @@ -4,7 +4,9 @@ from .chat_member_status import ChatMemberStatus from .chat_type import ChatType from .content_type import ContentType from .dice_emoji import DiceEmoji +from .inline_query_result_type import InlineQueryResultType from .input_media_type import InputMediaType +from .mask_position_point import MaskPositionPoint from .menu_button_type import MenuButtonType from .message_entity_type import MessageEntityType from .parse_mode import ParseMode @@ -19,7 +21,9 @@ __all__ = ( "ChatType", "ContentType", "DiceEmoji", + "InlineQueryResultType", "InputMediaType", + "MaskPositionPoint", "MenuButtonType", "MessageEntityType", "ParseMode", diff --git a/aiogram/enums/chat_type.py b/aiogram/enums/chat_type.py index 749bf464..10dccc85 100644 --- a/aiogram/enums/chat_type.py +++ b/aiogram/enums/chat_type.py @@ -8,6 +8,7 @@ class ChatType(str, Enum): Source: https://core.telegram.org/bots/api#chat """ + SENDER = "sender" PRIVATE = "private" GROUP = "group" SUPERGROUP = "supergroup" diff --git a/aiogram/enums/inline_query_result_type.py b/aiogram/enums/inline_query_result_type.py new file mode 100644 index 00000000..fa063fcb --- /dev/null +++ b/aiogram/enums/inline_query_result_type.py @@ -0,0 +1,23 @@ +from enum import Enum + + +class InlineQueryResultType(str, Enum): + """ + The part of the face relative to which the mask should be placed. + + Source: https://core.telegram.org/bots/api#maskposition + """ + + AUDIO = "audio" + DOCUMENT = "document" + GIF = "gif" + MPEG = "mpeg" + PHOTO = "photo" + STICKER = "sticker" + VIDEO = "video" + VOICE = "voice" + ARTICLE = "article" + CONTACT = "contact" + GAME = "game" + LOCATION = "location" + VENUE = "venue" diff --git a/aiogram/enums/mask_position_point.py b/aiogram/enums/mask_position_point.py new file mode 100644 index 00000000..348ae007 --- /dev/null +++ b/aiogram/enums/mask_position_point.py @@ -0,0 +1,14 @@ +from enum import Enum + + +class MaskPositionPoint(str, Enum): + """ + The part of the face relative to which the mask should be placed. + + Source: https://core.telegram.org/bots/api#maskposition + """ + + FOREHEAD = "forehead" + EYES = "eyes" + MOUTH = "mouth" + CHIN = "chin" diff --git a/aiogram/types/inline_query_result_article.py b/aiogram/types/inline_query_result_article.py index 0b4578dd..611733c6 100644 --- a/aiogram/types/inline_query_result_article.py +++ b/aiogram/types/inline_query_result_article.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult if TYPE_CHECKING: @@ -18,7 +19,7 @@ class InlineQueryResultArticle(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultarticle """ - type: str = Field("article", const=True) + type: str = Field(InlineQueryResultType.ARTICLE, const=True) """Type of the result, must be *article*""" id: str """Unique identifier for this result, 1-64 Bytes""" diff --git a/aiogram/types/inline_query_result_audio.py b/aiogram/types/inline_query_result_audio.py index 615980f6..d217d246 100644 --- a/aiogram/types/inline_query_result_audio.py +++ b/aiogram/types/inline_query_result_audio.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -21,7 +22,7 @@ class InlineQueryResultAudio(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultaudio """ - type: str = Field("audio", const=True) + type: str = Field(InlineQueryResultType.AUDIO, const=True) """Type of the result, must be *audio*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_audio.py b/aiogram/types/inline_query_result_cached_audio.py index 08971c79..f630ee51 100644 --- a/aiogram/types/inline_query_result_cached_audio.py +++ b/aiogram/types/inline_query_result_cached_audio.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -21,7 +22,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcachedaudio """ - type: str = Field("audio", const=True) + type: str = Field(InlineQueryResultType.AUDIO, const=True) """Type of the result, must be *audio*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_document.py b/aiogram/types/inline_query_result_cached_document.py index f5fc741f..34ca1238 100644 --- a/aiogram/types/inline_query_result_cached_document.py +++ b/aiogram/types/inline_query_result_cached_document.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -21,7 +22,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcacheddocument """ - type: str = Field("document", const=True) + type: str = Field(InlineQueryResultType.DOCUMENT, const=True) """Type of the result, must be *document*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_gif.py b/aiogram/types/inline_query_result_cached_gif.py index 03abe92e..3bb77f44 100644 --- a/aiogram/types/inline_query_result_cached_gif.py +++ b/aiogram/types/inline_query_result_cached_gif.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -20,7 +21,7 @@ class InlineQueryResultCachedGif(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcachedgif """ - type: str = Field("gif", const=True) + type: str = Field(InlineQueryResultType.GIF, const=True) """Type of the result, must be *gif*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_mpeg4_gif.py b/aiogram/types/inline_query_result_cached_mpeg4_gif.py index 6ff85564..5175bc8c 100644 --- a/aiogram/types/inline_query_result_cached_mpeg4_gif.py +++ b/aiogram/types/inline_query_result_cached_mpeg4_gif.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -20,7 +21,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif """ - type: str = Field("mpeg4_gif", const=True) + type: str = Field(InlineQueryResultType.MPEG, const=True) """Type of the result, must be *mpeg4_gif*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_photo.py b/aiogram/types/inline_query_result_cached_photo.py index 9d570b66..09a9f5b0 100644 --- a/aiogram/types/inline_query_result_cached_photo.py +++ b/aiogram/types/inline_query_result_cached_photo.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -20,7 +21,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcachedphoto """ - type: str = Field("photo", const=True) + type: str = Field(InlineQueryResultType.PHOTO, const=True) """Type of the result, must be *photo*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_sticker.py b/aiogram/types/inline_query_result_cached_sticker.py index 850e08c6..3d75c29c 100644 --- a/aiogram/types/inline_query_result_cached_sticker.py +++ b/aiogram/types/inline_query_result_cached_sticker.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult if TYPE_CHECKING: @@ -19,7 +20,7 @@ class InlineQueryResultCachedSticker(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcachedsticker """ - type: str = Field("sticker", const=True) + type: str = Field(InlineQueryResultType.STICKER, const=True) """Type of the result, must be *sticker*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_video.py b/aiogram/types/inline_query_result_cached_video.py index 75196161..10720c80 100644 --- a/aiogram/types/inline_query_result_cached_video.py +++ b/aiogram/types/inline_query_result_cached_video.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -20,7 +21,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvideo """ - type: str = Field("video", const=True) + type: str = Field(InlineQueryResultType.VIDEO, const=True) """Type of the result, must be *video*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_cached_voice.py b/aiogram/types/inline_query_result_cached_voice.py index c62e467a..23595edf 100644 --- a/aiogram/types/inline_query_result_cached_voice.py +++ b/aiogram/types/inline_query_result_cached_voice.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -21,7 +22,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvoice """ - type: str = Field("voice", const=True) + type: str = Field(InlineQueryResultType.VOICE, const=True) """Type of the result, must be *voice*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_contact.py b/aiogram/types/inline_query_result_contact.py index d6bb278a..04ea46fb 100644 --- a/aiogram/types/inline_query_result_contact.py +++ b/aiogram/types/inline_query_result_contact.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult if TYPE_CHECKING: @@ -19,7 +20,7 @@ class InlineQueryResultContact(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultcontact """ - type: str = Field("contact", const=True) + type: str = Field(InlineQueryResultType.CONTACT, const=True) """Type of the result, must be *contact*""" id: str """Unique identifier for this result, 1-64 Bytes""" diff --git a/aiogram/types/inline_query_result_document.py b/aiogram/types/inline_query_result_document.py index 7b35c69a..941e1de8 100644 --- a/aiogram/types/inline_query_result_document.py +++ b/aiogram/types/inline_query_result_document.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -21,7 +22,7 @@ class InlineQueryResultDocument(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultdocument """ - type: str = Field("document", const=True) + type: str = Field(InlineQueryResultType.DOCUMENT, const=True) """Type of the result, must be *document*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_game.py b/aiogram/types/inline_query_result_game.py index bcf56acb..e4d92a61 100644 --- a/aiogram/types/inline_query_result_game.py +++ b/aiogram/types/inline_query_result_game.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult if TYPE_CHECKING: @@ -18,7 +19,7 @@ class InlineQueryResultGame(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultgame """ - type: str = Field("game", const=True) + type: str = Field(InlineQueryResultType.GAME, const=True) """Type of the result, must be *game*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_gif.py b/aiogram/types/inline_query_result_gif.py index cf53e726..d674b55a 100644 --- a/aiogram/types/inline_query_result_gif.py +++ b/aiogram/types/inline_query_result_gif.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -20,7 +21,7 @@ class InlineQueryResultGif(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultgif """ - type: str = Field("gif", const=True) + type: str = Field(InlineQueryResultType.GIF, const=True) """Type of the result, must be *gif*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_location.py b/aiogram/types/inline_query_result_location.py index 339a967e..395724ff 100644 --- a/aiogram/types/inline_query_result_location.py +++ b/aiogram/types/inline_query_result_location.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult if TYPE_CHECKING: @@ -19,7 +20,7 @@ class InlineQueryResultLocation(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultlocation """ - type: str = Field("location", const=True) + type: str = Field(InlineQueryResultType.LOCATION, const=True) """Type of the result, must be *location*""" id: str """Unique identifier for this result, 1-64 Bytes""" diff --git a/aiogram/types/inline_query_result_mpeg4_gif.py b/aiogram/types/inline_query_result_mpeg4_gif.py index e4ed3e60..d846aeb3 100644 --- a/aiogram/types/inline_query_result_mpeg4_gif.py +++ b/aiogram/types/inline_query_result_mpeg4_gif.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -20,7 +21,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif """ - type: str = Field("mpeg4_gif", const=True) + type: str = Field(InlineQueryResultType.MPEG, const=True) """Type of the result, must be *mpeg4_gif*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_photo.py b/aiogram/types/inline_query_result_photo.py index 6925b0bb..b63e0819 100644 --- a/aiogram/types/inline_query_result_photo.py +++ b/aiogram/types/inline_query_result_photo.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -20,7 +21,7 @@ class InlineQueryResultPhoto(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultphoto """ - type: str = Field("photo", const=True) + type: str = Field(InlineQueryResultType.PHOTO, const=True) """Type of the result, must be *photo*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_venue.py b/aiogram/types/inline_query_result_venue.py index 38d362b7..761886d8 100644 --- a/aiogram/types/inline_query_result_venue.py +++ b/aiogram/types/inline_query_result_venue.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult if TYPE_CHECKING: @@ -19,7 +20,7 @@ class InlineQueryResultVenue(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultvenue """ - type: str = Field("venue", const=True) + type: str = Field(InlineQueryResultType.VENUE, const=True) """Type of the result, must be *venue*""" id: str """Unique identifier for this result, 1-64 Bytes""" diff --git a/aiogram/types/inline_query_result_video.py b/aiogram/types/inline_query_result_video.py index 3848396f..1a1843ee 100644 --- a/aiogram/types/inline_query_result_video.py +++ b/aiogram/types/inline_query_result_video.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -22,7 +23,7 @@ class InlineQueryResultVideo(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultvideo """ - type: str = Field("video", const=True) + type: str = Field(InlineQueryResultType.VIDEO, const=True) """Type of the result, must be *video*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/aiogram/types/inline_query_result_voice.py b/aiogram/types/inline_query_result_voice.py index e0ed7296..ea5230b2 100644 --- a/aiogram/types/inline_query_result_voice.py +++ b/aiogram/types/inline_query_result_voice.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from pydantic import Field +from ..enums import InlineQueryResultType from .base import UNSET from .inline_query_result import InlineQueryResult @@ -21,7 +22,7 @@ class InlineQueryResultVoice(InlineQueryResult): Source: https://core.telegram.org/bots/api#inlinequeryresultvoice """ - type: str = Field("voice", const=True) + type: str = Field(InlineQueryResultType.VOICE, const=True) """Type of the result, must be *voice*""" id: str """Unique identifier for this result, 1-64 bytes""" diff --git a/docs/api/enums/index.rst b/docs/api/enums/index.rst index 85073cd4..e0eff3cf 100644 --- a/docs/api/enums/index.rst +++ b/docs/api/enums/index.rst @@ -14,7 +14,9 @@ Here is list of all available enums: chat_type content_type dice_emoji + inline_query_result_type input_media_type + mask_position_point menu_button_type message_entity_type parse_mode diff --git a/docs/api/enums/inline_query_result_type.rst b/docs/api/enums/inline_query_result_type.rst new file mode 100644 index 00000000..51268f57 --- /dev/null +++ b/docs/api/enums/inline_query_result_type.rst @@ -0,0 +1,9 @@ +##################### +InlineQueryResultType +##################### + + +.. automodule:: aiogram.enums.inline_query_result_type + :members: + :member-order: bysource + :undoc-members: True diff --git a/docs/api/enums/mask_position_point.rst b/docs/api/enums/mask_position_point.rst new file mode 100644 index 00000000..ba8b4337 --- /dev/null +++ b/docs/api/enums/mask_position_point.rst @@ -0,0 +1,9 @@ +################# +MaskPositionPoint +################# + + +.. automodule:: aiogram.enums.mask_position_point + :members: + :member-order: bysource + :undoc-members: True diff --git a/poetry.lock b/poetry.lock index a28f0255..b7dd6f4b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -176,7 +176,7 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "butcher" -version = "0.1.7" +version = "0.1.8" description = "Code-generation utility for aiogram v3 core developers" category = "dev" optional = false @@ -199,8 +199,8 @@ requests = "^2.28.1" [package.source] type = "git" url = "https://github.com/aiogram/butcher.git" -reference = "v0.1.7" -resolved_reference = "a0a428c5bd37a212ee168feddfc38d6934b08e18" +reference = "v0.1.8" +resolved_reference = "88a9e90742190e962877d475cbfeb1d66be699b7" [[package]] name = "certifi" @@ -1353,7 +1353,7 @@ redis = ["redis"] [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "e0f20dd2f11859f031e6d77751dc8b757519fb24e67b0eb03490c20695bd9705" +content-hash = "475ca0c579e3997fe16a79826e94f7a4f7bc99a98edbd33fc6579580af0582d0" [metadata.files] about-time = [ diff --git a/pyproject.toml b/pyproject.toml index 39b98e41..06cc85a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,7 +97,7 @@ toml = "^0.10.2" pre-commit = "^2.20.0" packaging = "^21.3" typing-extensions = "^4.3.0" -butcher = { git = "https://github.com/aiogram/butcher.git", rev = "v0.1.7", python = "3.10" } +butcher = { git = "https://github.com/aiogram/butcher.git", rev = "v0.1.8", python = "3.10" } [tool.poetry.extras]