Fixed subtypes and union types generation, new enums added (#1213)

* Fixed subtypes and union types generation, new enums added

* Added changes description
This commit is contained in:
Alex Root Junior 2023-07-11 23:39:54 +03:00 committed by GitHub
parent a7b92bb050
commit 31c11c31e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
115 changed files with 680 additions and 359 deletions

View file

@ -1,6 +1,30 @@
from __future__ import annotations
from ..types import InlineQueryResult, SentWebAppMessage
from typing import Union
from ..types import (
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultContact,
InlineQueryResultDocument,
InlineQueryResultGame,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
SentWebAppMessage,
)
from .base import TelegramMethod
@ -16,5 +40,26 @@ class AnswerWebAppQuery(TelegramMethod[SentWebAppMessage]):
web_app_query_id: str
"""Unique identifier for the query to be answered"""
result: InlineQueryResult
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]
"""A JSON-serialized object describing the message to be sent"""

View file

@ -1,8 +1,16 @@
from __future__ import annotations
from typing import Optional
from typing import Optional, Union
from ..types import BotCommandScope
from ..types import (
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from .base import TelegramMethod
@ -16,7 +24,17 @@ class DeleteMyCommands(TelegramMethod[bool]):
__returning__ = bool
__api_method__ = "deleteMyCommands"
scope: Optional[BotCommandScope] = None
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""

View file

@ -2,7 +2,15 @@ from __future__ import annotations
from typing import Optional, Union
from ..types import InlineKeyboardMarkup, InputMedia, Message
from ..types import (
InlineKeyboardMarkup,
InputMediaAnimation,
InputMediaAudio,
InputMediaDocument,
InputMediaPhoto,
InputMediaVideo,
Message,
)
from .base import TelegramMethod
@ -16,7 +24,9 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool]
__api_method__ = "editMessageMedia"
media: InputMedia
media: Union[
InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo
]
"""A JSON-serialized object for a new media content of the message"""
chat_id: Optional[Union[int, str]] = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""

View file

@ -1,8 +1,17 @@
from __future__ import annotations
from typing import List, Optional
from typing import List, Optional, Union
from ..types import BotCommand, BotCommandScope
from ..types import (
BotCommand,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from .base import TelegramMethod
@ -16,7 +25,17 @@ class GetMyCommands(TelegramMethod[List[BotCommand]]):
__returning__ = List[BotCommand]
__api_method__ = "getMyCommands"
scope: Optional[BotCommandScope] = None
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None
"""A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code or an empty string"""

View file

@ -18,5 +18,5 @@ class SetChatMenuButton(TelegramMethod[bool]):
chat_id: Optional[int] = None
"""Unique identifier for the target private chat. If not specified, default bot's menu button will be changed"""
menu_button: Optional[Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands]] = None
menu_button: Optional[Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]] = None
"""A JSON-serialized object for the bot's new menu button. Defaults to :class:`aiogram.types.menu_button_default.MenuButtonDefault`"""

View file

@ -1,8 +1,17 @@
from __future__ import annotations
from typing import List, Optional
from typing import List, Optional, Union
from ..types import BotCommand, BotCommandScope
from ..types import (
BotCommand,
BotCommandScopeAllChatAdministrators,
BotCommandScopeAllGroupChats,
BotCommandScopeAllPrivateChats,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
BotCommandScopeDefault,
)
from .base import TelegramMethod
@ -18,7 +27,17 @@ class SetMyCommands(TelegramMethod[bool]):
commands: List[BotCommand]
"""A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified."""
scope: Optional[BotCommandScope] = None
scope: Optional[
Union[
BotCommandScopeDefault,
BotCommandScopeAllPrivateChats,
BotCommandScopeAllGroupChats,
BotCommandScopeAllChatAdministrators,
BotCommandScopeChat,
BotCommandScopeChatAdministrators,
BotCommandScopeChatMember,
]
] = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""