From 0306695b61bb4e0b975161bebc5a37f213724972 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Fri, 2 Jan 2026 02:50:46 +0200 Subject: [PATCH] Update type hints across the codebase (#1749) * Update type hints across the codebase * Added changelog record --- CHANGES/1749.misc.rst | 1 + aiogram/client/bot.py | 1551 ++++++++-------- aiogram/client/context_controller.py | 10 +- aiogram/dispatcher/flags.py | 12 +- aiogram/exceptions.py | 2 +- aiogram/filters/base.py | 2 +- aiogram/filters/chat_member_updated.py | 16 +- aiogram/filters/command.py | 3 +- aiogram/handlers/callback_query.py | 1 - aiogram/handlers/message.py | 2 +- aiogram/methods/answer_callback_query.py | 18 +- aiogram/methods/answer_inline_query.py | 26 +- aiogram/methods/answer_pre_checkout_query.py | 6 +- aiogram/methods/answer_shipping_query.py | 10 +- aiogram/methods/approve_suggested_post.py | 6 +- aiogram/methods/ban_chat_member.py | 10 +- aiogram/methods/base.py | 16 +- aiogram/methods/copy_message.py | 70 +- aiogram/methods/copy_messages.py | 22 +- aiogram/methods/create_chat_invite_link.py | 18 +- .../create_chat_subscription_invite_link.py | 6 +- aiogram/methods/create_forum_topic.py | 10 +- aiogram/methods/create_invoice_link.py | 70 +- aiogram/methods/create_new_sticker_set.py | 14 +- aiogram/methods/decline_suggested_post.py | 6 +- aiogram/methods/delete_my_commands.py | 10 +- aiogram/methods/delete_webhook.py | 6 +- aiogram/methods/edit_chat_invite_link.py | 18 +- .../edit_chat_subscription_invite_link.py | 6 +- aiogram/methods/edit_forum_topic.py | 10 +- aiogram/methods/edit_message_caption.py | 44 +- aiogram/methods/edit_message_checklist.py | 6 +- aiogram/methods/edit_message_live_location.py | 42 +- aiogram/methods/edit_message_media.py | 26 +- aiogram/methods/edit_message_reply_markup.py | 26 +- aiogram/methods/edit_message_text.py | 46 +- aiogram/methods/edit_story.py | 18 +- aiogram/methods/forward_message.py | 30 +- aiogram/methods/forward_messages.py | 18 +- aiogram/methods/get_business_account_gifts.py | 46 +- aiogram/methods/get_chat_gifts.py | 42 +- aiogram/methods/get_chat_menu_button.py | 6 +- aiogram/methods/get_game_high_scores.py | 14 +- aiogram/methods/get_my_commands.py | 10 +- .../get_my_default_administrator_rights.py | 6 +- aiogram/methods/get_my_description.py | 6 +- aiogram/methods/get_my_name.py | 6 +- aiogram/methods/get_my_short_description.py | 6 +- aiogram/methods/get_star_transactions.py | 10 +- aiogram/methods/get_updates.py | 18 +- aiogram/methods/get_user_gifts.py | 34 +- aiogram/methods/get_user_profile_photos.py | 10 +- aiogram/methods/gift_premium_subscription.py | 14 +- aiogram/methods/pin_chat_message.py | 10 +- aiogram/methods/post_story.py | 26 +- aiogram/methods/promote_chat_member.py | 66 +- .../remove_business_account_profile_photo.py | 6 +- aiogram/methods/repost_story.py | 10 +- aiogram/methods/restrict_chat_member.py | 10 +- .../methods/save_prepared_inline_message.py | 18 +- aiogram/methods/send_animation.py | 90 +- aiogram/methods/send_audio.py | 80 +- aiogram/methods/send_chat_action.py | 10 +- aiogram/methods/send_checklist.py | 22 +- aiogram/methods/send_contact.py | 60 +- aiogram/methods/send_dice.py | 56 +- aiogram/methods/send_document.py | 72 +- aiogram/methods/send_game.py | 44 +- aiogram/methods/send_gift.py | 26 +- aiogram/methods/send_invoice.py | 112 +- aiogram/methods/send_location.py | 68 +- aiogram/methods/send_media_group.py | 44 +- aiogram/methods/send_message.py | 72 +- aiogram/methods/send_message_draft.py | 14 +- aiogram/methods/send_paid_media.py | 58 +- aiogram/methods/send_photo.py | 74 +- aiogram/methods/send_poll.py | 92 +- aiogram/methods/send_sticker.py | 56 +- aiogram/methods/send_venue.py | 68 +- aiogram/methods/send_video.py | 102 +- aiogram/methods/send_video_note.py | 64 +- aiogram/methods/send_voice.py | 68 +- aiogram/methods/set_business_account_bio.py | 6 +- aiogram/methods/set_business_account_name.py | 6 +- .../set_business_account_profile_photo.py | 6 +- .../methods/set_business_account_username.py | 6 +- aiogram/methods/set_chat_description.py | 6 +- aiogram/methods/set_chat_menu_button.py | 10 +- aiogram/methods/set_chat_permissions.py | 6 +- .../set_custom_emoji_sticker_set_thumbnail.py | 6 +- aiogram/methods/set_game_score.py | 26 +- aiogram/methods/set_message_reaction.py | 10 +- aiogram/methods/set_my_commands.py | 10 +- .../set_my_default_administrator_rights.py | 10 +- aiogram/methods/set_my_description.py | 10 +- aiogram/methods/set_my_name.py | 10 +- aiogram/methods/set_my_short_description.py | 10 +- aiogram/methods/set_sticker_keywords.py | 6 +- aiogram/methods/set_sticker_mask_position.py | 6 +- aiogram/methods/set_sticker_set_thumbnail.py | 6 +- aiogram/methods/set_user_emoji_status.py | 10 +- aiogram/methods/set_webhook.py | 26 +- aiogram/methods/stop_message_live_location.py | 26 +- aiogram/methods/stop_poll.py | 10 +- aiogram/methods/transfer_gift.py | 6 +- aiogram/methods/unban_chat_member.py | 6 +- aiogram/methods/unpin_chat_message.py | 10 +- aiogram/methods/upgrade_gift.py | 10 +- aiogram/methods/verify_chat.py | 6 +- aiogram/methods/verify_user.py | 6 +- aiogram/types/affiliate_info.py | 14 +- aiogram/types/animation.py | 18 +- aiogram/types/audio.py | 26 +- aiogram/types/background_fill_union.py | 8 +- aiogram/types/background_type_pattern.py | 10 +- aiogram/types/background_type_union.py | 8 +- aiogram/types/background_type_wallpaper.py | 10 +- aiogram/types/base.py | 4 +- aiogram/types/birthdate.py | 6 +- aiogram/types/bot_command_scope_union.py | 20 +- aiogram/types/business_bot_rights.py | 64 +- aiogram/types/business_connection.py | 10 +- aiogram/types/business_intro.py | 14 +- aiogram/types/business_location.py | 6 +- aiogram/types/callback_query.py | 26 +- aiogram/types/chat.py | 244 ++- aiogram/types/chat_administrator_rights.py | 22 +- aiogram/types/chat_boost_source_giveaway.py | 14 +- aiogram/types/chat_boost_source_union.py | 8 +- aiogram/types/chat_full_info.py | 186 +- aiogram/types/chat_id_union.py | 4 +- aiogram/types/chat_invite_link.py | 26 +- aiogram/types/chat_join_request.py | 1174 ++++++------ aiogram/types/chat_member_administrator.py | 26 +- aiogram/types/chat_member_member.py | 6 +- aiogram/types/chat_member_owner.py | 6 +- aiogram/types/chat_member_union.py | 18 +- aiogram/types/chat_member_updated.py | 596 +++--- aiogram/types/chat_permissions.py | 58 +- aiogram/types/chat_shared.py | 14 +- aiogram/types/checklist.py | 14 +- aiogram/types/checklist_task.py | 18 +- aiogram/types/checklist_tasks_added.py | 6 +- aiogram/types/checklist_tasks_done.py | 14 +- aiogram/types/chosen_inline_result.py | 10 +- aiogram/types/contact.py | 14 +- aiogram/types/date_time_union.py | 4 +- aiogram/types/direct_message_price_changed.py | 6 +- aiogram/types/direct_messages_topic.py | 6 +- aiogram/types/document.py | 18 +- aiogram/types/encrypted_passport_element.py | 34 +- aiogram/types/external_reply_info.py | 98 +- aiogram/types/file.py | 10 +- aiogram/types/force_reply.py | 10 +- aiogram/types/forum_topic.py | 10 +- aiogram/types/forum_topic_created.py | 10 +- aiogram/types/forum_topic_edited.py | 10 +- aiogram/types/game.py | 14 +- aiogram/types/gift.py | 42 +- aiogram/types/gift_info.py | 38 +- aiogram/types/giveaway.py | 26 +- aiogram/types/giveaway_completed.py | 14 +- aiogram/types/giveaway_created.py | 6 +- aiogram/types/giveaway_winners.py | 30 +- aiogram/types/inaccessible_message.py | 1162 ++++++------ aiogram/types/inline_keyboard_button.py | 42 +- aiogram/types/inline_query.py | 22 +- aiogram/types/inline_query_result_article.py | 30 +- aiogram/types/inline_query_result_audio.py | 30 +- .../types/inline_query_result_cached_audio.py | 22 +- .../inline_query_result_cached_document.py | 26 +- .../types/inline_query_result_cached_gif.py | 32 +- .../inline_query_result_cached_mpeg4_gif.py | 32 +- .../types/inline_query_result_cached_photo.py | 36 +- .../inline_query_result_cached_sticker.py | 10 +- .../types/inline_query_result_cached_video.py | 32 +- .../types/inline_query_result_cached_voice.py | 22 +- aiogram/types/inline_query_result_contact.py | 30 +- aiogram/types/inline_query_result_document.py | 38 +- aiogram/types/inline_query_result_game.py | 6 +- aiogram/types/inline_query_result_gif.py | 48 +- aiogram/types/inline_query_result_location.py | 38 +- .../types/inline_query_result_mpeg4_gif.py | 48 +- aiogram/types/inline_query_result_photo.py | 44 +- aiogram/types/inline_query_result_union.py | 46 +- aiogram/types/inline_query_result_venue.py | 38 +- aiogram/types/inline_query_result_video.py | 44 +- aiogram/types/inline_query_result_voice.py | 26 +- aiogram/types/inline_query_results_button.py | 10 +- aiogram/types/input_checklist.py | 18 +- aiogram/types/input_checklist_task.py | 10 +- .../types/input_contact_message_content.py | 10 +- aiogram/types/input_file.py | 18 +- aiogram/types/input_file_union.py | 4 +- .../types/input_invoice_message_content.py | 62 +- .../types/input_location_message_content.py | 18 +- aiogram/types/input_media_animation.py | 40 +- aiogram/types/input_media_audio.py | 30 +- aiogram/types/input_media_document.py | 22 +- aiogram/types/input_media_photo.py | 24 +- aiogram/types/input_media_union.py | 8 +- aiogram/types/input_media_video.py | 52 +- aiogram/types/input_message_content_union.py | 16 +- aiogram/types/input_paid_media_union.py | 4 +- aiogram/types/input_paid_media_video.py | 30 +- aiogram/types/input_poll_option.py | 10 +- aiogram/types/input_poll_option_union.py | 4 +- aiogram/types/input_profile_photo_animated.py | 6 +- aiogram/types/input_profile_photo_union.py | 4 +- aiogram/types/input_sticker.py | 10 +- aiogram/types/input_story_content_union.py | 4 +- aiogram/types/input_story_content_video.py | 14 +- aiogram/types/input_text_message_content.py | 20 +- aiogram/types/input_venue_message_content.py | 18 +- aiogram/types/keyboard_button.py | 30 +- aiogram/types/keyboard_button_poll_type.py | 6 +- aiogram/types/keyboard_button_request_chat.py | 38 +- aiogram/types/keyboard_button_request_user.py | 10 +- .../types/keyboard_button_request_users.py | 26 +- aiogram/types/link_preview_options.py | 28 +- aiogram/types/location.py | 18 +- aiogram/types/location_address.py | 14 +- aiogram/types/login_url.py | 14 +- .../types/maybe_inaccessible_message_union.py | 4 +- aiogram/types/media_union.py | 4 +- aiogram/types/menu_button.py | 10 +- aiogram/types/menu_button_union.py | 4 +- aiogram/types/message.py | 1620 ++++++++--------- aiogram/types/message_entity.py | 18 +- aiogram/types/message_origin_channel.py | 6 +- aiogram/types/message_origin_chat.py | 6 +- aiogram/types/message_origin_union.py | 8 +- aiogram/types/message_reaction_updated.py | 10 +- aiogram/types/order_info.py | 18 +- aiogram/types/owned_gift_regular.py | 50 +- aiogram/types/owned_gift_union.py | 4 +- aiogram/types/owned_gift_unique.py | 26 +- aiogram/types/owned_gifts.py | 6 +- aiogram/types/paid_media_preview.py | 14 +- aiogram/types/paid_media_union.py | 4 +- aiogram/types/passport_element_error_union.py | 24 +- aiogram/types/photo_size.py | 6 +- aiogram/types/poll.py | 26 +- aiogram/types/poll_answer.py | 10 +- aiogram/types/poll_option.py | 6 +- aiogram/types/pre_checkout_query.py | 12 +- aiogram/types/reaction_type_union.py | 4 +- aiogram/types/refunded_payment.py | 6 +- aiogram/types/reply_keyboard_markup.py | 22 +- aiogram/types/reply_keyboard_remove.py | 6 +- aiogram/types/reply_markup_union.py | 8 +- aiogram/types/reply_parameters.py | 32 +- aiogram/types/response_parameters.py | 10 +- aiogram/types/result_chat_member_union.py | 18 +- aiogram/types/result_menu_button_union.py | 4 +- .../types/revenue_withdrawal_state_union.py | 8 +- aiogram/types/sent_web_app_message.py | 9 +- aiogram/types/shared_user.py | 18 +- aiogram/types/shipping_query.py | 6 +- aiogram/types/star_amount.py | 6 +- aiogram/types/star_transaction.py | 14 +- aiogram/types/sticker.py | 34 +- aiogram/types/sticker_set.py | 14 +- aiogram/types/story_area_type_location.py | 6 +- .../story_area_type_suggested_reaction.py | 10 +- aiogram/types/story_area_type_union.py | 16 +- aiogram/types/successful_payment.py | 22 +- .../types/suggested_post_approval_failed.py | 6 +- aiogram/types/suggested_post_approved.py | 10 +- aiogram/types/suggested_post_declined.py | 10 +- aiogram/types/suggested_post_info.py | 10 +- aiogram/types/suggested_post_paid.py | 14 +- aiogram/types/suggested_post_parameters.py | 10 +- aiogram/types/suggested_post_refunded.py | 6 +- .../types/switch_inline_query_chosen_chat.py | 22 +- aiogram/types/text_quote.py | 10 +- .../transaction_partner_affiliate_program.py | 6 +- aiogram/types/transaction_partner_chat.py | 6 +- aiogram/types/transaction_partner_fragment.py | 6 +- aiogram/types/transaction_partner_union.py | 20 +- aiogram/types/transaction_partner_user.py | 30 +- aiogram/types/unique_gift.py | 18 +- aiogram/types/unique_gift_info.py | 26 +- aiogram/types/update.py | 94 +- aiogram/types/user.py | 54 +- aiogram/types/user_rating.py | 6 +- aiogram/types/users_shared.py | 6 +- aiogram/types/venue.py | 18 +- aiogram/types/video.py | 26 +- aiogram/types/video_note.py | 10 +- aiogram/types/voice.py | 10 +- aiogram/types/webhook_info.py | 26 +- aiogram/types/write_access_allowed.py | 14 +- aiogram/utils/dataclass.py | 2 +- aiogram/utils/deep_linking.py | 2 +- aiogram/utils/formatting.py | 2 +- aiogram/utils/keyboard.py | 4 +- aiogram/utils/link.py | 2 +- aiogram/utils/serialization.py | 2 +- aiogram/utils/text_decorations.py | 2 +- docs/api/methods/edit_message_caption.rst | 6 +- .../methods/edit_message_live_location.rst | 6 +- docs/api/methods/edit_message_media.rst | 6 +- .../api/methods/edit_message_reply_markup.rst | 6 +- docs/api/methods/edit_message_text.rst | 6 +- docs/api/methods/set_game_score.rst | 6 +- .../methods/stop_message_live_location.rst | 6 +- 307 files changed, 6190 insertions(+), 6385 deletions(-) create mode 100644 CHANGES/1749.misc.rst diff --git a/CHANGES/1749.misc.rst b/CHANGES/1749.misc.rst new file mode 100644 index 00000000..90ba26a5 --- /dev/null +++ b/CHANGES/1749.misc.rst @@ -0,0 +1 @@ +Updated type hints in the codebase to Python 3.10+ style unions and optionals. diff --git a/aiogram/client/bot.py b/aiogram/client/bot.py index d263c7de..fd5ba841 100644 --- a/aiogram/client/bot.py +++ b/aiogram/client/bot.py @@ -9,10 +9,7 @@ from typing import ( AsyncGenerator, AsyncIterator, BinaryIO, - Optional, - Type, TypeVar, - Union, cast, ) @@ -259,8 +256,8 @@ class Bot: def __init__( self, token: str, - session: Optional[BaseSession] = None, - default: Optional[DefaultBotProperties] = None, + session: BaseSession | None = None, + default: DefaultBotProperties | None = None, **kwargs: Any, ) -> None: """ @@ -311,16 +308,16 @@ class Bot: self.default = default self.__token = token - self._me: Optional[User] = None + self._me: User | None = None async def __aenter__(self) -> "Bot": return self async def __aexit__( self, - exc_type: Optional[Type[BaseException]], - exc_value: Optional[BaseException], - traceback: Optional[TracebackType], + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, ) -> None: await self.session.close() @@ -374,7 +371,7 @@ class Bot: @classmethod async def __download_file( - cls, destination: Union[str, pathlib.Path], stream: AsyncGenerator[bytes, None] + cls, destination: str | pathlib.Path, stream: AsyncGenerator[bytes, None] ) -> None: async with aiofiles.open(destination, "wb") as f: async for chunk in stream: @@ -382,7 +379,7 @@ class Bot: @classmethod async def __aiofiles_reader( - cls, file: Union[str, pathlib.Path], chunk_size: int = 65536 + cls, file: str | pathlib.Path, chunk_size: int = 65536 ) -> AsyncGenerator[bytes, None]: async with aiofiles.open(file, "rb") as f: while chunk := await f.read(chunk_size): @@ -390,12 +387,12 @@ class Bot: async def download_file( self, - file_path: Union[str, pathlib.Path], - destination: Optional[Union[BinaryIO, pathlib.Path, str]] = None, + file_path: str | pathlib.Path, + destination: BinaryIO | pathlib.Path | str | None = None, timeout: int = 30, chunk_size: int = 65536, seek: bool = True, - ) -> Optional[BinaryIO]: + ) -> BinaryIO | None: """ Download file by file_path to destination. @@ -439,12 +436,12 @@ class Bot: async def download( self, - file: Union[str, Downloadable], - destination: Optional[Union[BinaryIO, pathlib.Path, str]] = None, + file: str | Downloadable, + destination: BinaryIO | pathlib.Path | str | None = None, timeout: int = 30, chunk_size: int = 65536, seek: bool = True, - ) -> Optional[BinaryIO]: + ) -> BinaryIO | None: """ Download file by file_id or Downloadable object to destination. @@ -461,7 +458,7 @@ class Bot: file_id = file else: # type is ignored in due to: - # Incompatible types in assignment (expression has type "Optional[Any]", variable has type "str") + # Incompatible types in assignment (expression has type "Any | None", variable has type "str") file_id = getattr(file, "file_id", None) # type: ignore if file_id is None: raise TypeError("file can only be of the string or Downloadable type") @@ -477,9 +474,7 @@ class Bot: file_path, destination=destination, timeout=timeout, chunk_size=chunk_size, seek=seek ) - async def __call__( - self, method: TelegramMethod[T], request_timeout: Optional[int] = None - ) -> T: + async def __call__(self, method: TelegramMethod[T], request_timeout: int | None = None) -> T: """ Call API method @@ -512,7 +507,7 @@ class Bot: user_id: int, name: str, sticker: InputSticker, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns :code:`True` on success. @@ -536,11 +531,11 @@ class Bot: async def answer_callback_query( self, callback_query_id: str, - text: Optional[str] = None, - show_alert: Optional[bool] = None, - url: Optional[str] = None, - cache_time: Optional[int] = None, - request_timeout: Optional[int] = None, + text: str | None = None, + show_alert: bool | None = None, + url: str | None = None, + cache_time: int | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to send answers to callback queries sent from `inline keyboards `_. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, :code:`True` is returned. @@ -571,13 +566,13 @@ class Bot: self, inline_query_id: str, results: list[InlineQueryResultUnion], - cache_time: Optional[int] = None, - is_personal: Optional[bool] = None, - next_offset: Optional[str] = None, - button: Optional[InlineQueryResultsButton] = None, - switch_pm_parameter: Optional[str] = None, - switch_pm_text: Optional[str] = None, - request_timeout: Optional[int] = None, + cache_time: int | None = None, + is_personal: bool | None = None, + next_offset: str | None = None, + button: InlineQueryResultsButton | None = None, + switch_pm_parameter: str | None = None, + switch_pm_text: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to send answers to an inline query. On success, :code:`True` is returned. @@ -614,8 +609,8 @@ class Bot: self, pre_checkout_query_id: str, ok: bool, - error_message: Optional[str] = None, - request_timeout: Optional[int] = None, + error_message: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an :class:`aiogram.types.update.Update` with the field *pre_checkout_query*. Use this method to respond to such pre-checkout queries. On success, :code:`True` is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. @@ -640,9 +635,9 @@ class Bot: self, shipping_query_id: str, ok: bool, - shipping_options: Optional[list[ShippingOption]] = None, - error_message: Optional[str] = None, - request_timeout: Optional[int] = None, + shipping_options: list[ShippingOption] | None = None, + error_message: str | None = None, + request_timeout: int | None = None, ) -> bool: """ If you sent an invoice requesting a shipping address and the parameter *is_flexible* was specified, the Bot API will send an :class:`aiogram.types.update.Update` with a *shipping_query* field to the bot. Use this method to reply to shipping queries. On success, :code:`True` is returned. @@ -669,7 +664,7 @@ class Bot: self, web_app_query_id: str, result: InlineQueryResultUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> SentWebAppMessage: """ Use this method to set the result of an interaction with a `Web App `_ and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a :class:`aiogram.types.sent_web_app_message.SentWebAppMessage` object is returned. @@ -692,7 +687,7 @@ class Bot: self, chat_id: ChatIdUnion, user_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the *can_invite_users* administrator right. Returns :code:`True` on success. @@ -715,9 +710,9 @@ class Bot: self, chat_id: ChatIdUnion, user_id: int, - until_date: Optional[DateTimeUnion] = None, - revoke_messages: Optional[bool] = None, - request_timeout: Optional[int] = None, + until_date: DateTimeUnion | None = None, + revoke_messages: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless `unbanned `_ first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. @@ -744,7 +739,7 @@ class Bot: self, chat_id: ChatIdUnion, sender_chat_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to ban a channel chat in a supergroup or a channel. Until the chat is `unbanned `_, the owner of the banned chat won't be able to send messages on behalf of **any of their channels**. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. @@ -765,7 +760,7 @@ class Bot: async def close( self, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns :code:`True` on success. Requires no parameters. @@ -783,7 +778,7 @@ class Bot: self, chat_id: ChatIdUnion, message_thread_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success. @@ -807,25 +802,23 @@ class Bot: chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_id: int, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - video_start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + video_start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> MessageId: """ Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz :class:`aiogram.methods.poll.Poll` can be copied only if the value of the field *correct_option_id* is known to the bot. The method is analogous to the method :class:`aiogram.methods.forward_message.ForwardMessage`, but the copied message doesn't have a link to the original message. Returns the :class:`aiogram.types.message_id.MessageId` of the sent message on success. @@ -881,11 +874,11 @@ class Bot: async def create_chat_invite_link( self, chat_id: ChatIdUnion, - name: Optional[str] = None, - expire_date: Optional[DateTimeUnion] = None, - member_limit: Optional[int] = None, - creates_join_request: Optional[bool] = None, - request_timeout: Optional[int] = None, + name: str | None = None, + expire_date: DateTimeUnion | None = None, + member_limit: int | None = None, + creates_join_request: bool | None = None, + request_timeout: int | None = None, ) -> ChatInviteLink: """ Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object. @@ -914,9 +907,9 @@ class Bot: self, chat_id: ChatIdUnion, name: str, - icon_color: Optional[int] = None, - icon_custom_emoji_id: Optional[str] = None, - request_timeout: Optional[int] = None, + icon_color: int | None = None, + icon_custom_emoji_id: str | None = None, + request_timeout: int | None = None, ) -> ForumTopic: """ Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns information about the created topic as a :class:`aiogram.types.forum_topic.ForumTopic` object. @@ -946,24 +939,24 @@ class Bot: payload: str, currency: str, prices: list[LabeledPrice], - business_connection_id: Optional[str] = None, - provider_token: Optional[str] = None, - subscription_period: Optional[int] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + provider_token: str | None = None, + subscription_period: int | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + request_timeout: int | None = None, ) -> str: """ Use this method to create a link for an invoice. Returns the created invoice link as *String* on success. @@ -1028,10 +1021,10 @@ class Bot: name: str, title: str, stickers: list[InputSticker], - sticker_type: Optional[str] = None, - needs_repainting: Optional[bool] = None, - sticker_format: Optional[str] = None, - request_timeout: Optional[int] = None, + sticker_type: str | None = None, + needs_repainting: bool | None = None, + sticker_format: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns :code:`True` on success. @@ -1064,7 +1057,7 @@ class Bot: self, chat_id: ChatIdUnion, user_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the *can_invite_users* administrator right. Returns :code:`True` on success. @@ -1086,7 +1079,7 @@ class Bot: async def delete_chat_photo( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. @@ -1106,7 +1099,7 @@ class Bot: async def delete_chat_sticker_set( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success. @@ -1127,7 +1120,7 @@ class Bot: self, chat_id: ChatIdUnion, message_thread_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can_delete_messages* administrator rights. Returns :code:`True` on success. @@ -1150,7 +1143,7 @@ class Bot: self, chat_id: ChatIdUnion, message_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete a message, including service messages, with the following limitations: @@ -1191,9 +1184,9 @@ class Bot: async def delete_my_commands( self, - scope: Optional[BotCommandScopeUnion] = None, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + scope: BotCommandScopeUnion | None = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, `higher level commands `_ will be shown to affected users. Returns :code:`True` on success. @@ -1215,7 +1208,7 @@ class Bot: async def delete_sticker_from_set( self, sticker: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete a sticker from a set created by the bot. Returns :code:`True` on success. @@ -1234,8 +1227,8 @@ class Bot: async def delete_webhook( self, - drop_pending_updates: Optional[bool] = None, - request_timeout: Optional[int] = None, + drop_pending_updates: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to remove webhook integration if you decide to switch back to :class:`aiogram.methods.get_updates.GetUpdates`. Returns :code:`True` on success. @@ -1256,11 +1249,11 @@ class Bot: self, chat_id: ChatIdUnion, invite_link: str, - name: Optional[str] = None, - expire_date: Optional[DateTimeUnion] = None, - member_limit: Optional[int] = None, - creates_join_request: Optional[bool] = None, - request_timeout: Optional[int] = None, + name: str | None = None, + expire_date: DateTimeUnion | None = None, + member_limit: int | None = None, + creates_join_request: bool | None = None, + request_timeout: int | None = None, ) -> ChatInviteLink: """ Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object. @@ -1291,9 +1284,9 @@ class Bot: self, chat_id: ChatIdUnion, message_thread_id: int, - name: Optional[str] = None, - icon_custom_emoji_id: Optional[str] = None, - request_timeout: Optional[int] = None, + name: str | None = None, + icon_custom_emoji_id: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success. @@ -1318,19 +1311,17 @@ class Bot: async def edit_message_caption( self, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, - ) -> Union[Message, bool]: + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, + ) -> Message | bool: """ Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. @@ -1366,17 +1357,17 @@ class Bot: self, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - live_period: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, - ) -> Union[Message, bool]: + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + live_period: int | None = None, + horizontal_accuracy: float | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, + ) -> Message | bool: """ Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. @@ -1415,13 +1406,13 @@ class Bot: async def edit_message_media( self, media: InputMediaUnion, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, - ) -> Union[Message, bool]: + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, + ) -> Message | bool: """ Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. @@ -1449,13 +1440,13 @@ class Bot: async def edit_message_reply_markup( self, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, - ) -> Union[Message, bool]: + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, + ) -> Message | bool: """ Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. @@ -1482,21 +1473,17 @@ class Bot: async def edit_message_text( self, text: str, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - request_timeout: Optional[int] = None, - ) -> Union[Message, bool]: + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + reply_markup: InlineKeyboardMarkup | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + request_timeout: int | None = None, + ) -> Message | bool: """ Use this method to edit text and `game `_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. @@ -1533,7 +1520,7 @@ class Bot: async def export_chat_invite_link( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> str: """ Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as *String* on success. @@ -1557,14 +1544,14 @@ class Bot: chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_id: int, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - video_start_timestamp: Optional[DateTimeUnion] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - request_timeout: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + video_start_timestamp: DateTimeUnion | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -1602,7 +1589,7 @@ class Bot: async def get_chat( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> ChatFullInfo: """ Use this method to get up-to-date information about the chat. Returns a :class:`aiogram.types.chat_full_info.ChatFullInfo` object on success. @@ -1622,7 +1609,7 @@ class Bot: async def get_chat_administrators( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> list[ResultChatMemberUnion]: """ Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of :class:`aiogram.types.chat_member.ChatMember` objects. @@ -1643,7 +1630,7 @@ class Bot: self, chat_id: ChatIdUnion, user_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> ResultChatMemberUnion: """ Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success. @@ -1665,7 +1652,7 @@ class Bot: async def get_chat_member_count( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> int: """ Use this method to get the number of members in a chat. Returns *Int* on success. @@ -1684,8 +1671,8 @@ class Bot: async def get_chat_menu_button( self, - chat_id: Optional[int] = None, - request_timeout: Optional[int] = None, + chat_id: int | None = None, + request_timeout: int | None = None, ) -> ResultMenuButtonUnion: """ Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns :class:`aiogram.types.menu_button.MenuButton` on success. @@ -1705,7 +1692,7 @@ class Bot: async def get_custom_emoji_stickers( self, custom_emoji_ids: list[str], - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> list[Sticker]: """ Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of :class:`aiogram.types.sticker.Sticker` objects. @@ -1725,7 +1712,7 @@ class Bot: async def get_file( self, file_id: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> File: """ Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a :class:`aiogram.types.file.File` object is returned. The file can then be downloaded via the link :code:`https://api.telegram.org/file/bot/`, where :code:`` is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling :class:`aiogram.methods.get_file.GetFile` again. @@ -1745,7 +1732,7 @@ class Bot: async def get_forum_topic_icon_stickers( self, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> list[Sticker]: """ Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of :class:`aiogram.types.sticker.Sticker` objects. @@ -1762,10 +1749,10 @@ class Bot: async def get_game_high_scores( self, user_id: int, - chat_id: Optional[int] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - request_timeout: Optional[int] = None, + chat_id: int | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + request_timeout: int | None = None, ) -> list[GameHighScore]: """ Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of :class:`aiogram.types.game_high_score.GameHighScore` objects. @@ -1792,7 +1779,7 @@ class Bot: async def get_me( self, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> User: """ A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a :class:`aiogram.types.user.User` object. @@ -1808,9 +1795,9 @@ class Bot: async def get_my_commands( self, - scope: Optional[BotCommandScopeUnion] = None, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + scope: BotCommandScopeUnion | None = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> list[BotCommand]: """ Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of :class:`aiogram.types.bot_command.BotCommand` objects. If commands aren't set, an empty list is returned. @@ -1831,8 +1818,8 @@ class Bot: async def get_my_default_administrator_rights( self, - for_channels: Optional[bool] = None, - request_timeout: Optional[int] = None, + for_channels: bool | None = None, + request_timeout: int | None = None, ) -> ChatAdministratorRights: """ Use this method to get the current default administrator rights of the bot. Returns :class:`aiogram.types.chat_administrator_rights.ChatAdministratorRights` on success. @@ -1852,7 +1839,7 @@ class Bot: async def get_sticker_set( self, name: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> StickerSet: """ Use this method to get a sticker set. On success, a :class:`aiogram.types.sticker_set.StickerSet` object is returned. @@ -1871,11 +1858,11 @@ class Bot: async def get_updates( self, - offset: Optional[int] = None, - limit: Optional[int] = None, - timeout: Optional[int] = None, - allowed_updates: Optional[list[str]] = None, - request_timeout: Optional[int] = None, + offset: int | None = None, + limit: int | None = None, + timeout: int | None = None, + allowed_updates: list[str] | None = None, + request_timeout: int | None = None, ) -> list[Update]: """ Use this method to receive incoming updates using long polling (`wiki `_). Returns an Array of :class:`aiogram.types.update.Update` objects. @@ -1907,9 +1894,9 @@ class Bot: async def get_user_profile_photos( self, user_id: int, - offset: Optional[int] = None, - limit: Optional[int] = None, - request_timeout: Optional[int] = None, + offset: int | None = None, + limit: int | None = None, + request_timeout: int | None = None, ) -> UserProfilePhotos: """ Use this method to get a list of profile pictures for a user. Returns a :class:`aiogram.types.user_profile_photos.UserProfilePhotos` object. @@ -1932,7 +1919,7 @@ class Bot: async def get_webhook_info( self, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> WebhookInfo: """ Use this method to get current webhook status. Requires no parameters. On success, returns a :class:`aiogram.types.webhook_info.WebhookInfo` object. If the bot is using :class:`aiogram.methods.get_updates.GetUpdates`, will return an object with the *url* field empty. @@ -1949,7 +1936,7 @@ class Bot: async def leave_chat( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method for your bot to leave a group, supergroup or channel. Returns :code:`True` on success. @@ -1968,7 +1955,7 @@ class Bot: async def log_out( self, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns :code:`True` on success. Requires no parameters. @@ -1986,9 +1973,9 @@ class Bot: self, chat_id: ChatIdUnion, message_id: int, - business_connection_id: Optional[str] = None, - disable_notification: Optional[bool] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + disable_notification: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns :code:`True` on success. @@ -2015,23 +2002,23 @@ class Bot: self, chat_id: ChatIdUnion, user_id: int, - is_anonymous: Optional[bool] = None, - can_manage_chat: Optional[bool] = None, - can_delete_messages: Optional[bool] = None, - can_manage_video_chats: Optional[bool] = None, - can_restrict_members: Optional[bool] = None, - can_promote_members: Optional[bool] = None, - can_change_info: Optional[bool] = None, - can_invite_users: Optional[bool] = None, - can_post_stories: Optional[bool] = None, - can_edit_stories: Optional[bool] = None, - can_delete_stories: Optional[bool] = None, - can_post_messages: Optional[bool] = None, - can_edit_messages: Optional[bool] = None, - can_pin_messages: Optional[bool] = None, - can_manage_topics: Optional[bool] = None, - can_manage_direct_messages: Optional[bool] = None, - request_timeout: Optional[int] = None, + is_anonymous: bool | None = None, + can_manage_chat: bool | None = None, + can_delete_messages: bool | None = None, + can_manage_video_chats: bool | None = None, + can_restrict_members: bool | None = None, + can_promote_members: bool | None = None, + can_change_info: bool | None = None, + can_invite_users: bool | None = None, + can_post_stories: bool | None = None, + can_edit_stories: bool | None = None, + can_delete_stories: bool | None = None, + can_post_messages: bool | None = None, + can_edit_messages: bool | None = None, + can_pin_messages: bool | None = None, + can_manage_topics: bool | None = None, + can_manage_direct_messages: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass :code:`False` for all boolean parameters to demote a user. Returns :code:`True` on success. @@ -2086,7 +2073,7 @@ class Bot: self, chat_id: ChatIdUnion, message_thread_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights, unless it is the creator of the topic. Returns :code:`True` on success. @@ -2110,9 +2097,9 @@ class Bot: chat_id: ChatIdUnion, user_id: int, permissions: ChatPermissions, - use_independent_chat_permissions: Optional[bool] = None, - until_date: Optional[DateTimeUnion] = None, - request_timeout: Optional[int] = None, + use_independent_chat_permissions: bool | None = None, + until_date: DateTimeUnion | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass :code:`True` for all permissions to lift restrictions from a user. Returns :code:`True` on success. @@ -2141,7 +2128,7 @@ class Bot: self, chat_id: ChatIdUnion, invite_link: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> ChatInviteLink: """ Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object. @@ -2164,30 +2151,28 @@ class Bot: self, chat_id: ChatIdUnion, animation: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. @@ -2252,26 +2237,26 @@ class Bot: self, chat_id: ChatIdUnion, audio: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. @@ -2333,9 +2318,9 @@ class Bot: self, chat_id: ChatIdUnion, action: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns :code:`True` on success. @@ -2367,21 +2352,21 @@ class Bot: chat_id: ChatIdUnion, phone_number: str, first_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -2433,20 +2418,20 @@ class Bot: async def send_dice( self, chat_id: ChatIdUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send an animated emoji that will display a random value. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -2493,24 +2478,24 @@ class Bot: self, chat_id: ChatIdUnion, document: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send general files. On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. @@ -2567,17 +2552,17 @@ class Bot: self, chat_id: int, game_short_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -2624,34 +2609,34 @@ class Bot: payload: str, currency: str, prices: list[LabeledPrice], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -2737,23 +2722,23 @@ class Bot: chat_id: ChatIdUnion, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send point on the map. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -2810,17 +2795,17 @@ class Bot: self, chat_id: ChatIdUnion, media: list[MediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> list[Message]: """ Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of :class:`aiogram.types.message.Message` objects that were sent is returned. @@ -2863,27 +2848,23 @@ class Bot: self, chat_id: ChatIdUnion, text: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send text messages. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -2938,26 +2919,24 @@ class Bot: self, chat_id: ChatIdUnion, photo: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send photos. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -3015,29 +2994,29 @@ class Bot: chat_id: ChatIdUnion, question: str, options: list[InputPollOptionUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send a native poll. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -3106,20 +3085,20 @@ class Bot: self, chat_id: ChatIdUnion, sticker: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send static .WEBP, `animated `_ .TGS, or `video `_ .WEBM stickers. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -3171,23 +3150,23 @@ class Bot: longitude: float, title: str, address: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send information about a venue. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -3248,33 +3227,31 @@ class Bot: self, chat_id: ChatIdUnion, video: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as :class:`aiogram.types.document.Document`). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. @@ -3345,22 +3322,22 @@ class Bot: self, chat_id: ChatIdUnion, video_note: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ As of `v.4.0 `_, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -3413,23 +3390,23 @@ class Bot: self, chat_id: ChatIdUnion, voice: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as :class:`aiogram.types.audio.Audio` or :class:`aiogram.types.document.Document`). On success, the sent :class:`aiogram.types.message.Message` is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. @@ -3485,7 +3462,7 @@ class Bot: chat_id: ChatIdUnion, user_id: int, custom_title: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns :code:`True` on success. @@ -3509,8 +3486,8 @@ class Bot: async def set_chat_description( self, chat_id: ChatIdUnion, - description: Optional[str] = None, - request_timeout: Optional[int] = None, + description: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. @@ -3531,9 +3508,9 @@ class Bot: async def set_chat_menu_button( self, - chat_id: Optional[int] = None, - menu_button: Optional[MenuButtonUnion] = None, - request_timeout: Optional[int] = None, + chat_id: int | None = None, + menu_button: MenuButtonUnion | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the bot's menu button in a private chat, or the default menu button. Returns :code:`True` on success. @@ -3556,8 +3533,8 @@ class Bot: self, chat_id: ChatIdUnion, permissions: ChatPermissions, - use_independent_chat_permissions: Optional[bool] = None, - request_timeout: Optional[int] = None, + use_independent_chat_permissions: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can_restrict_members* administrator rights. Returns :code:`True` on success. @@ -3582,7 +3559,7 @@ class Bot: self, chat_id: ChatIdUnion, photo: InputFile, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. @@ -3605,7 +3582,7 @@ class Bot: self, chat_id: ChatIdUnion, sticker_set_name: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field *can_set_sticker_set* optionally returned in :class:`aiogram.methods.get_chat.GetChat` requests to check if the bot can use this method. Returns :code:`True` on success. @@ -3628,7 +3605,7 @@ class Bot: self, chat_id: ChatIdUnion, title: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. @@ -3651,13 +3628,13 @@ class Bot: self, user_id: int, score: int, - force: Optional[bool] = None, - disable_edit_message: Optional[bool] = None, - chat_id: Optional[int] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - request_timeout: Optional[int] = None, - ) -> Union[Message, bool]: + force: bool | None = None, + disable_edit_message: bool | None = None, + chat_id: int | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + request_timeout: int | None = None, + ) -> Message | bool: """ Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is :code:`False`. @@ -3688,9 +3665,9 @@ class Bot: async def set_my_commands( self, commands: list[BotCommand], - scope: Optional[BotCommandScopeUnion] = None, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + scope: BotCommandScopeUnion | None = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the list of the bot's commands. See `this manual `_ for more details about bot commands. Returns :code:`True` on success. @@ -3713,9 +3690,9 @@ class Bot: async def set_my_default_administrator_rights( self, - rights: Optional[ChatAdministratorRights] = None, - for_channels: Optional[bool] = None, - request_timeout: Optional[int] = None, + rights: ChatAdministratorRights | None = None, + for_channels: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns :code:`True` on success. @@ -3738,7 +3715,7 @@ class Bot: self, user_id: int, errors: list[PassportElementErrorUnion], - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns :code:`True` on success. @@ -3762,7 +3739,7 @@ class Bot: self, sticker: str, position: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to move a sticker in a set created by the bot to a specific position. Returns :code:`True` on success. @@ -3784,13 +3761,13 @@ class Bot: async def set_webhook( self, url: str, - certificate: Optional[InputFile] = None, - ip_address: Optional[str] = None, - max_connections: Optional[int] = None, - allowed_updates: Optional[list[str]] = None, - drop_pending_updates: Optional[bool] = None, - secret_token: Optional[str] = None, - request_timeout: Optional[int] = None, + certificate: InputFile | None = None, + ip_address: str | None = None, + max_connections: int | None = None, + allowed_updates: list[str] | None = None, + drop_pending_updates: bool | None = None, + secret_token: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized :class:`aiogram.types.update.Update`. In case of an unsuccessful request (a request with response `HTTP status code `_ different from :code:`2XY`), we will repeat the request and give up after a reasonable amount of attempts. Returns :code:`True` on success. @@ -3831,13 +3808,13 @@ class Bot: async def stop_message_live_location( self, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, - ) -> Union[Message, bool]: + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, + ) -> Message | bool: """ Use this method to stop updating a live location message before *live_period* expires. On success, if the message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. @@ -3865,9 +3842,9 @@ class Bot: self, chat_id: ChatIdUnion, message_id: int, - business_connection_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, ) -> Poll: """ Use this method to stop a poll which was sent by the bot. On success, the stopped :class:`aiogram.types.poll.Poll` is returned. @@ -3894,8 +3871,8 @@ class Bot: self, chat_id: ChatIdUnion, user_id: int, - only_if_banned: Optional[bool] = None, - request_timeout: Optional[int] = None, + only_if_banned: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to unban a previously banned user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be **removed** from the chat. If you don't want this, use the parameter *only_if_banned*. Returns :code:`True` on success. @@ -3920,7 +3897,7 @@ class Bot: self, chat_id: ChatIdUnion, sender_chat_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns :code:`True` on success. @@ -3942,7 +3919,7 @@ class Bot: async def unpin_all_chat_messages( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns :code:`True` on success. @@ -3963,7 +3940,7 @@ class Bot: self, chat_id: ChatIdUnion, message_thread_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success. @@ -3985,9 +3962,9 @@ class Bot: async def unpin_chat_message( self, chat_id: ChatIdUnion, - business_connection_id: Optional[str] = None, - message_id: Optional[int] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_id: int | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns :code:`True` on success. @@ -4013,7 +3990,7 @@ class Bot: user_id: int, sticker: InputFile, sticker_format: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> File: """ Use this method to upload a file with a sticker for later use in the :class:`aiogram.methods.create_new_sticker_set.CreateNewStickerSet`, :class:`aiogram.methods.add_sticker_to_set.AddStickerToSet`, or :class:`aiogram.methods.replace_sticker_in_set.ReplaceStickerInSet` methods (the file can be used multiple times). Returns the uploaded :class:`aiogram.types.file.File` on success. @@ -4037,7 +4014,7 @@ class Bot: async def close_general_forum_topic( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success. @@ -4058,7 +4035,7 @@ class Bot: self, chat_id: ChatIdUnion, name: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success. @@ -4080,7 +4057,7 @@ class Bot: async def hide_general_forum_topic( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically closed if it was open. Returns :code:`True` on success. @@ -4100,7 +4077,7 @@ class Bot: async def reopen_general_forum_topic( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. The topic will be automatically unhidden if it was hidden. Returns :code:`True` on success. @@ -4120,7 +4097,7 @@ class Bot: async def unhide_general_forum_topic( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns :code:`True` on success. @@ -4140,7 +4117,7 @@ class Bot: async def delete_sticker_set( self, name: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete a sticker set that was created by the bot. Returns :code:`True` on success. @@ -4159,8 +4136,8 @@ class Bot: async def get_my_description( self, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> BotDescription: """ Use this method to get the current bot description for the given user language. Returns :class:`aiogram.types.bot_description.BotDescription` on success. @@ -4179,8 +4156,8 @@ class Bot: async def get_my_short_description( self, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> BotShortDescription: """ Use this method to get the current bot short description for the given user language. Returns :class:`aiogram.types.bot_short_description.BotShortDescription` on success. @@ -4200,8 +4177,8 @@ class Bot: async def set_custom_emoji_sticker_set_thumbnail( self, name: str, - custom_emoji_id: Optional[str] = None, - request_timeout: Optional[int] = None, + custom_emoji_id: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to set the thumbnail of a custom emoji sticker set. Returns :code:`True` on success. @@ -4222,9 +4199,9 @@ class Bot: async def set_my_description( self, - description: Optional[str] = None, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + description: str | None = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns :code:`True` on success. @@ -4245,9 +4222,9 @@ class Bot: async def set_my_short_description( self, - short_description: Optional[str] = None, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + short_description: str | None = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns :code:`True` on success. @@ -4270,7 +4247,7 @@ class Bot: self, sticker: str, emoji_list: list[str], - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns :code:`True` on success. @@ -4292,8 +4269,8 @@ class Bot: async def set_sticker_keywords( self, sticker: str, - keywords: Optional[list[str]] = None, - request_timeout: Optional[int] = None, + keywords: list[str] | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns :code:`True` on success. @@ -4315,8 +4292,8 @@ class Bot: async def set_sticker_mask_position( self, sticker: str, - mask_position: Optional[MaskPosition] = None, - request_timeout: Optional[int] = None, + mask_position: MaskPosition | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the `mask position `_ of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns :code:`True` on success. @@ -4340,8 +4317,8 @@ class Bot: name: str, user_id: int, format: str, - thumbnail: Optional[InputFileUnion] = None, - request_timeout: Optional[int] = None, + thumbnail: InputFileUnion | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns :code:`True` on success. @@ -4368,7 +4345,7 @@ class Bot: self, name: str, title: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to set the title of a created sticker set. Returns :code:`True` on success. @@ -4389,8 +4366,8 @@ class Bot: async def get_my_name( self, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> BotName: """ Use this method to get the current bot name for the given user language. Returns :class:`aiogram.types.bot_name.BotName` on success. @@ -4409,9 +4386,9 @@ class Bot: async def set_my_name( self, - name: Optional[str] = None, - language_code: Optional[str] = None, - request_timeout: Optional[int] = None, + name: str | None = None, + language_code: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the bot's name. Returns :code:`True` on success. @@ -4433,7 +4410,7 @@ class Bot: async def unpin_all_general_forum_topic_messages( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success. @@ -4455,12 +4432,12 @@ class Bot: chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_ids: list[int], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - remove_caption: Optional[bool] = None, - request_timeout: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + remove_caption: bool | None = None, + request_timeout: int | None = None, ) -> list[MessageId]: """ Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz :class:`aiogram.methods.poll.Poll` can be copied only if the value of the field *correct_option_id* is known to the bot. The method is analogous to the method :class:`aiogram.methods.forward_messages.ForwardMessages`, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of :class:`aiogram.types.message_id.MessageId` of the sent messages is returned. @@ -4495,7 +4472,7 @@ class Bot: self, chat_id: ChatIdUnion, message_ids: list[int], - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns :code:`True` on success. @@ -4519,11 +4496,11 @@ class Bot: chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_ids: list[int], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - request_timeout: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + request_timeout: int | None = None, ) -> list[MessageId]: """ Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of :class:`aiogram.types.message_id.MessageId` of the sent messages is returned. @@ -4556,7 +4533,7 @@ class Bot: self, chat_id: ChatIdUnion, user_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> UserChatBoosts: """ Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a :class:`aiogram.types.user_chat_boosts.UserChatBoosts` object. @@ -4579,9 +4556,9 @@ class Bot: self, chat_id: ChatIdUnion, message_id: int, - reaction: Optional[list[ReactionTypeUnion]] = None, - is_big: Optional[bool] = None, - request_timeout: Optional[int] = None, + reaction: list[ReactionTypeUnion] | None = None, + is_big: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns :code:`True` on success. @@ -4607,7 +4584,7 @@ class Bot: async def get_business_connection( self, business_connection_id: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> BusinessConnection: """ Use this method to get information about the connection of the bot with a business account. Returns a :class:`aiogram.types.business_connection.BusinessConnection` object on success. @@ -4630,7 +4607,7 @@ class Bot: name: str, old_sticker: str, sticker: InputSticker, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling :class:`aiogram.methods.delete_sticker_from_set.DeleteStickerFromSet`, then :class:`aiogram.methods.add_sticker_to_set.AddStickerToSet`, then :class:`aiogram.methods.set_sticker_position_in_set.SetStickerPositionInSet`. Returns :code:`True` on success. @@ -4657,7 +4634,7 @@ class Bot: self, user_id: int, telegram_payment_charge_id: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Refunds a successful payment in `Telegram Stars `_. Returns :code:`True` on success. @@ -4678,9 +4655,9 @@ class Bot: async def get_star_transactions( self, - offset: Optional[int] = None, - limit: Optional[int] = None, - request_timeout: Optional[int] = None, + offset: int | None = None, + limit: int | None = None, + request_timeout: int | None = None, ) -> StarTransactions: """ Returns the bot's Telegram Star transactions in chronological order. On success, returns a :class:`aiogram.types.star_transactions.StarTransactions` object. @@ -4704,21 +4681,21 @@ class Bot: chat_id: ChatIdUnion, star_count: int, media: list[InputPaidMediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - payload: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - allow_paid_broadcast: Optional[bool] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - request_timeout: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + payload: str | None = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + allow_paid_broadcast: bool | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send paid media. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -4772,8 +4749,8 @@ class Bot: chat_id: ChatIdUnion, subscription_period: DateTimeUnion, subscription_price: int, - name: Optional[str] = None, - request_timeout: Optional[int] = None, + name: str | None = None, + request_timeout: int | None = None, ) -> ChatInviteLink: """ Use this method to create a `subscription invite link `_ for a channel chat. The bot must have the *can_invite_users* administrator rights. The link can be edited using the method :class:`aiogram.methods.edit_chat_subscription_invite_link.EditChatSubscriptionInviteLink` or revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object. @@ -4800,8 +4777,8 @@ class Bot: self, chat_id: ChatIdUnion, invite_link: str, - name: Optional[str] = None, - request_timeout: Optional[int] = None, + name: str | None = None, + request_timeout: int | None = None, ) -> ChatInviteLink: """ Use this method to edit a subscription invite link created by the bot. The bot must have the *can_invite_users* administrator rights. Returns the edited invite link as a :class:`aiogram.types.chat_invite_link.ChatInviteLink` object. @@ -4827,7 +4804,7 @@ class Bot: user_id: int, telegram_payment_charge_id: str, is_canceled: bool, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns :code:`True` on success. @@ -4850,7 +4827,7 @@ class Bot: async def get_available_gifts( self, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> Gifts: """ Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object. @@ -4868,11 +4845,11 @@ class Bot: self, user_id: int, result: InlineQueryResultUnion, - allow_user_chats: Optional[bool] = None, - allow_bot_chats: Optional[bool] = None, - allow_group_chats: Optional[bool] = None, - allow_channel_chats: Optional[bool] = None, - request_timeout: Optional[int] = None, + allow_user_chats: bool | None = None, + allow_bot_chats: bool | None = None, + allow_group_chats: bool | None = None, + allow_channel_chats: bool | None = None, + request_timeout: int | None = None, ) -> PreparedInlineMessage: """ Stores a message that can be sent by a user of a Mini App. Returns a :class:`aiogram.types.prepared_inline_message.PreparedInlineMessage` object. @@ -4902,13 +4879,13 @@ class Bot: async def send_gift( self, gift_id: str, - user_id: Optional[int] = None, - chat_id: Optional[ChatIdUnion] = None, - pay_for_upgrade: Optional[bool] = None, - text: Optional[str] = None, - text_parse_mode: Optional[str] = None, - text_entities: Optional[list[MessageEntity]] = None, - request_timeout: Optional[int] = None, + user_id: int | None = None, + chat_id: ChatIdUnion | None = None, + pay_for_upgrade: bool | None = None, + text: str | None = None, + text_parse_mode: str | None = None, + text_entities: list[MessageEntity] | None = None, + request_timeout: int | None = None, ) -> bool: """ Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns :code:`True` on success. @@ -4940,9 +4917,9 @@ class Bot: async def set_user_emoji_status( self, user_id: int, - emoji_status_custom_emoji_id: Optional[str] = None, - emoji_status_expiration_date: Optional[DateTimeUnion] = None, - request_timeout: Optional[int] = None, + emoji_status_custom_emoji_id: str | None = None, + emoji_status_expiration_date: DateTimeUnion | None = None, + request_timeout: int | None = None, ) -> bool: """ Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method `requestEmojiStatusAccess `_. Returns :code:`True` on success. @@ -4966,7 +4943,7 @@ class Bot: async def remove_chat_verification( self, chat_id: ChatIdUnion, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Removes verification from a chat that is currently verified `on behalf of the organization `_ represented by the bot. Returns :code:`True` on success. @@ -4986,7 +4963,7 @@ class Bot: async def remove_user_verification( self, user_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Removes verification from a user who is currently verified `on behalf of the organization `_ represented by the bot. Returns :code:`True` on success. @@ -5006,8 +4983,8 @@ class Bot: async def verify_chat( self, chat_id: ChatIdUnion, - custom_description: Optional[str] = None, - request_timeout: Optional[int] = None, + custom_description: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Verifies a chat `on behalf of the organization `_ which is represented by the bot. Returns :code:`True` on success. @@ -5029,8 +5006,8 @@ class Bot: async def verify_user( self, user_id: int, - custom_description: Optional[str] = None, - request_timeout: Optional[int] = None, + custom_description: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Verifies a user `on behalf of the organization `_ which is represented by the bot. Returns :code:`True` on success. @@ -5053,7 +5030,7 @@ class Bot: self, business_connection_id: str, owned_gift_id: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Converts a given regular gift to Telegram Stars. Requires the *can_convert_gifts_to_stars* business bot right. Returns :code:`True` on success. @@ -5076,7 +5053,7 @@ class Bot: self, business_connection_id: str, message_ids: list[int], - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Delete messages on behalf of a business account. Requires the *can_delete_sent_messages* business bot right to delete messages sent by the bot itself, or the *can_delete_all_messages* business bot right to delete any message. Returns :code:`True` on success. @@ -5099,7 +5076,7 @@ class Bot: self, business_connection_id: str, story_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Deletes a story previously posted by the bot on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :code:`True` on success. @@ -5123,11 +5100,11 @@ class Bot: business_connection_id: str, story_id: int, content: InputStoryContentUnion, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - areas: Optional[list[StoryArea]] = None, - request_timeout: Optional[int] = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + areas: list[StoryArea] | None = None, + request_timeout: int | None = None, ) -> Story: """ Edits a story previously posted by the bot on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :class:`aiogram.types.story.Story` on success. @@ -5159,18 +5136,18 @@ class Bot: async def get_business_account_gifts( self, business_connection_id: str, - exclude_unsaved: Optional[bool] = None, - exclude_saved: Optional[bool] = None, - exclude_unlimited: Optional[bool] = None, - exclude_limited_upgradable: Optional[bool] = None, - exclude_limited_non_upgradable: Optional[bool] = None, - exclude_unique: Optional[bool] = None, - exclude_from_blockchain: Optional[bool] = None, - sort_by_price: Optional[bool] = None, - offset: Optional[str] = None, - limit: Optional[int] = None, - exclude_limited: Optional[bool] = None, - request_timeout: Optional[int] = None, + exclude_unsaved: bool | None = None, + exclude_saved: bool | None = None, + exclude_unlimited: bool | None = None, + exclude_limited_upgradable: bool | None = None, + exclude_limited_non_upgradable: bool | None = None, + exclude_unique: bool | None = None, + exclude_from_blockchain: bool | None = None, + sort_by_price: bool | None = None, + offset: str | None = None, + limit: int | None = None, + exclude_limited: bool | None = None, + request_timeout: int | None = None, ) -> OwnedGifts: """ Returns the gifts received and owned by a managed business account. Requires the *can_view_gifts_and_stars* business bot right. Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success. @@ -5212,7 +5189,7 @@ class Bot: async def get_business_account_star_balance( self, business_connection_id: str, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> StarAmount: """ Returns the amount of Telegram Stars owned by a managed business account. Requires the *can_view_gifts_and_stars* business bot right. Returns :class:`aiogram.types.star_amount.StarAmount` on success. @@ -5234,10 +5211,10 @@ class Bot: user_id: int, month_count: int, star_count: int, - text: Optional[str] = None, - text_parse_mode: Optional[str] = None, - text_entities: Optional[list[MessageEntity]] = None, - request_timeout: Optional[int] = None, + text: str | None = None, + text_parse_mode: str | None = None, + text_entities: list[MessageEntity] | None = None, + request_timeout: int | None = None, ) -> bool: """ Gifts a Telegram Premium subscription to the given user. Returns :code:`True` on success. @@ -5269,13 +5246,13 @@ class Bot: business_connection_id: str, content: InputStoryContentUnion, active_period: int, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - areas: Optional[list[StoryArea]] = None, - post_to_chat_page: Optional[bool] = None, - protect_content: Optional[bool] = None, - request_timeout: Optional[int] = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + areas: list[StoryArea] | None = None, + post_to_chat_page: bool | None = None, + protect_content: bool | None = None, + request_timeout: int | None = None, ) -> Story: """ Posts a story on behalf of a managed business account. Requires the *can_manage_stories* business bot right. Returns :class:`aiogram.types.story.Story` on success. @@ -5313,7 +5290,7 @@ class Bot: business_connection_id: str, chat_id: int, message_id: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Marks incoming message as read on behalf of a business account. Requires the *can_read_messages* business bot right. Returns :code:`True` on success. @@ -5337,8 +5314,8 @@ class Bot: async def remove_business_account_profile_photo( self, business_connection_id: str, - is_public: Optional[bool] = None, - request_timeout: Optional[int] = None, + is_public: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Removes the current profile photo of a managed business account. Requires the *can_edit_profile_photo* business bot right. Returns :code:`True` on success. @@ -5360,8 +5337,8 @@ class Bot: async def set_business_account_bio( self, business_connection_id: str, - bio: Optional[str] = None, - request_timeout: Optional[int] = None, + bio: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Changes the bio of a managed business account. Requires the *can_change_bio* business bot right. Returns :code:`True` on success. @@ -5385,7 +5362,7 @@ class Bot: business_connection_id: str, show_gift_button: bool, accepted_gift_types: AcceptedGiftTypes, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the *can_change_gift_settings* business bot right. Returns :code:`True` on success. @@ -5410,8 +5387,8 @@ class Bot: self, business_connection_id: str, first_name: str, - last_name: Optional[str] = None, - request_timeout: Optional[int] = None, + last_name: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Changes the first and last name of a managed business account. Requires the *can_change_name* business bot right. Returns :code:`True` on success. @@ -5436,8 +5413,8 @@ class Bot: self, business_connection_id: str, photo: InputProfilePhotoUnion, - is_public: Optional[bool] = None, - request_timeout: Optional[int] = None, + is_public: bool | None = None, + request_timeout: int | None = None, ) -> bool: """ Changes the profile photo of a managed business account. Requires the *can_edit_profile_photo* business bot right. Returns :code:`True` on success. @@ -5461,8 +5438,8 @@ class Bot: async def set_business_account_username( self, business_connection_id: str, - username: Optional[str] = None, - request_timeout: Optional[int] = None, + username: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Changes the username of a managed business account. Requires the *can_change_username* business bot right. Returns :code:`True` on success. @@ -5485,7 +5462,7 @@ class Bot: self, business_connection_id: str, star_count: int, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> bool: """ Transfers Telegram Stars from the business account balance to the bot's balance. Requires the *can_transfer_stars* business bot right. Returns :code:`True` on success. @@ -5509,8 +5486,8 @@ class Bot: business_connection_id: str, owned_gift_id: str, new_owner_chat_id: int, - star_count: Optional[int] = None, - request_timeout: Optional[int] = None, + star_count: int | None = None, + request_timeout: int | None = None, ) -> bool: """ Transfers an owned unique gift to another user. Requires the *can_transfer_and_upgrade_gifts* business bot right. Requires *can_transfer_stars* business bot right if the transfer is paid. Returns :code:`True` on success. @@ -5537,9 +5514,9 @@ class Bot: self, business_connection_id: str, owned_gift_id: str, - keep_original_details: Optional[bool] = None, - star_count: Optional[int] = None, - request_timeout: Optional[int] = None, + keep_original_details: bool | None = None, + star_count: int | None = None, + request_timeout: int | None = None, ) -> bool: """ Upgrades a given regular gift to a unique gift. Requires the *can_transfer_and_upgrade_gifts* business bot right. Additionally requires the *can_transfer_stars* business bot right if the upgrade is paid. Returns :code:`True` on success. @@ -5568,8 +5545,8 @@ class Bot: chat_id: int, message_id: int, checklist: InputChecklist, - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to edit a checklist on behalf of a connected business account. On success, the edited :class:`aiogram.types.message.Message` is returned. @@ -5596,7 +5573,7 @@ class Bot: async def get_my_star_balance( self, - request_timeout: Optional[int] = None, + request_timeout: int | None = None, ) -> StarAmount: """ A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a :class:`aiogram.types.star_amount.StarAmount` object. @@ -5615,12 +5592,12 @@ class Bot: business_connection_id: str, chat_id: int, checklist: InputChecklist, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - request_timeout: Optional[int] = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + request_timeout: int | None = None, ) -> Message: """ Use this method to send a checklist on behalf of a connected business account. On success, the sent :class:`aiogram.types.message.Message` is returned. @@ -5655,8 +5632,8 @@ class Bot: self, chat_id: int, message_id: int, - send_date: Optional[DateTimeUnion] = None, - request_timeout: Optional[int] = None, + send_date: DateTimeUnion | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns :code:`True` on success. @@ -5681,8 +5658,8 @@ class Bot: self, chat_id: int, message_id: int, - comment: Optional[str] = None, - request_timeout: Optional[int] = None, + comment: str | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns :code:`True` on success. @@ -5706,17 +5683,17 @@ class Bot: async def get_chat_gifts( self, chat_id: ChatIdUnion, - exclude_unsaved: Optional[bool] = None, - exclude_saved: Optional[bool] = None, - exclude_unlimited: Optional[bool] = None, - exclude_limited_upgradable: Optional[bool] = None, - exclude_limited_non_upgradable: Optional[bool] = None, - exclude_from_blockchain: Optional[bool] = None, - exclude_unique: Optional[bool] = None, - sort_by_price: Optional[bool] = None, - offset: Optional[str] = None, - limit: Optional[int] = None, - request_timeout: Optional[int] = None, + exclude_unsaved: bool | None = None, + exclude_saved: bool | None = None, + exclude_unlimited: bool | None = None, + exclude_limited_upgradable: bool | None = None, + exclude_limited_non_upgradable: bool | None = None, + exclude_from_blockchain: bool | None = None, + exclude_unique: bool | None = None, + sort_by_price: bool | None = None, + offset: str | None = None, + limit: int | None = None, + request_timeout: int | None = None, ) -> OwnedGifts: """ Returns the gifts owned by a chat. Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success. @@ -5756,15 +5733,15 @@ class Bot: async def get_user_gifts( self, user_id: int, - exclude_unlimited: Optional[bool] = None, - exclude_limited_upgradable: Optional[bool] = None, - exclude_limited_non_upgradable: Optional[bool] = None, - exclude_from_blockchain: Optional[bool] = None, - exclude_unique: Optional[bool] = None, - sort_by_price: Optional[bool] = None, - offset: Optional[str] = None, - limit: Optional[int] = None, - request_timeout: Optional[int] = None, + exclude_unlimited: bool | None = None, + exclude_limited_upgradable: bool | None = None, + exclude_limited_non_upgradable: bool | None = None, + exclude_from_blockchain: bool | None = None, + exclude_unique: bool | None = None, + sort_by_price: bool | None = None, + offset: str | None = None, + limit: int | None = None, + request_timeout: int | None = None, ) -> OwnedGifts: """ Returns the gifts owned and hosted by a user. Returns :class:`aiogram.types.owned_gifts.OwnedGifts` on success. @@ -5803,9 +5780,9 @@ class Bot: from_chat_id: int, from_story_id: int, active_period: int, - post_to_chat_page: Optional[bool] = None, - protect_content: Optional[bool] = None, - request_timeout: Optional[int] = None, + post_to_chat_page: bool | None = None, + protect_content: bool | None = None, + request_timeout: int | None = None, ) -> Story: """ Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the *can_manage_stories* business bot right for both business accounts. Returns :class:`aiogram.types.story.Story` on success. @@ -5837,10 +5814,10 @@ class Bot: chat_id: int, draft_id: int, text: str, - message_thread_id: Optional[int] = None, - parse_mode: Optional[str] = None, - entities: Optional[list[MessageEntity]] = None, - request_timeout: Optional[int] = None, + message_thread_id: int | None = None, + parse_mode: str | None = None, + entities: list[MessageEntity] | None = None, + request_timeout: int | None = None, ) -> bool: """ Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns :code:`True` on success. diff --git a/aiogram/client/context_controller.py b/aiogram/client/context_controller.py index 18788e49..7f739fc3 100644 --- a/aiogram/client/context_controller.py +++ b/aiogram/client/context_controller.py @@ -1,4 +1,6 @@ -from typing import TYPE_CHECKING, Any, Optional +from __future__ import annotations + +from typing import TYPE_CHECKING, Any from pydantic import BaseModel, PrivateAttr from typing_extensions import Self @@ -8,12 +10,12 @@ if TYPE_CHECKING: class BotContextController(BaseModel): - _bot: Optional["Bot"] = PrivateAttr() + _bot: Bot | None = PrivateAttr() def model_post_init(self, __context: Any) -> None: # noqa: PYI063 self._bot = __context.get("bot") if __context else None - def as_(self, bot: Optional["Bot"]) -> Self: + def as_(self, bot: Bot | None) -> Self: """ Bind object to a bot instance. @@ -24,7 +26,7 @@ class BotContextController(BaseModel): return self @property - def bot(self) -> Optional["Bot"]: + def bot(self) -> Bot | None: """ Get bot instance. diff --git a/aiogram/dispatcher/flags.py b/aiogram/dispatcher/flags.py index ad5a886b..f7b6a76d 100644 --- a/aiogram/dispatcher/flags.py +++ b/aiogram/dispatcher/flags.py @@ -1,6 +1,8 @@ +from __future__ import annotations + from collections.abc import Callable from dataclasses import dataclass -from typing import TYPE_CHECKING, Any, Union, cast, overload +from typing import TYPE_CHECKING, Any, cast, overload from magic_filter import AttrDict, MagicFilter @@ -42,7 +44,7 @@ class FlagDecorator: self, value: Any | None = None, **kwargs: Any, - ) -> Union[Callable[..., Any], "FlagDecorator"]: + ) -> Callable[..., Any] | FlagDecorator: if value and kwargs: msg = "The arguments `value` and **kwargs can not be used together" raise ValueError(msg) @@ -86,7 +88,7 @@ def extract_flags_from_object(obj: Any) -> dict[str, Any]: return cast(dict[str, Any], obj.aiogram_flag) -def extract_flags(handler: Union["HandlerObject", dict[str, Any]]) -> dict[str, Any]: +def extract_flags(handler: HandlerObject | dict[str, Any]) -> dict[str, Any]: """ Extract flags from handler or middleware context data @@ -101,7 +103,7 @@ def extract_flags(handler: Union["HandlerObject", dict[str, Any]]) -> dict[str, def get_flag( - handler: Union["HandlerObject", dict[str, Any]], + handler: HandlerObject | dict[str, Any], name: str, *, default: Any | None = None, @@ -118,7 +120,7 @@ def get_flag( return flags.get(name, default) -def check_flags(handler: Union["HandlerObject", dict[str, Any]], magic: MagicFilter) -> Any: +def check_flags(handler: HandlerObject | dict[str, Any], magic: MagicFilter) -> Any: """ Check flags via magic filter diff --git a/aiogram/exceptions.py b/aiogram/exceptions.py index 2b8efcbb..47feea5f 100644 --- a/aiogram/exceptions.py +++ b/aiogram/exceptions.py @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any from aiogram.methods import TelegramMethod from aiogram.methods.base import TelegramType diff --git a/aiogram/filters/base.py b/aiogram/filters/base.py index 34c88115..e0445cb4 100644 --- a/aiogram/filters/base.py +++ b/aiogram/filters/base.py @@ -27,7 +27,7 @@ class Filter(ABC): # noqa: B024 Accepts incoming event and should return boolean or dict. - :return: :class:`bool` or :class:`Dict[str, Any]` + :return: :class:`bool` or :class:`dict[str, Any]` """ def __invert__(self) -> "_InvertFilter": diff --git a/aiogram/filters/chat_member_updated.py b/aiogram/filters/chat_member_updated.py index 08538f55..dc86fe21 100644 --- a/aiogram/filters/chat_member_updated.py +++ b/aiogram/filters/chat_member_updated.py @@ -1,4 +1,6 @@ -from typing import Any, TypeVar, Union +from __future__ import annotations + +from typing import Any, TypeVar from typing_extensions import Self @@ -34,7 +36,7 @@ class _MemberStatusMarker: def __or__( self, - other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], + other: _MemberStatusMarker | _MemberStatusGroupMarker, ) -> "_MemberStatusGroupMarker": if isinstance(other, _MemberStatusMarker): return _MemberStatusGroupMarker(self, other) @@ -50,7 +52,7 @@ class _MemberStatusMarker: def __rshift__( self, - other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], + other: _MemberStatusMarker | _MemberStatusGroupMarker, ) -> "_MemberStatusTransition": old = _MemberStatusGroupMarker(self) if isinstance(other, _MemberStatusMarker): @@ -65,7 +67,7 @@ class _MemberStatusMarker: def __lshift__( self, - other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], + other: _MemberStatusMarker | _MemberStatusGroupMarker, ) -> "_MemberStatusTransition": new = _MemberStatusGroupMarker(self) if isinstance(other, _MemberStatusMarker): @@ -101,7 +103,7 @@ class _MemberStatusGroupMarker: def __or__( self, - other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], + other: _MemberStatusMarker | _MemberStatusGroupMarker, ) -> Self: if isinstance(other, _MemberStatusMarker): return type(self)(*self.statuses, other) @@ -115,7 +117,7 @@ class _MemberStatusGroupMarker: def __rshift__( self, - other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], + other: _MemberStatusMarker | _MemberStatusGroupMarker, ) -> "_MemberStatusTransition": if isinstance(other, _MemberStatusMarker): return _MemberStatusTransition(old=self, new=_MemberStatusGroupMarker(other)) @@ -129,7 +131,7 @@ class _MemberStatusGroupMarker: def __lshift__( self, - other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], + other: _MemberStatusMarker | _MemberStatusGroupMarker, ) -> "_MemberStatusTransition": if isinstance(other, _MemberStatusMarker): return _MemberStatusTransition(old=_MemberStatusGroupMarker(other), new=self) diff --git a/aiogram/filters/command.py b/aiogram/filters/command.py index cce14491..cab50969 100644 --- a/aiogram/filters/command.py +++ b/aiogram/filters/command.py @@ -65,8 +65,7 @@ class Command(Filter): if not isinstance(commands, Iterable): msg = ( - "Command filter only supports str, re.Pattern, BotCommand object" - " or their Iterable" + "Command filter only supports str, re.Pattern, BotCommand object or their Iterable" ) raise ValueError(msg) diff --git a/aiogram/handlers/callback_query.py b/aiogram/handlers/callback_query.py index acea76d9..a4be9ff3 100644 --- a/aiogram/handlers/callback_query.py +++ b/aiogram/handlers/callback_query.py @@ -1,5 +1,4 @@ from abc import ABC -from typing import Optional from aiogram.handlers import BaseHandler from aiogram.types import CallbackQuery, MaybeInaccessibleMessage, User diff --git a/aiogram/handlers/message.py b/aiogram/handlers/message.py index 8660dde9..b726b908 100644 --- a/aiogram/handlers/message.py +++ b/aiogram/handlers/message.py @@ -1,5 +1,5 @@ from abc import ABC -from typing import Optional, cast +from typing import cast from aiogram.filters import CommandObject from aiogram.handlers.base import BaseHandler, BaseHandlerMixin diff --git a/aiogram/methods/answer_callback_query.py b/aiogram/methods/answer_callback_query.py index 15ed1bf5..822354ec 100644 --- a/aiogram/methods/answer_callback_query.py +++ b/aiogram/methods/answer_callback_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -19,13 +19,13 @@ class AnswerCallbackQuery(TelegramMethod[bool]): callback_query_id: str """Unique identifier for the query to be answered""" - text: Optional[str] = None + text: str | None = None """Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters""" - show_alert: Optional[bool] = None + show_alert: bool | None = None """If :code:`True`, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*.""" - url: Optional[str] = None + url: str | None = None """URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@BotFather `_, specify the URL that opens your game - note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton `_ *callback_game* button.""" - cache_time: Optional[int] = None + cache_time: int | None = None """The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.""" if TYPE_CHECKING: @@ -36,10 +36,10 @@ class AnswerCallbackQuery(TelegramMethod[bool]): __pydantic__self__, *, callback_query_id: str, - text: Optional[str] = None, - show_alert: Optional[bool] = None, - url: Optional[str] = None, - cache_time: Optional[int] = None, + text: str | None = None, + show_alert: bool | None = None, + url: str | None = None, + cache_time: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/answer_inline_query.py b/aiogram/methods/answer_inline_query.py index 28848673..7e4f7191 100644 --- a/aiogram/methods/answer_inline_query.py +++ b/aiogram/methods/answer_inline_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -24,20 +24,20 @@ class AnswerInlineQuery(TelegramMethod[bool]): """Unique identifier for the answered query""" results: list[InlineQueryResultUnion] """A JSON-serialized array of results for the inline query""" - cache_time: Optional[int] = None + cache_time: int | None = None """The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.""" - is_personal: Optional[bool] = None + is_personal: bool | None = None """Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.""" - next_offset: Optional[str] = None + next_offset: str | None = None """Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.""" - button: Optional[InlineQueryResultsButton] = None + button: InlineQueryResultsButton | None = None """A JSON-serialized object describing a button to be shown above inline query results""" - switch_pm_parameter: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + switch_pm_parameter: str | None = Field(None, json_schema_extra={"deprecated": True}) """`Deep-linking `_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. .. deprecated:: API:6.7 https://core.telegram.org/bots/api-changelog#april-21-2023""" - switch_pm_text: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + switch_pm_text: str | None = Field(None, json_schema_extra={"deprecated": True}) """If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* .. deprecated:: API:6.7 @@ -52,12 +52,12 @@ class AnswerInlineQuery(TelegramMethod[bool]): *, inline_query_id: str, results: list[InlineQueryResultUnion], - cache_time: Optional[int] = None, - is_personal: Optional[bool] = None, - next_offset: Optional[str] = None, - button: Optional[InlineQueryResultsButton] = None, - switch_pm_parameter: Optional[str] = None, - switch_pm_text: Optional[str] = None, + cache_time: int | None = None, + is_personal: bool | None = None, + next_offset: str | None = None, + button: InlineQueryResultsButton | None = None, + switch_pm_parameter: str | None = None, + switch_pm_text: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/answer_pre_checkout_query.py b/aiogram/methods/answer_pre_checkout_query.py index 479d76c9..f014be3e 100644 --- a/aiogram/methods/answer_pre_checkout_query.py +++ b/aiogram/methods/answer_pre_checkout_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -19,7 +19,7 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]): """Unique identifier for the query to be answered""" ok: bool """Specify :code:`True` if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use :code:`False` if there are any problems.""" - error_message: Optional[str] = None + error_message: str | None = None """Required if *ok* is :code:`False`. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.""" if TYPE_CHECKING: @@ -31,7 +31,7 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]): *, pre_checkout_query_id: str, ok: bool, - error_message: Optional[str] = None, + error_message: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/answer_shipping_query.py b/aiogram/methods/answer_shipping_query.py index eec59864..2f5601dc 100644 --- a/aiogram/methods/answer_shipping_query.py +++ b/aiogram/methods/answer_shipping_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ShippingOption from .base import TelegramMethod @@ -20,9 +20,9 @@ class AnswerShippingQuery(TelegramMethod[bool]): """Unique identifier for the query to be answered""" ok: bool """Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)""" - shipping_options: Optional[list[ShippingOption]] = None + shipping_options: list[ShippingOption] | None = None """Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options.""" - error_message: Optional[str] = None + error_message: str | None = None """Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. 'Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class AnswerShippingQuery(TelegramMethod[bool]): *, shipping_query_id: str, ok: bool, - shipping_options: Optional[list[ShippingOption]] = None, - error_message: Optional[str] = None, + shipping_options: list[ShippingOption] | None = None, + error_message: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/approve_suggested_post.py b/aiogram/methods/approve_suggested_post.py index 5fd36981..dddaa0af 100644 --- a/aiogram/methods/approve_suggested_post.py +++ b/aiogram/methods/approve_suggested_post.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import DateTimeUnion from .base import TelegramMethod @@ -20,7 +20,7 @@ class ApproveSuggestedPost(TelegramMethod[bool]): """Unique identifier for the target direct messages chat""" message_id: int """Identifier of a suggested post message to approve""" - send_date: Optional[DateTimeUnion] = None + send_date: DateTimeUnion | None = None """Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future""" if TYPE_CHECKING: @@ -32,7 +32,7 @@ class ApproveSuggestedPost(TelegramMethod[bool]): *, chat_id: int, message_id: int, - send_date: Optional[DateTimeUnion] = None, + send_date: DateTimeUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/ban_chat_member.py b/aiogram/methods/ban_chat_member.py index 57e2f532..ee728ad6 100644 --- a/aiogram/methods/ban_chat_member.py +++ b/aiogram/methods/ban_chat_member.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, DateTimeUnion from .base import TelegramMethod @@ -20,9 +20,9 @@ class BanChatMember(TelegramMethod[bool]): """Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)""" user_id: int """Unique identifier of the target user""" - until_date: Optional[DateTimeUnion] = None + until_date: DateTimeUnion | None = None """Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.""" - revoke_messages: Optional[bool] = None + revoke_messages: bool | None = None """Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels.""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class BanChatMember(TelegramMethod[bool]): *, chat_id: ChatIdUnion, user_id: int, - until_date: Optional[DateTimeUnion] = None, - revoke_messages: Optional[bool] = None, + until_date: DateTimeUnion | None = None, + revoke_messages: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/base.py b/aiogram/methods/base.py index 36878a84..ca97dd7d 100644 --- a/aiogram/methods/base.py +++ b/aiogram/methods/base.py @@ -5,10 +5,8 @@ from typing import ( TYPE_CHECKING, Any, ClassVar, - Dict, Generator, Generic, - Optional, TypeVar, ) @@ -31,16 +29,16 @@ class Request(BaseModel): method: str - data: Dict[str, Optional[Any]] - files: Optional[Dict[str, InputFile]] + data: dict[str, Any | None] + files: dict[str, InputFile] | None class Response(BaseModel, Generic[TelegramType]): ok: bool - result: Optional[TelegramType] = None - description: Optional[str] = None - error_code: Optional[int] = None - parameters: Optional[ResponseParameters] = None + result: TelegramType | None = None + description: str | None = None + error_code: int | None = None + parameters: ResponseParameters | None = None class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC): @@ -52,7 +50,7 @@ class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC @model_validator(mode="before") @classmethod - def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]: + def remove_unset(cls, values: dict[str, Any]) -> dict[str, Any]: """ Remove UNSET before fields validation. diff --git a/aiogram/methods/copy_message.py b/aiogram/methods/copy_message.py index 60734784..6d840851 100644 --- a/aiogram/methods/copy_message.py +++ b/aiogram/methods/copy_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -33,42 +33,40 @@ class CopyMessage(TelegramMethod[MessageId]): """Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)""" message_id: int """Message identifier in the chat specified in *from_chat_id*""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - video_start_timestamp: Optional[DateTimeUnion] = None + video_start_timestamp: DateTimeUnion | None = None """New start timestamp for the copied video in the message""" - caption: Optional[str] = None + caption: str | None = None """New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the new caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """Pass :code:`True`, if the caption must be shown above the message media. Ignored if a new caption isn't specified.""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; only available when copying to private chats""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -84,24 +82,22 @@ class CopyMessage(TelegramMethod[MessageId]): chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_id: int, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - video_start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + video_start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/copy_messages.py b/aiogram/methods/copy_messages.py index 2ffd130a..02afd270 100644 --- a/aiogram/methods/copy_messages.py +++ b/aiogram/methods/copy_messages.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, MessageId from .base import TelegramMethod @@ -20,15 +20,15 @@ class CopyMessages(TelegramMethod[list[MessageId]]): """Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)""" message_ids: list[int] """A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order.""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the messages `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[bool] = None + protect_content: bool | None = None """Protects the contents of the sent messages from forwarding and saving""" - remove_caption: Optional[bool] = None + remove_caption: bool | None = None """Pass :code:`True` to copy the messages without their captions""" if TYPE_CHECKING: @@ -41,11 +41,11 @@ class CopyMessages(TelegramMethod[list[MessageId]]): chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_ids: list[int], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - remove_caption: Optional[bool] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + remove_caption: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/create_chat_invite_link.py b/aiogram/methods/create_chat_invite_link.py index dcca1ed3..e42572ae 100644 --- a/aiogram/methods/create_chat_invite_link.py +++ b/aiogram/methods/create_chat_invite_link.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion from .base import TelegramMethod @@ -18,13 +18,13 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]): chat_id: ChatIdUnion """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" - name: Optional[str] = None + name: str | None = None """Invite link name; 0-32 characters""" - expire_date: Optional[DateTimeUnion] = None + expire_date: DateTimeUnion | None = None """Point in time (Unix timestamp) when the link will expire""" - member_limit: Optional[int] = None + member_limit: int | None = None """The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999""" - creates_join_request: Optional[bool] = None + creates_join_request: bool | None = None """:code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified""" if TYPE_CHECKING: @@ -35,10 +35,10 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]): __pydantic__self__, *, chat_id: ChatIdUnion, - name: Optional[str] = None, - expire_date: Optional[DateTimeUnion] = None, - member_limit: Optional[int] = None, - creates_join_request: Optional[bool] = None, + name: str | None = None, + expire_date: DateTimeUnion | None = None, + member_limit: int | None = None, + creates_join_request: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/create_chat_subscription_invite_link.py b/aiogram/methods/create_chat_subscription_invite_link.py index 62327523..55ee9435 100644 --- a/aiogram/methods/create_chat_subscription_invite_link.py +++ b/aiogram/methods/create_chat_subscription_invite_link.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion from .base import TelegramMethod @@ -22,7 +22,7 @@ class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]): """The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).""" subscription_price: int """The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000""" - name: Optional[str] = None + name: str | None = None """Invite link name; 0-32 characters""" if TYPE_CHECKING: @@ -35,7 +35,7 @@ class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]): chat_id: ChatIdUnion, subscription_period: DateTimeUnion, subscription_price: int, - name: Optional[str] = None, + name: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/create_forum_topic.py b/aiogram/methods/create_forum_topic.py index c88f240b..0d7940a3 100644 --- a/aiogram/methods/create_forum_topic.py +++ b/aiogram/methods/create_forum_topic.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ForumTopic from .base import TelegramMethod @@ -20,9 +20,9 @@ class CreateForumTopic(TelegramMethod[ForumTopic]): """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)""" name: str """Topic name, 1-128 characters""" - icon_color: Optional[int] = None + icon_color: int | None = None """Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)""" - icon_custom_emoji_id: Optional[str] = None + icon_custom_emoji_id: str | None = None """Unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers.""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class CreateForumTopic(TelegramMethod[ForumTopic]): *, chat_id: ChatIdUnion, name: str, - icon_color: Optional[int] = None, - icon_custom_emoji_id: Optional[str] = None, + icon_color: int | None = None, + icon_custom_emoji_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/create_invoice_link.py b/aiogram/methods/create_invoice_link.py index 93c90a2b..d4eb3115 100644 --- a/aiogram/methods/create_invoice_link.py +++ b/aiogram/methods/create_invoice_link.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import LabeledPrice from .base import TelegramMethod @@ -26,39 +26,39 @@ class CreateInvoiceLink(TelegramMethod[str]): """Three-letter ISO 4217 currency code, see `more on currencies `_. Pass 'XTR' for payments in `Telegram Stars `_.""" prices: list[LabeledPrice] """Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars `_ only.""" - provider_token: Optional[str] = None + provider_token: str | None = None """Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.""" - subscription_period: Optional[int] = None + subscription_period: int | None = None """The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars.""" - max_tip_amount: Optional[int] = None + max_tip_amount: int | None = None """The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.""" - suggested_tip_amounts: Optional[list[int]] = None + suggested_tip_amounts: list[int] | None = None """A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*.""" - provider_data: Optional[str] = None + provider_data: str | None = None """JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.""" - photo_url: Optional[str] = None + photo_url: str | None = None """URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.""" - photo_size: Optional[int] = None + photo_size: int | None = None """Photo size in bytes""" - photo_width: Optional[int] = None + photo_width: int | None = None """Photo width""" - photo_height: Optional[int] = None + photo_height: int | None = None """Photo height""" - need_name: Optional[bool] = None + need_name: bool | None = None """Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_phone_number: Optional[bool] = None + need_phone_number: bool | None = None """Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_email: Optional[bool] = None + need_email: bool | None = None """Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_shipping_address: Optional[bool] = None + need_shipping_address: bool | None = None """Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars `_.""" - send_phone_number_to_provider: Optional[bool] = None + send_phone_number_to_provider: bool | None = None """Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars `_.""" - send_email_to_provider: Optional[bool] = None + send_email_to_provider: bool | None = None """Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars `_.""" - is_flexible: Optional[bool] = None + is_flexible: bool | None = None """Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars `_.""" if TYPE_CHECKING: @@ -73,23 +73,23 @@ class CreateInvoiceLink(TelegramMethod[str]): payload: str, currency: str, prices: list[LabeledPrice], - business_connection_id: Optional[str] = None, - provider_token: Optional[str] = None, - subscription_period: Optional[int] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, + business_connection_id: str | None = None, + provider_token: str | None = None, + subscription_period: int | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/create_new_sticker_set.py b/aiogram/methods/create_new_sticker_set.py index 842f9faf..258c7ce8 100644 --- a/aiogram/methods/create_new_sticker_set.py +++ b/aiogram/methods/create_new_sticker_set.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -26,11 +26,11 @@ class CreateNewStickerSet(TelegramMethod[bool]): """Sticker set title, 1-64 characters""" stickers: list[InputSticker] """A JSON-serialized list of 1-50 initial stickers to be added to the sticker set""" - sticker_type: Optional[str] = None + sticker_type: str | None = None """Type of stickers in the set, pass 'regular', 'mask', or 'custom_emoji'. By default, a regular sticker set is created.""" - needs_repainting: Optional[bool] = None + needs_repainting: bool | None = None """Pass :code:`True` if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only""" - sticker_format: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + sticker_format: str | None = Field(None, json_schema_extra={"deprecated": True}) """Format of stickers in the set, must be one of 'static', 'animated', 'video' .. deprecated:: API:7.2 @@ -47,9 +47,9 @@ class CreateNewStickerSet(TelegramMethod[bool]): name: str, title: str, stickers: list[InputSticker], - sticker_type: Optional[str] = None, - needs_repainting: Optional[bool] = None, - sticker_format: Optional[str] = None, + sticker_type: str | None = None, + needs_repainting: bool | None = None, + sticker_format: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/decline_suggested_post.py b/aiogram/methods/decline_suggested_post.py index 56f2fb99..70331257 100644 --- a/aiogram/methods/decline_suggested_post.py +++ b/aiogram/methods/decline_suggested_post.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -19,7 +19,7 @@ class DeclineSuggestedPost(TelegramMethod[bool]): """Unique identifier for the target direct messages chat""" message_id: int """Identifier of a suggested post message to decline""" - comment: Optional[str] = None + comment: str | None = None """Comment for the creator of the suggested post; 0-128 characters""" if TYPE_CHECKING: @@ -31,7 +31,7 @@ class DeclineSuggestedPost(TelegramMethod[bool]): *, chat_id: int, message_id: int, - comment: Optional[str] = None, + comment: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/delete_my_commands.py b/aiogram/methods/delete_my_commands.py index 0d32d753..067cca85 100644 --- a/aiogram/methods/delete_my_commands.py +++ b/aiogram/methods/delete_my_commands.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import BotCommandScopeUnion from .base import TelegramMethod @@ -16,9 +16,9 @@ class DeleteMyCommands(TelegramMethod[bool]): __returning__ = bool __api_method__ = "deleteMyCommands" - scope: Optional[BotCommandScopeUnion] = None + scope: BotCommandScopeUnion | None = 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 + language_code: str | None = 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""" if TYPE_CHECKING: @@ -28,8 +28,8 @@ class DeleteMyCommands(TelegramMethod[bool]): def __init__( __pydantic__self__, *, - scope: Optional[BotCommandScopeUnion] = None, - language_code: Optional[str] = None, + scope: BotCommandScopeUnion | None = None, + language_code: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/delete_webhook.py b/aiogram/methods/delete_webhook.py index 05c39f4e..a42100f1 100644 --- a/aiogram/methods/delete_webhook.py +++ b/aiogram/methods/delete_webhook.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -15,7 +15,7 @@ class DeleteWebhook(TelegramMethod[bool]): __returning__ = bool __api_method__ = "deleteWebhook" - drop_pending_updates: Optional[bool] = None + drop_pending_updates: bool | None = None """Pass :code:`True` to drop all pending updates""" if TYPE_CHECKING: @@ -25,7 +25,7 @@ class DeleteWebhook(TelegramMethod[bool]): def __init__( __pydantic__self__, *, - drop_pending_updates: Optional[bool] = None, + drop_pending_updates: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_chat_invite_link.py b/aiogram/methods/edit_chat_invite_link.py index 5a1ec211..cc71252f 100644 --- a/aiogram/methods/edit_chat_invite_link.py +++ b/aiogram/methods/edit_chat_invite_link.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion from .base import TelegramMethod @@ -20,13 +20,13 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" invite_link: str """The invite link to edit""" - name: Optional[str] = None + name: str | None = None """Invite link name; 0-32 characters""" - expire_date: Optional[DateTimeUnion] = None + expire_date: DateTimeUnion | None = None """Point in time (Unix timestamp) when the link will expire""" - member_limit: Optional[int] = None + member_limit: int | None = None """The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999""" - creates_join_request: Optional[bool] = None + creates_join_request: bool | None = None """:code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified""" if TYPE_CHECKING: @@ -38,10 +38,10 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]): *, chat_id: ChatIdUnion, invite_link: str, - name: Optional[str] = None, - expire_date: Optional[DateTimeUnion] = None, - member_limit: Optional[int] = None, - creates_join_request: Optional[bool] = None, + name: str | None = None, + expire_date: DateTimeUnion | None = None, + member_limit: int | None = None, + creates_join_request: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_chat_subscription_invite_link.py b/aiogram/methods/edit_chat_subscription_invite_link.py index f83882c3..8b8a7d36 100644 --- a/aiogram/methods/edit_chat_subscription_invite_link.py +++ b/aiogram/methods/edit_chat_subscription_invite_link.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ChatInviteLink from .base import TelegramMethod @@ -20,7 +20,7 @@ class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" invite_link: str """The invite link to edit""" - name: Optional[str] = None + name: str | None = None """Invite link name; 0-32 characters""" if TYPE_CHECKING: @@ -32,7 +32,7 @@ class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]): *, chat_id: ChatIdUnion, invite_link: str, - name: Optional[str] = None, + name: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_forum_topic.py b/aiogram/methods/edit_forum_topic.py index 10200382..169e9829 100644 --- a/aiogram/methods/edit_forum_topic.py +++ b/aiogram/methods/edit_forum_topic.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -20,9 +20,9 @@ class EditForumTopic(TelegramMethod[bool]): """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)""" message_thread_id: int """Unique identifier for the target message thread of the forum topic""" - name: Optional[str] = None + name: str | None = None """New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept""" - icon_custom_emoji_id: Optional[str] = None + icon_custom_emoji_id: str | None = None """New unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class EditForumTopic(TelegramMethod[bool]): *, chat_id: ChatIdUnion, message_thread_id: int, - name: Optional[str] = None, - icon_custom_emoji_id: Optional[str] = None, + name: str | None = None, + icon_custom_emoji_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_message_caption.py b/aiogram/methods/edit_message_caption.py index f045f7b4..f790f9e2 100644 --- a/aiogram/methods/edit_message_caption.py +++ b/aiogram/methods/edit_message_caption.py @@ -1,39 +1,39 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..client.default import Default from ..types import ChatIdUnion, InlineKeyboardMarkup, Message, MessageEntity from .base import TelegramMethod -class EditMessageCaption(TelegramMethod[Union[Message, bool]]): +class EditMessageCaption(TelegramMethod[Message | bool]): """ Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Source: https://core.telegram.org/bots/api#editmessagecaption """ - __returning__ = Union[Message, bool] + __returning__ = Message | bool __api_method__ = "editMessageCaption" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message to be edited was sent""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = 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`)""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" - caption: Optional[str] = None + caption: str | None = None """New caption of the message, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the message caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """Pass :code:`True`, if the caption must be shown above the message media. Supported only for animation, photo and video messages.""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for an `inline keyboard `_.""" if TYPE_CHECKING: @@ -43,17 +43,15 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]): def __init__( __pydantic__self__, *, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_message_checklist.py b/aiogram/methods/edit_message_checklist.py index f1895eef..6f7bbf7d 100644 --- a/aiogram/methods/edit_message_checklist.py +++ b/aiogram/methods/edit_message_checklist.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InlineKeyboardMarkup, InputChecklist, Message from .base import TelegramMethod @@ -24,7 +24,7 @@ class EditMessageChecklist(TelegramMethod[Message]): """Unique identifier for the target message""" checklist: InputChecklist """A JSON-serialized object for the new checklist""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for the new inline keyboard for the message""" if TYPE_CHECKING: @@ -38,7 +38,7 @@ class EditMessageChecklist(TelegramMethod[Message]): chat_id: int, message_id: int, checklist: InputChecklist, - reply_markup: Optional[InlineKeyboardMarkup] = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_message_live_location.py b/aiogram/methods/edit_message_live_location.py index d68bd837..82471ad3 100644 --- a/aiogram/methods/edit_message_live_location.py +++ b/aiogram/methods/edit_message_live_location.py @@ -1,42 +1,42 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, InlineKeyboardMarkup, Message from .base import TelegramMethod -class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): +class EditMessageLiveLocation(TelegramMethod[Message | bool]): """ Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Source: https://core.telegram.org/bots/api#editmessagelivelocation """ - __returning__ = Union[Message, bool] + __returning__ = Message | bool __api_method__ = "editMessageLiveLocation" latitude: float """Latitude of new location""" longitude: float """Longitude of new location""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message to be edited was sent""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = 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`)""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" - live_period: Optional[int] = None + live_period: int | None = None """New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current *live_period* by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then *live_period* remains unchanged""" - horizontal_accuracy: Optional[float] = None + horizontal_accuracy: float | None = None """The radius of uncertainty for the location, measured in meters; 0-1500""" - heading: Optional[int] = None + heading: int | None = None """Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.""" - proximity_alert_radius: Optional[int] = None + proximity_alert_radius: int | None = None """The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for a new `inline keyboard `_.""" if TYPE_CHECKING: @@ -48,15 +48,15 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): *, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - live_period: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + live_period: int | None = None, + horizontal_accuracy: float | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_message_media.py b/aiogram/methods/edit_message_media.py index 71189536..d0bdb776 100644 --- a/aiogram/methods/edit_message_media.py +++ b/aiogram/methods/edit_message_media.py @@ -1,32 +1,32 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, InlineKeyboardMarkup, InputMediaUnion, Message from .base import TelegramMethod -class EditMessageMedia(TelegramMethod[Union[Message, bool]]): +class EditMessageMedia(TelegramMethod[Message | bool]): """ Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Source: https://core.telegram.org/bots/api#editmessagemedia """ - __returning__ = Union[Message, bool] + __returning__ = Message | bool __api_method__ = "editMessageMedia" media: InputMediaUnion """A JSON-serialized object for a new media content of the message""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message to be edited was sent""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = 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`)""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for a new `inline keyboard `_.""" if TYPE_CHECKING: @@ -37,11 +37,11 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]): __pydantic__self__, *, media: InputMediaUnion, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_message_reply_markup.py b/aiogram/methods/edit_message_reply_markup.py index a8379a0a..e5bd47b6 100644 --- a/aiogram/methods/edit_message_reply_markup.py +++ b/aiogram/methods/edit_message_reply_markup.py @@ -1,30 +1,30 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, InlineKeyboardMarkup, Message from .base import TelegramMethod -class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): +class EditMessageReplyMarkup(TelegramMethod[Message | bool]): """ Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Source: https://core.telegram.org/bots/api#editmessagereplymarkup """ - __returning__ = Union[Message, bool] + __returning__ = Message | bool __api_method__ = "editMessageReplyMarkup" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message to be edited was sent""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = 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`)""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for an `inline keyboard `_.""" if TYPE_CHECKING: @@ -34,11 +34,11 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): def __init__( __pydantic__self__, *, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_message_text.py b/aiogram/methods/edit_message_text.py index 5e5cbb65..3622d293 100644 --- a/aiogram/methods/edit_message_text.py +++ b/aiogram/methods/edit_message_text.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -15,35 +15,35 @@ from ..types import ( from .base import TelegramMethod -class EditMessageText(TelegramMethod[Union[Message, bool]]): +class EditMessageText(TelegramMethod[Message | bool]): """ Use this method to edit text and `game `_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Source: https://core.telegram.org/bots/api#editmessagetext """ - __returning__ = Union[Message, bool] + __returning__ = Message | bool __api_method__ = "editMessageText" text: str """New text of the message, 1-4096 characters after entities parsing""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message to be edited was sent""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = 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`)""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the message to edit""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the message text. See `formatting options `_ for more details.""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*""" - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default("link_preview") + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview") """Link preview generation options for the message""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for an `inline keyboard `_.""" - disable_web_page_preview: Optional[Union[bool, Default]] = Field( + disable_web_page_preview: bool | Default | None = Field( Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True} ) """Disables link previews for links in this message @@ -59,19 +59,15 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]): __pydantic__self__, *, text: str, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + reply_markup: InlineKeyboardMarkup | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/edit_story.py b/aiogram/methods/edit_story.py index d425e4d5..888707ec 100644 --- a/aiogram/methods/edit_story.py +++ b/aiogram/methods/edit_story.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea from .base import TelegramMethod @@ -22,13 +22,13 @@ class EditStory(TelegramMethod[Story]): """Unique identifier of the story to edit""" content: InputStoryContentUnion """Content of the story""" - caption: Optional[str] = None + caption: str | None = None """Caption of the story, 0-2048 characters after entities parsing""" - parse_mode: Optional[str] = None + parse_mode: str | None = None """Mode for parsing entities in the story caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - areas: Optional[list[StoryArea]] = None + areas: list[StoryArea] | None = None """A JSON-serialized list of clickable areas to be shown on the story""" if TYPE_CHECKING: @@ -41,10 +41,10 @@ class EditStory(TelegramMethod[Story]): business_connection_id: str, story_id: int, content: InputStoryContentUnion, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - areas: Optional[list[StoryArea]] = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + areas: list[StoryArea] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/forward_message.py b/aiogram/methods/forward_message.py index f1b3a054..c52d4de0 100644 --- a/aiogram/methods/forward_message.py +++ b/aiogram/methods/forward_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..client.default import Default from ..types import ChatIdUnion, DateTimeUnion, Message, SuggestedPostParameters @@ -23,19 +23,19 @@ class ForwardMessage(TelegramMethod[Message]): """Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)""" message_id: int """Message identifier in the chat specified in *from_chat_id*""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat""" - video_start_timestamp: Optional[DateTimeUnion] = None + video_start_timestamp: DateTimeUnion | None = None """New start timestamp for the forwarded video in the message""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the forwarded message from forwarding and saving""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; only available when forwarding to private chats""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only""" if TYPE_CHECKING: @@ -48,13 +48,13 @@ class ForwardMessage(TelegramMethod[Message]): chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_id: int, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - video_start_timestamp: Optional[DateTimeUnion] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + video_start_timestamp: DateTimeUnion | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/forward_messages.py b/aiogram/methods/forward_messages.py index 362e5dbb..0a70b3c9 100644 --- a/aiogram/methods/forward_messages.py +++ b/aiogram/methods/forward_messages.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, MessageId from .base import TelegramMethod @@ -20,13 +20,13 @@ class ForwardMessages(TelegramMethod[list[MessageId]]): """Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)""" message_ids: list[int] """A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order.""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the messages `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[bool] = None + protect_content: bool | None = None """Protects the contents of the forwarded messages from forwarding and saving""" if TYPE_CHECKING: @@ -39,10 +39,10 @@ class ForwardMessages(TelegramMethod[list[MessageId]]): chat_id: ChatIdUnion, from_chat_id: ChatIdUnion, message_ids: list[int], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_business_account_gifts.py b/aiogram/methods/get_business_account_gifts.py index cc6c2cf9..27fcaa7d 100644 --- a/aiogram/methods/get_business_account_gifts.py +++ b/aiogram/methods/get_business_account_gifts.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -20,27 +20,27 @@ class GetBusinessAccountGifts(TelegramMethod[OwnedGifts]): business_connection_id: str """Unique identifier of the business connection""" - exclude_unsaved: Optional[bool] = None + exclude_unsaved: bool | None = None """Pass :code:`True` to exclude gifts that aren't saved to the account's profile page""" - exclude_saved: Optional[bool] = None + exclude_saved: bool | None = None """Pass :code:`True` to exclude gifts that are saved to the account's profile page""" - exclude_unlimited: Optional[bool] = None + exclude_unlimited: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times""" - exclude_limited_upgradable: Optional[bool] = None + exclude_limited_upgradable: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique""" - exclude_limited_non_upgradable: Optional[bool] = None + exclude_limited_non_upgradable: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique""" - exclude_unique: Optional[bool] = None + exclude_unique: bool | None = None """Pass :code:`True` to exclude unique gifts""" - exclude_from_blockchain: Optional[bool] = None + exclude_from_blockchain: bool | None = None """Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram""" - sort_by_price: Optional[bool] = None + sort_by_price: bool | None = None """Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination.""" - offset: Optional[str] = None + offset: str | None = None """Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results""" - limit: Optional[int] = None + limit: int | None = None """The maximum number of gifts to be returned; 1-100. Defaults to 100""" - exclude_limited: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + exclude_limited: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` to exclude gifts that can be purchased a limited number of times .. deprecated:: API:9.3 @@ -54,17 +54,17 @@ class GetBusinessAccountGifts(TelegramMethod[OwnedGifts]): __pydantic__self__, *, business_connection_id: str, - exclude_unsaved: Optional[bool] = None, - exclude_saved: Optional[bool] = None, - exclude_unlimited: Optional[bool] = None, - exclude_limited_upgradable: Optional[bool] = None, - exclude_limited_non_upgradable: Optional[bool] = None, - exclude_unique: Optional[bool] = None, - exclude_from_blockchain: Optional[bool] = None, - sort_by_price: Optional[bool] = None, - offset: Optional[str] = None, - limit: Optional[int] = None, - exclude_limited: Optional[bool] = None, + exclude_unsaved: bool | None = None, + exclude_saved: bool | None = None, + exclude_unlimited: bool | None = None, + exclude_limited_upgradable: bool | None = None, + exclude_limited_non_upgradable: bool | None = None, + exclude_unique: bool | None = None, + exclude_from_blockchain: bool | None = None, + sort_by_price: bool | None = None, + offset: str | None = None, + limit: int | None = None, + exclude_limited: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_chat_gifts.py b/aiogram/methods/get_chat_gifts.py index cb2f5f6c..4b7d3c7c 100644 --- a/aiogram/methods/get_chat_gifts.py +++ b/aiogram/methods/get_chat_gifts.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, OwnedGifts from .base import TelegramMethod @@ -18,25 +18,25 @@ class GetChatGifts(TelegramMethod[OwnedGifts]): chat_id: ChatIdUnion """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" - exclude_unsaved: Optional[bool] = None + exclude_unsaved: bool | None = None """Pass :code:`True` to exclude gifts that aren't saved to the chat's profile page. Always :code:`True`, unless the bot has the *can_post_messages* administrator right in the channel.""" - exclude_saved: Optional[bool] = None + exclude_saved: bool | None = None """Pass :code:`True` to exclude gifts that are saved to the chat's profile page. Always :code:`False`, unless the bot has the *can_post_messages* administrator right in the channel.""" - exclude_unlimited: Optional[bool] = None + exclude_unlimited: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times""" - exclude_limited_upgradable: Optional[bool] = None + exclude_limited_upgradable: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique""" - exclude_limited_non_upgradable: Optional[bool] = None + exclude_limited_non_upgradable: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique""" - exclude_from_blockchain: Optional[bool] = None + exclude_from_blockchain: bool | None = None """Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram""" - exclude_unique: Optional[bool] = None + exclude_unique: bool | None = None """Pass :code:`True` to exclude unique gifts""" - sort_by_price: Optional[bool] = None + sort_by_price: bool | None = None """Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination.""" - offset: Optional[str] = None + offset: str | None = None """Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results""" - limit: Optional[int] = None + limit: int | None = None """The maximum number of gifts to be returned; 1-100. Defaults to 100""" if TYPE_CHECKING: @@ -47,16 +47,16 @@ class GetChatGifts(TelegramMethod[OwnedGifts]): __pydantic__self__, *, chat_id: ChatIdUnion, - exclude_unsaved: Optional[bool] = None, - exclude_saved: Optional[bool] = None, - exclude_unlimited: Optional[bool] = None, - exclude_limited_upgradable: Optional[bool] = None, - exclude_limited_non_upgradable: Optional[bool] = None, - exclude_from_blockchain: Optional[bool] = None, - exclude_unique: Optional[bool] = None, - sort_by_price: Optional[bool] = None, - offset: Optional[str] = None, - limit: Optional[int] = None, + exclude_unsaved: bool | None = None, + exclude_saved: bool | None = None, + exclude_unlimited: bool | None = None, + exclude_limited_upgradable: bool | None = None, + exclude_limited_non_upgradable: bool | None = None, + exclude_from_blockchain: bool | None = None, + exclude_unique: bool | None = None, + sort_by_price: bool | None = None, + offset: str | None = None, + limit: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_chat_menu_button.py b/aiogram/methods/get_chat_menu_button.py index 5c7e06c8..dbb84124 100644 --- a/aiogram/methods/get_chat_menu_button.py +++ b/aiogram/methods/get_chat_menu_button.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ResultMenuButtonUnion from .base import TelegramMethod @@ -16,7 +16,7 @@ class GetChatMenuButton(TelegramMethod[ResultMenuButtonUnion]): __returning__ = ResultMenuButtonUnion __api_method__ = "getChatMenuButton" - chat_id: Optional[int] = None + chat_id: int | None = None """Unique identifier for the target private chat. If not specified, default bot's menu button will be returned""" if TYPE_CHECKING: @@ -24,7 +24,7 @@ class GetChatMenuButton(TelegramMethod[ResultMenuButtonUnion]): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, *, chat_id: Optional[int] = None, **__pydantic_kwargs: Any + __pydantic__self__, *, chat_id: int | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/methods/get_game_high_scores.py b/aiogram/methods/get_game_high_scores.py index fc0d443a..de2a26e9 100644 --- a/aiogram/methods/get_game_high_scores.py +++ b/aiogram/methods/get_game_high_scores.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import GameHighScore from .base import TelegramMethod @@ -20,11 +20,11 @@ class GetGameHighScores(TelegramMethod[list[GameHighScore]]): user_id: int """Target user id""" - chat_id: Optional[int] = None + chat_id: int | None = None """Required if *inline_message_id* is not specified. Unique identifier for the target chat""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the sent message""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" if TYPE_CHECKING: @@ -35,9 +35,9 @@ class GetGameHighScores(TelegramMethod[list[GameHighScore]]): __pydantic__self__, *, user_id: int, - chat_id: Optional[int] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, + chat_id: int | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_my_commands.py b/aiogram/methods/get_my_commands.py index c155f18f..dc519186 100644 --- a/aiogram/methods/get_my_commands.py +++ b/aiogram/methods/get_my_commands.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import BotCommand, BotCommandScopeUnion from .base import TelegramMethod @@ -16,9 +16,9 @@ class GetMyCommands(TelegramMethod[list[BotCommand]]): __returning__ = list[BotCommand] __api_method__ = "getMyCommands" - scope: Optional[BotCommandScopeUnion] = None + scope: BotCommandScopeUnion | None = None """A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`.""" - language_code: Optional[str] = None + language_code: str | None = None """A two-letter ISO 639-1 language code or an empty string""" if TYPE_CHECKING: @@ -28,8 +28,8 @@ class GetMyCommands(TelegramMethod[list[BotCommand]]): def __init__( __pydantic__self__, *, - scope: Optional[BotCommandScopeUnion] = None, - language_code: Optional[str] = None, + scope: BotCommandScopeUnion | None = None, + language_code: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_my_default_administrator_rights.py b/aiogram/methods/get_my_default_administrator_rights.py index 4f9ad9a6..c439f0ca 100644 --- a/aiogram/methods/get_my_default_administrator_rights.py +++ b/aiogram/methods/get_my_default_administrator_rights.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatAdministratorRights from .base import TelegramMethod @@ -16,7 +16,7 @@ class GetMyDefaultAdministratorRights(TelegramMethod[ChatAdministratorRights]): __returning__ = ChatAdministratorRights __api_method__ = "getMyDefaultAdministratorRights" - for_channels: Optional[bool] = None + for_channels: bool | None = None """Pass :code:`True` to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.""" if TYPE_CHECKING: @@ -24,7 +24,7 @@ class GetMyDefaultAdministratorRights(TelegramMethod[ChatAdministratorRights]): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, *, for_channels: Optional[bool] = None, **__pydantic_kwargs: Any + __pydantic__self__, *, for_channels: bool | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/methods/get_my_description.py b/aiogram/methods/get_my_description.py index f967faf6..773241e2 100644 --- a/aiogram/methods/get_my_description.py +++ b/aiogram/methods/get_my_description.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import BotDescription from .base import TelegramMethod @@ -16,7 +16,7 @@ class GetMyDescription(TelegramMethod[BotDescription]): __returning__ = BotDescription __api_method__ = "getMyDescription" - language_code: Optional[str] = None + language_code: str | None = None """A two-letter ISO 639-1 language code or an empty string""" if TYPE_CHECKING: @@ -24,7 +24,7 @@ class GetMyDescription(TelegramMethod[BotDescription]): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, *, language_code: Optional[str] = None, **__pydantic_kwargs: Any + __pydantic__self__, *, language_code: str | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/methods/get_my_name.py b/aiogram/methods/get_my_name.py index 909ac3f6..68f0d8e8 100644 --- a/aiogram/methods/get_my_name.py +++ b/aiogram/methods/get_my_name.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import BotName from .base import TelegramMethod @@ -14,7 +14,7 @@ class GetMyName(TelegramMethod[BotName]): __returning__ = BotName __api_method__ = "getMyName" - language_code: Optional[str] = None + language_code: str | None = None """A two-letter ISO 639-1 language code or an empty string""" if TYPE_CHECKING: @@ -22,7 +22,7 @@ class GetMyName(TelegramMethod[BotName]): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, *, language_code: Optional[str] = None, **__pydantic_kwargs: Any + __pydantic__self__, *, language_code: str | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/methods/get_my_short_description.py b/aiogram/methods/get_my_short_description.py index a9a56669..f94c2bb7 100644 --- a/aiogram/methods/get_my_short_description.py +++ b/aiogram/methods/get_my_short_description.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import BotShortDescription from .base import TelegramMethod @@ -16,7 +16,7 @@ class GetMyShortDescription(TelegramMethod[BotShortDescription]): __returning__ = BotShortDescription __api_method__ = "getMyShortDescription" - language_code: Optional[str] = None + language_code: str | None = None """A two-letter ISO 639-1 language code or an empty string""" if TYPE_CHECKING: @@ -24,7 +24,7 @@ class GetMyShortDescription(TelegramMethod[BotShortDescription]): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, *, language_code: Optional[str] = None, **__pydantic_kwargs: Any + __pydantic__self__, *, language_code: str | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/methods/get_star_transactions.py b/aiogram/methods/get_star_transactions.py index ee0ea2e1..ac8dfdeb 100644 --- a/aiogram/methods/get_star_transactions.py +++ b/aiogram/methods/get_star_transactions.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import StarTransactions from .base import TelegramMethod @@ -16,9 +16,9 @@ class GetStarTransactions(TelegramMethod[StarTransactions]): __returning__ = StarTransactions __api_method__ = "getStarTransactions" - offset: Optional[int] = None + offset: int | None = None """Number of transactions to skip in the response""" - limit: Optional[int] = None + limit: int | None = None """The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" if TYPE_CHECKING: @@ -28,8 +28,8 @@ class GetStarTransactions(TelegramMethod[StarTransactions]): def __init__( __pydantic__self__, *, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: int | None = None, + limit: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_updates.py b/aiogram/methods/get_updates.py index 5a3fc054..30cab2af 100644 --- a/aiogram/methods/get_updates.py +++ b/aiogram/methods/get_updates.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import Update from .base import TelegramMethod @@ -22,13 +22,13 @@ class GetUpdates(TelegramMethod[list[Update]]): __returning__ = list[Update] __api_method__ = "getUpdates" - offset: Optional[int] = None + offset: int | None = None """Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as :class:`aiogram.methods.get_updates.GetUpdates` is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will be forgotten.""" - limit: Optional[int] = None + limit: int | None = None """Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" - timeout: Optional[int] = None + timeout: int | None = None """Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.""" - allowed_updates: Optional[list[str]] = None + allowed_updates: list[str] | None = None """A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`["message", "edited_channel_post", "callback_query"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.""" if TYPE_CHECKING: @@ -38,10 +38,10 @@ class GetUpdates(TelegramMethod[list[Update]]): def __init__( __pydantic__self__, *, - offset: Optional[int] = None, - limit: Optional[int] = None, - timeout: Optional[int] = None, - allowed_updates: Optional[list[str]] = None, + offset: int | None = None, + limit: int | None = None, + timeout: int | None = None, + allowed_updates: list[str] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_user_gifts.py b/aiogram/methods/get_user_gifts.py index 64882792..69982166 100644 --- a/aiogram/methods/get_user_gifts.py +++ b/aiogram/methods/get_user_gifts.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import OwnedGifts from .base import TelegramMethod @@ -18,21 +18,21 @@ class GetUserGifts(TelegramMethod[OwnedGifts]): user_id: int """Unique identifier of the user""" - exclude_unlimited: Optional[bool] = None + exclude_unlimited: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times""" - exclude_limited_upgradable: Optional[bool] = None + exclude_limited_upgradable: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique""" - exclude_limited_non_upgradable: Optional[bool] = None + exclude_limited_non_upgradable: bool | None = None """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique""" - exclude_from_blockchain: Optional[bool] = None + exclude_from_blockchain: bool | None = None """Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram""" - exclude_unique: Optional[bool] = None + exclude_unique: bool | None = None """Pass :code:`True` to exclude unique gifts""" - sort_by_price: Optional[bool] = None + sort_by_price: bool | None = None """Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination.""" - offset: Optional[str] = None + offset: str | None = None """Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results""" - limit: Optional[int] = None + limit: int | None = None """The maximum number of gifts to be returned; 1-100. Defaults to 100""" if TYPE_CHECKING: @@ -43,14 +43,14 @@ class GetUserGifts(TelegramMethod[OwnedGifts]): __pydantic__self__, *, user_id: int, - exclude_unlimited: Optional[bool] = None, - exclude_limited_upgradable: Optional[bool] = None, - exclude_limited_non_upgradable: Optional[bool] = None, - exclude_from_blockchain: Optional[bool] = None, - exclude_unique: Optional[bool] = None, - sort_by_price: Optional[bool] = None, - offset: Optional[str] = None, - limit: Optional[int] = None, + exclude_unlimited: bool | None = None, + exclude_limited_upgradable: bool | None = None, + exclude_limited_non_upgradable: bool | None = None, + exclude_from_blockchain: bool | None = None, + exclude_unique: bool | None = None, + sort_by_price: bool | None = None, + offset: str | None = None, + limit: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/get_user_profile_photos.py b/aiogram/methods/get_user_profile_photos.py index 488885e1..0b314366 100644 --- a/aiogram/methods/get_user_profile_photos.py +++ b/aiogram/methods/get_user_profile_photos.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import UserProfilePhotos from .base import TelegramMethod @@ -18,9 +18,9 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]): user_id: int """Unique identifier of the target user""" - offset: Optional[int] = None + offset: int | None = None """Sequential number of the first photo to be returned. By default, all photos are returned.""" - limit: Optional[int] = None + limit: int | None = None """Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" if TYPE_CHECKING: @@ -31,8 +31,8 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]): __pydantic__self__, *, user_id: int, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: int | None = None, + limit: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/gift_premium_subscription.py b/aiogram/methods/gift_premium_subscription.py index 54316db9..2feaa5f5 100644 --- a/aiogram/methods/gift_premium_subscription.py +++ b/aiogram/methods/gift_premium_subscription.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import MessageEntity from .base import TelegramMethod @@ -22,11 +22,11 @@ class GiftPremiumSubscription(TelegramMethod[bool]): """Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12""" star_count: int """Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months""" - text: Optional[str] = None + text: str | None = None """Text that will be shown along with the service message about the subscription; 0-128 characters""" - text_parse_mode: Optional[str] = None + text_parse_mode: str | None = None """Mode for parsing entities in the text. See `formatting options `_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" - text_entities: Optional[list[MessageEntity]] = None + text_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" if TYPE_CHECKING: @@ -39,9 +39,9 @@ class GiftPremiumSubscription(TelegramMethod[bool]): user_id: int, month_count: int, star_count: int, - text: Optional[str] = None, - text_parse_mode: Optional[str] = None, - text_entities: Optional[list[MessageEntity]] = None, + text: str | None = None, + text_parse_mode: str | None = None, + text_entities: list[MessageEntity] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/pin_chat_message.py b/aiogram/methods/pin_chat_message.py index cc68ebc9..ad113322 100644 --- a/aiogram/methods/pin_chat_message.py +++ b/aiogram/methods/pin_chat_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -20,9 +20,9 @@ class PinChatMessage(TelegramMethod[bool]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" message_id: int """Identifier of a message to pin""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be pinned""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Pass :code:`True` if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class PinChatMessage(TelegramMethod[bool]): *, chat_id: ChatIdUnion, message_id: int, - business_connection_id: Optional[str] = None, - disable_notification: Optional[bool] = None, + business_connection_id: str | None = None, + disable_notification: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/post_story.py b/aiogram/methods/post_story.py index 60402225..b768eacc 100644 --- a/aiogram/methods/post_story.py +++ b/aiogram/methods/post_story.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea from .base import TelegramMethod @@ -22,17 +22,17 @@ class PostStory(TelegramMethod[Story]): """Content of the story""" active_period: int """Period after which the story is moved to the archive, in seconds; must be one of :code:`6 * 3600`, :code:`12 * 3600`, :code:`86400`, or :code:`2 * 86400`""" - caption: Optional[str] = None + caption: str | None = None """Caption of the story, 0-2048 characters after entities parsing""" - parse_mode: Optional[str] = None + parse_mode: str | None = None """Mode for parsing entities in the story caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - areas: Optional[list[StoryArea]] = None + areas: list[StoryArea] | None = None """A JSON-serialized list of clickable areas to be shown on the story""" - post_to_chat_page: Optional[bool] = None + post_to_chat_page: bool | None = None """Pass :code:`True` to keep the story accessible after it expires""" - protect_content: Optional[bool] = None + protect_content: bool | None = None """Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting""" if TYPE_CHECKING: @@ -45,12 +45,12 @@ class PostStory(TelegramMethod[Story]): business_connection_id: str, content: InputStoryContentUnion, active_period: int, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - areas: Optional[list[StoryArea]] = None, - post_to_chat_page: Optional[bool] = None, - protect_content: Optional[bool] = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + areas: list[StoryArea] | None = None, + post_to_chat_page: bool | None = None, + protect_content: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/promote_chat_member.py b/aiogram/methods/promote_chat_member.py index a3c517a7..e26f821e 100644 --- a/aiogram/methods/promote_chat_member.py +++ b/aiogram/methods/promote_chat_member.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -20,37 +20,37 @@ class PromoteChatMember(TelegramMethod[bool]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" user_id: int """Unique identifier of the target user""" - is_anonymous: Optional[bool] = None + is_anonymous: bool | None = None """Pass :code:`True` if the administrator's presence in the chat is hidden""" - can_manage_chat: Optional[bool] = None + can_manage_chat: bool | None = None """Pass :code:`True` if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.""" - can_delete_messages: Optional[bool] = None + can_delete_messages: bool | None = None """Pass :code:`True` if the administrator can delete messages of other users""" - can_manage_video_chats: Optional[bool] = None + can_manage_video_chats: bool | None = None """Pass :code:`True` if the administrator can manage video chats""" - can_restrict_members: Optional[bool] = None + can_restrict_members: bool | None = None """Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to :code:`True` for promotions of channel administrators""" - can_promote_members: Optional[bool] = None + can_promote_members: bool | None = None """Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)""" - can_change_info: Optional[bool] = None + can_change_info: bool | None = None """Pass :code:`True` if the administrator can change chat title, photo and other settings""" - can_invite_users: Optional[bool] = None + can_invite_users: bool | None = None """Pass :code:`True` if the administrator can invite new users to the chat""" - can_post_stories: Optional[bool] = None + can_post_stories: bool | None = None """Pass :code:`True` if the administrator can post stories to the chat""" - can_edit_stories: Optional[bool] = None + can_edit_stories: bool | None = None """Pass :code:`True` if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive""" - can_delete_stories: Optional[bool] = None + can_delete_stories: bool | None = None """Pass :code:`True` if the administrator can delete stories posted by other users""" - can_post_messages: Optional[bool] = None + can_post_messages: bool | None = None """Pass :code:`True` if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only""" - can_edit_messages: Optional[bool] = None + can_edit_messages: bool | None = None """Pass :code:`True` if the administrator can edit messages of other users and can pin messages; for channels only""" - can_pin_messages: Optional[bool] = None + can_pin_messages: bool | None = None """Pass :code:`True` if the administrator can pin messages; for supergroups only""" - can_manage_topics: Optional[bool] = None + can_manage_topics: bool | None = None """Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only""" - can_manage_direct_messages: Optional[bool] = None + can_manage_direct_messages: bool | None = None """Pass :code:`True` if the administrator can manage direct messages within the channel and decline suggested posts; for channels only""" if TYPE_CHECKING: @@ -62,22 +62,22 @@ class PromoteChatMember(TelegramMethod[bool]): *, chat_id: ChatIdUnion, user_id: int, - is_anonymous: Optional[bool] = None, - can_manage_chat: Optional[bool] = None, - can_delete_messages: Optional[bool] = None, - can_manage_video_chats: Optional[bool] = None, - can_restrict_members: Optional[bool] = None, - can_promote_members: Optional[bool] = None, - can_change_info: Optional[bool] = None, - can_invite_users: Optional[bool] = None, - can_post_stories: Optional[bool] = None, - can_edit_stories: Optional[bool] = None, - can_delete_stories: Optional[bool] = None, - can_post_messages: Optional[bool] = None, - can_edit_messages: Optional[bool] = None, - can_pin_messages: Optional[bool] = None, - can_manage_topics: Optional[bool] = None, - can_manage_direct_messages: Optional[bool] = None, + is_anonymous: bool | None = None, + can_manage_chat: bool | None = None, + can_delete_messages: bool | None = None, + can_manage_video_chats: bool | None = None, + can_restrict_members: bool | None = None, + can_promote_members: bool | None = None, + can_change_info: bool | None = None, + can_invite_users: bool | None = None, + can_post_stories: bool | None = None, + can_edit_stories: bool | None = None, + can_delete_stories: bool | None = None, + can_post_messages: bool | None = None, + can_edit_messages: bool | None = None, + can_pin_messages: bool | None = None, + can_manage_topics: bool | None = None, + can_manage_direct_messages: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/remove_business_account_profile_photo.py b/aiogram/methods/remove_business_account_profile_photo.py index 47af0f24..e0648c2a 100644 --- a/aiogram/methods/remove_business_account_profile_photo.py +++ b/aiogram/methods/remove_business_account_profile_photo.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -17,7 +17,7 @@ class RemoveBusinessAccountProfilePhoto(TelegramMethod[bool]): business_connection_id: str """Unique identifier of the business connection""" - is_public: Optional[bool] = None + is_public: bool | None = None """Pass :code:`True` to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class RemoveBusinessAccountProfilePhoto(TelegramMethod[bool]): __pydantic__self__, *, business_connection_id: str, - is_public: Optional[bool] = None, + is_public: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/repost_story.py b/aiogram/methods/repost_story.py index 23009ba3..4aef335b 100644 --- a/aiogram/methods/repost_story.py +++ b/aiogram/methods/repost_story.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import Story from .base import TelegramMethod @@ -24,9 +24,9 @@ class RepostStory(TelegramMethod[Story]): """Unique identifier of the story that should be reposted""" active_period: int """Period after which the story is moved to the archive, in seconds; must be one of :code:`6 * 3600`, :code:`12 * 3600`, :code:`86400`, or :code:`2 * 86400`""" - post_to_chat_page: Optional[bool] = None + post_to_chat_page: bool | None = None """Pass :code:`True` to keep the story accessible after it expires""" - protect_content: Optional[bool] = None + protect_content: bool | None = None """Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting""" if TYPE_CHECKING: @@ -40,8 +40,8 @@ class RepostStory(TelegramMethod[Story]): from_chat_id: int, from_story_id: int, active_period: int, - post_to_chat_page: Optional[bool] = None, - protect_content: Optional[bool] = None, + post_to_chat_page: bool | None = None, + protect_content: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/restrict_chat_member.py b/aiogram/methods/restrict_chat_member.py index 83e87364..88e9b957 100644 --- a/aiogram/methods/restrict_chat_member.py +++ b/aiogram/methods/restrict_chat_member.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ChatPermissions, DateTimeUnion from .base import TelegramMethod @@ -22,9 +22,9 @@ class RestrictChatMember(TelegramMethod[bool]): """Unique identifier of the target user""" permissions: ChatPermissions """A JSON-serialized object for new user permissions""" - use_independent_chat_permissions: Optional[bool] = None + use_independent_chat_permissions: bool | None = None """Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission.""" - until_date: Optional[DateTimeUnion] = None + until_date: DateTimeUnion | None = None """Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever""" if TYPE_CHECKING: @@ -37,8 +37,8 @@ class RestrictChatMember(TelegramMethod[bool]): chat_id: ChatIdUnion, user_id: int, permissions: ChatPermissions, - use_independent_chat_permissions: Optional[bool] = None, - until_date: Optional[DateTimeUnion] = None, + use_independent_chat_permissions: bool | None = None, + until_date: DateTimeUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/save_prepared_inline_message.py b/aiogram/methods/save_prepared_inline_message.py index aff799bc..30198249 100644 --- a/aiogram/methods/save_prepared_inline_message.py +++ b/aiogram/methods/save_prepared_inline_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InlineQueryResultUnion, PreparedInlineMessage from .base import TelegramMethod @@ -20,13 +20,13 @@ class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]): """Unique identifier of the target user that can use the prepared message""" result: InlineQueryResultUnion """A JSON-serialized object describing the message to be sent""" - allow_user_chats: Optional[bool] = None + allow_user_chats: bool | None = None """Pass :code:`True` if the message can be sent to private chats with users""" - allow_bot_chats: Optional[bool] = None + allow_bot_chats: bool | None = None """Pass :code:`True` if the message can be sent to private chats with bots""" - allow_group_chats: Optional[bool] = None + allow_group_chats: bool | None = None """Pass :code:`True` if the message can be sent to group and supergroup chats""" - allow_channel_chats: Optional[bool] = None + allow_channel_chats: bool | None = None """Pass :code:`True` if the message can be sent to channel chats""" if TYPE_CHECKING: @@ -38,10 +38,10 @@ class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]): *, user_id: int, result: InlineQueryResultUnion, - allow_user_chats: Optional[bool] = None, - allow_bot_chats: Optional[bool] = None, - allow_group_chats: Optional[bool] = None, - allow_channel_chats: Optional[bool] = None, + allow_user_chats: bool | None = None, + allow_bot_chats: bool | None = None, + allow_group_chats: bool | None = None, + allow_channel_chats: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_animation.py b/aiogram/methods/send_animation.py index 7699b2cc..931e88c7 100644 --- a/aiogram/methods/send_animation.py +++ b/aiogram/methods/send_animation.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -32,52 +32,50 @@ class SendAnimation(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" animation: InputFileUnion """Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » `""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - duration: Optional[int] = None + duration: int | None = None """Duration of sent animation in seconds""" - width: Optional[int] = None + width: int | None = None """Animation width""" - height: Optional[int] = None + height: int | None = None """Animation height""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = None """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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - caption: Optional[str] = None + caption: str | None = None """Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the animation caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """Pass :code:`True`, if the caption must be shown above the message media""" - has_spoiler: Optional[bool] = None + has_spoiler: bool | None = None """Pass :code:`True` if the animation needs to be covered with a spoiler animation""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -92,29 +90,27 @@ class SendAnimation(TelegramMethod[Message]): *, chat_id: ChatIdUnion, animation: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_audio.py b/aiogram/methods/send_audio.py index 7c384752..687d8389 100644 --- a/aiogram/methods/send_audio.py +++ b/aiogram/methods/send_audio.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -33,48 +33,46 @@ class SendAudio(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" audio: InputFileUnion """Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - caption: Optional[str] = None + caption: str | None = None """Audio caption, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the audio caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - duration: Optional[int] = None + duration: int | None = None """Duration of the audio in seconds""" - performer: Optional[str] = None + performer: str | None = None """Performer""" - title: Optional[str] = None + title: str | None = None """Track name""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = None """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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -89,25 +87,25 @@ class SendAudio(TelegramMethod[Message]): *, chat_id: ChatIdUnion, audio: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_chat_action.py b/aiogram/methods/send_chat_action.py index 9fd601fa..4cc22ad3 100644 --- a/aiogram/methods/send_chat_action.py +++ b/aiogram/methods/send_chat_action.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -24,9 +24,9 @@ class SendChatAction(TelegramMethod[bool]): """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`). Channel chats and channel direct messages chats aren't supported.""" action: str """Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages `_, *upload_photo* for `photos `_, *record_video* or *upload_video* for `videos `_, *record_voice* or *upload_voice* for `voice notes `_, *upload_document* for `general files `_, *choose_sticker* for `stickers `_, *find_location* for `location data `_, *record_video_note* or *upload_video_note* for `video notes `_.""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the action will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only""" if TYPE_CHECKING: @@ -38,8 +38,8 @@ class SendChatAction(TelegramMethod[bool]): *, chat_id: ChatIdUnion, action: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_checklist.py b/aiogram/methods/send_checklist.py index 1c5c685e..852c8110 100644 --- a/aiogram/methods/send_checklist.py +++ b/aiogram/methods/send_checklist.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InlineKeyboardMarkup, InputChecklist, Message, ReplyParameters from .base import TelegramMethod @@ -22,15 +22,15 @@ class SendChecklist(TelegramMethod[Message]): """Unique identifier for the target chat""" checklist: InputChecklist """A JSON-serialized object for the checklist to send""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message silently. Users will receive a notification with no sound.""" - protect_content: Optional[bool] = None + protect_content: bool | None = None """Protects the contents of the sent message from forwarding and saving""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """A JSON-serialized object for description of the message to reply to""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for an inline keyboard""" if TYPE_CHECKING: @@ -43,11 +43,11 @@ class SendChecklist(TelegramMethod[Message]): business_connection_id: str, chat_id: int, checklist: InputChecklist, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_contact.py b/aiogram/methods/send_contact.py index 83a498be..1d61b52e 100644 --- a/aiogram/methods/send_contact.py +++ b/aiogram/methods/send_contact.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -31,38 +31,36 @@ class SendContact(TelegramMethod[Message]): """Contact's phone number""" first_name: str """Contact's first name""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - last_name: Optional[str] = None + last_name: str | None = None """Contact's last name""" - vcard: Optional[str] = None + vcard: str | None = None """Additional data about the contact in the form of a `vCard `_, 0-2048 bytes""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -78,20 +76,20 @@ class SendContact(TelegramMethod[Message]): chat_id: ChatIdUnion, phone_number: str, first_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_dice.py b/aiogram/methods/send_dice.py index e16afc25..7abecceb 100644 --- a/aiogram/methods/send_dice.py +++ b/aiogram/methods/send_dice.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -27,36 +27,34 @@ class SendDice(TelegramMethod[Message]): chat_id: ChatIdUnion """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - emoji: Optional[str] = None + emoji: str | None = None """Emoji on which the dice throw animation is based. Currently, must be one of '🎲', '🎯', '🏀', '⚽', '🎳', or '🎰'. Dice can have values 1-6 for '🎲', '🎯' and '🎳', values 1-5 for '🏀' and '⚽', and values 1-64 for '🎰'. Defaults to '🎲'""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -70,19 +68,19 @@ class SendDice(TelegramMethod[Message]): __pydantic__self__, *, chat_id: ChatIdUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_document.py b/aiogram/methods/send_document.py index 801d9d06..bd03df8b 100644 --- a/aiogram/methods/send_document.py +++ b/aiogram/methods/send_document.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -32,44 +32,42 @@ class SendDocument(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" document: InputFileUnion """File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = None """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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - caption: Optional[str] = None + caption: str | None = None """Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the document caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - disable_content_type_detection: Optional[bool] = None + disable_content_type_detection: bool | None = None """Disables automatic server-side content type detection for files uploaded using multipart/form-data""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -84,23 +82,23 @@ class SendDocument(TelegramMethod[Message]): *, chat_id: ChatIdUnion, document: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_game.py b/aiogram/methods/send_game.py index c7d589b6..dfea029c 100644 --- a/aiogram/methods/send_game.py +++ b/aiogram/methods/send_game.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -23,30 +23,28 @@ class SendGame(TelegramMethod[Message]): """Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats.""" game_short_name: str """Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather `_.""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for an `inline keyboard `_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -61,16 +59,16 @@ class SendGame(TelegramMethod[Message]): *, chat_id: int, game_short_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_gift.py b/aiogram/methods/send_gift.py index d6882556..17107a3d 100644 --- a/aiogram/methods/send_gift.py +++ b/aiogram/methods/send_gift.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from ..types.message_entity import MessageEntity @@ -19,17 +19,17 @@ class SendGift(TelegramMethod[bool]): gift_id: str """Identifier of the gift; limited gifts can't be sent to channel chats""" - user_id: Optional[int] = None + user_id: int | None = None """Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift.""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = None """Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift.""" - pay_for_upgrade: Optional[bool] = None + pay_for_upgrade: bool | None = None """Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver""" - text: Optional[str] = None + text: str | None = None """Text that will be shown along with the gift; 0-128 characters""" - text_parse_mode: Optional[str] = None + text_parse_mode: str | None = None """Mode for parsing entities in the text. See `formatting options `_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" - text_entities: Optional[list[MessageEntity]] = None + text_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" if TYPE_CHECKING: @@ -40,12 +40,12 @@ class SendGift(TelegramMethod[bool]): __pydantic__self__, *, gift_id: str, - user_id: Optional[int] = None, - chat_id: Optional[ChatIdUnion] = None, - pay_for_upgrade: Optional[bool] = None, - text: Optional[str] = None, - text_parse_mode: Optional[str] = None, - text_entities: Optional[list[MessageEntity]] = None, + user_id: int | None = None, + chat_id: ChatIdUnion | None = None, + pay_for_upgrade: bool | None = None, + text: str | None = None, + text_parse_mode: str | None = None, + text_entities: list[MessageEntity] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_invoice.py b/aiogram/methods/send_invoice.py index 65d94bba..0c1d6bea 100644 --- a/aiogram/methods/send_invoice.py +++ b/aiogram/methods/send_invoice.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -38,64 +38,62 @@ class SendInvoice(TelegramMethod[Message]): """Three-letter ISO 4217 currency code, see `more on currencies `_. Pass 'XTR' for payments in `Telegram Stars `_.""" prices: list[LabeledPrice] """Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - provider_token: Optional[str] = None + provider_token: str | None = None """Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.""" - max_tip_amount: Optional[int] = None + max_tip_amount: int | None = None """The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.""" - suggested_tip_amounts: Optional[list[int]] = None + suggested_tip_amounts: list[int] | None = None """A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*.""" - start_parameter: Optional[str] = None + start_parameter: str | None = None """Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a *Pay* button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a *URL* button with a deep link to the bot (instead of a *Pay* button), with the value used as the start parameter""" - provider_data: Optional[str] = None + provider_data: str | None = None """JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.""" - photo_url: Optional[str] = None + photo_url: str | None = None """URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.""" - photo_size: Optional[int] = None + photo_size: int | None = None """Photo size in bytes""" - photo_width: Optional[int] = None + photo_width: int | None = None """Photo width""" - photo_height: Optional[int] = None + photo_height: int | None = None """Photo height""" - need_name: Optional[bool] = None + need_name: bool | None = None """Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_phone_number: Optional[bool] = None + need_phone_number: bool | None = None """Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_email: Optional[bool] = None + need_email: bool | None = None """Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_shipping_address: Optional[bool] = None + need_shipping_address: bool | None = None """Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars `_.""" - send_phone_number_to_provider: Optional[bool] = None + send_phone_number_to_provider: bool | None = None """Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars `_.""" - send_email_to_provider: Optional[bool] = None + send_email_to_provider: bool | None = None """Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars `_.""" - is_flexible: Optional[bool] = None + is_flexible: bool | None = None """Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars `_.""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for an `inline keyboard `_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button.""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -114,33 +112,33 @@ class SendInvoice(TelegramMethod[Message]): payload: str, currency: str, prices: list[LabeledPrice], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_location.py b/aiogram/methods/send_location.py index 26e15e5f..4a8ee223 100644 --- a/aiogram/methods/send_location.py +++ b/aiogram/methods/send_location.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -31,42 +31,40 @@ class SendLocation(TelegramMethod[Message]): """Latitude of the location""" longitude: float """Longitude of the location""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - horizontal_accuracy: Optional[float] = None + horizontal_accuracy: float | None = None """The radius of uncertainty for the location, measured in meters; 0-1500""" - live_period: Optional[int] = None + live_period: int | None = None """Period in seconds during which the location will be updated (see `Live Locations `_, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.""" - heading: Optional[int] = None + heading: int | None = None """For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.""" - proximity_alert_radius: Optional[int] = None + proximity_alert_radius: int | None = None """For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -82,22 +80,22 @@ class SendLocation(TelegramMethod[Message]): chat_id: ChatIdUnion, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_media_group.py b/aiogram/methods/send_media_group.py index 8cd8c9fc..d5d57749 100644 --- a/aiogram/methods/send_media_group.py +++ b/aiogram/methods/send_media_group.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -23,30 +23,28 @@ class SendMediaGroup(TelegramMethod[list[Message]]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" media: list[MediaUnion] """A JSON-serialized array describing messages to be sent, must include 2-10 items""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends messages `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent messages from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the messages are a reply, ID of the original message .. deprecated:: API:7.0 @@ -61,16 +59,16 @@ class SendMediaGroup(TelegramMethod[list[Message]]): *, chat_id: ChatIdUnion, media: list[MediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_message.py b/aiogram/methods/send_message.py index 88138622..0997803e 100644 --- a/aiogram/methods/send_message.py +++ b/aiogram/methods/send_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -31,47 +31,45 @@ class SendMessage(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" text: str """Text of the message to be sent, 1-4096 characters after entities parsing""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the message text. See `formatting options `_ for more details.""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*""" - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default("link_preview") + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview") """Link preview generation options for the message""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - disable_web_page_preview: Optional[Union[bool, Default]] = Field( + disable_web_page_preview: bool | Default | None = Field( Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True} ) """Disables link previews for links in this message .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -86,26 +84,22 @@ class SendMessage(TelegramMethod[Message]): *, chat_id: ChatIdUnion, text: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_message_draft.py b/aiogram/methods/send_message_draft.py index 1221dc90..6124f73e 100644 --- a/aiogram/methods/send_message_draft.py +++ b/aiogram/methods/send_message_draft.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import MessageEntity from .base import TelegramMethod @@ -22,11 +22,11 @@ class SendMessageDraft(TelegramMethod[bool]): """Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated""" text: str """Text of the message to be sent, 1-4096 characters after entities parsing""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread""" - parse_mode: Optional[str] = None + parse_mode: str | None = None """Mode for parsing entities in the message text. See `formatting options `_ for more details.""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*""" if TYPE_CHECKING: @@ -39,9 +39,9 @@ class SendMessageDraft(TelegramMethod[bool]): chat_id: int, draft_id: int, text: str, - message_thread_id: Optional[int] = None, - parse_mode: Optional[str] = None, - entities: Optional[list[MessageEntity]] = None, + message_thread_id: int | None = None, + parse_mode: str | None = None, + entities: list[MessageEntity] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_paid_media.py b/aiogram/methods/send_paid_media.py index 78b7eaa8..3d9cfec6 100644 --- a/aiogram/methods/send_paid_media.py +++ b/aiogram/methods/send_paid_media.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ( ChatIdUnion, @@ -30,33 +30,33 @@ class SendPaidMedia(TelegramMethod[Message]): """The number of Telegram Stars that must be paid to buy access to the media; 1-25000""" media: list[InputPaidMediaUnion] """A JSON-serialized array describing the media to be sent; up to 10 items""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - payload: Optional[str] = None + payload: str | None = None """Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.""" - caption: Optional[str] = None + caption: str | None = None """Media caption, 0-1024 characters after entities parsing""" - parse_mode: Optional[str] = None + parse_mode: str | None = None """Mode for parsing entities in the media caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[bool] = None + show_caption_above_media: bool | None = None """Pass :code:`True`, if the caption must be shown above the message media""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[bool] = None + protect_content: bool | None = None """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" if TYPE_CHECKING: @@ -69,20 +69,20 @@ class SendPaidMedia(TelegramMethod[Message]): chat_id: ChatIdUnion, star_count: int, media: list[InputPaidMediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - payload: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - allow_paid_broadcast: Optional[bool] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + payload: str | None = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + allow_paid_broadcast: bool | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_photo.py b/aiogram/methods/send_photo.py index 0136351a..83480f6a 100644 --- a/aiogram/methods/send_photo.py +++ b/aiogram/methods/send_photo.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -31,44 +31,42 @@ class SendPhoto(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" photo: InputFileUnion """Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. :ref:`More information on Sending Files » `""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - caption: Optional[str] = None + caption: str | None = None """Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the photo caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """Pass :code:`True`, if the caption must be shown above the message media""" - has_spoiler: Optional[bool] = None + has_spoiler: bool | None = None """Pass :code:`True` if the photo needs to be covered with a spoiler animation""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -83,25 +81,23 @@ class SendPhoto(TelegramMethod[Message]): *, chat_id: ChatIdUnion, photo: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_poll.py b/aiogram/methods/send_poll.py index f5f946d7..01979ff1 100644 --- a/aiogram/methods/send_poll.py +++ b/aiogram/methods/send_poll.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -33,54 +33,52 @@ class SendPoll(TelegramMethod[Message]): """Poll question, 1-300 characters""" options: list[InputPollOptionUnion] """A JSON-serialized list of 2-12 answer options""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + question_parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the question. See `formatting options `_ for more details. Currently, only custom emoji entities are allowed""" - question_entities: Optional[list[MessageEntity]] = None + question_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of *question_parse_mode*""" - is_anonymous: Optional[bool] = None + is_anonymous: bool | None = None """:code:`True`, if the poll needs to be anonymous, defaults to :code:`True`""" - type: Optional[str] = None + type: str | None = None """Poll type, 'quiz' or 'regular', defaults to 'regular'""" - allows_multiple_answers: Optional[bool] = None + allows_multiple_answers: bool | None = None """:code:`True`, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False`""" - correct_option_id: Optional[int] = None + correct_option_id: int | None = None """0-based identifier of the correct answer option, required for polls in quiz mode""" - explanation: Optional[str] = None + explanation: str | None = None """Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing""" - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + explanation_parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the explanation. See `formatting options `_ for more details.""" - explanation_entities: Optional[list[MessageEntity]] = None + explanation_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of *explanation_parse_mode*""" - open_period: Optional[int] = None + open_period: int | None = None """Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with *close_date*.""" - close_date: Optional[DateTimeUnion] = None + close_date: DateTimeUnion | None = None """Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with *open_period*.""" - is_closed: Optional[bool] = None + is_closed: bool | None = None """Pass :code:`True` if the poll needs to be immediately closed. This can be useful for poll preview.""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -96,28 +94,28 @@ class SendPoll(TelegramMethod[Message]): chat_id: ChatIdUnion, question: str, options: list[InputPollOptionUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_sticker.py b/aiogram/methods/send_sticker.py index 9c4d331c..683b3970 100644 --- a/aiogram/methods/send_sticker.py +++ b/aiogram/methods/send_sticker.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -30,36 +30,34 @@ class SendSticker(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" sticker: InputFileUnion """Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. :ref:`More information on Sending Files » `. Video and animated stickers can't be sent via an HTTP URL.""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - emoji: Optional[str] = None + emoji: str | None = None """Emoji associated with the sticker; only for just uploaded stickers""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -74,19 +72,19 @@ class SendSticker(TelegramMethod[Message]): *, chat_id: ChatIdUnion, sticker: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_venue.py b/aiogram/methods/send_venue.py index c9dc7a95..677516f9 100644 --- a/aiogram/methods/send_venue.py +++ b/aiogram/methods/send_venue.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -35,42 +35,40 @@ class SendVenue(TelegramMethod[Message]): """Name of the venue""" address: str """Address of the venue""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - foursquare_id: Optional[str] = None + foursquare_id: str | None = None """Foursquare identifier of the venue""" - foursquare_type: Optional[str] = None + foursquare_type: str | None = None """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" - google_place_id: Optional[str] = None + google_place_id: str | None = None """Google Places identifier of the venue""" - google_place_type: Optional[str] = None + google_place_type: str | None = None """Google Places type of the venue. (See `supported types `_.)""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -88,22 +86,22 @@ class SendVenue(TelegramMethod[Message]): longitude: float, title: str, address: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_video.py b/aiogram/methods/send_video.py index c69ecea3..c8112e21 100644 --- a/aiogram/methods/send_video.py +++ b/aiogram/methods/send_video.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -33,58 +33,56 @@ class SendVideo(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" video: InputFileUnion """Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. :ref:`More information on Sending Files » `""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - duration: Optional[int] = None + duration: int | None = None """Duration of sent video in seconds""" - width: Optional[int] = None + width: int | None = None """Video width""" - height: Optional[int] = None + height: int | None = None """Video height""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = None """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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - cover: Optional[InputFileUnion] = None + cover: InputFileUnion | None = None """Cover for the video in the message. 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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - start_timestamp: Optional[DateTimeUnion] = None + start_timestamp: DateTimeUnion | None = None """Start timestamp for the video in the message""" - caption: Optional[str] = None + caption: str | None = None """Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the video caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """Pass :code:`True`, if the caption must be shown above the message media""" - has_spoiler: Optional[bool] = None + has_spoiler: bool | None = None """Pass :code:`True` if the video needs to be covered with a spoiler animation""" - supports_streaming: Optional[bool] = None + supports_streaming: bool | None = None """Pass :code:`True` if the uploaded video is suitable for streaming""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -99,32 +97,30 @@ class SendVideo(TelegramMethod[Message]): *, chat_id: ChatIdUnion, video: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_video_note.py b/aiogram/methods/send_video_note.py index 0732f5c2..2f5195e7 100644 --- a/aiogram/methods/send_video_note.py +++ b/aiogram/methods/send_video_note.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -31,40 +31,38 @@ class SendVideoNote(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" video_note: InputFileUnion """Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. :ref:`More information on Sending Files » `. Sending video notes by a URL is currently unsupported""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - duration: Optional[int] = None + duration: int | None = None """Duration of sent video in seconds""" - length: Optional[int] = None + length: int | None = None """Video width and height, i.e. diameter of the video message""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = None """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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -79,21 +77,21 @@ class SendVideoNote(TelegramMethod[Message]): *, chat_id: ChatIdUnion, video_note: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/send_voice.py b/aiogram/methods/send_voice.py index 597c8724..c1ddd298 100644 --- a/aiogram/methods/send_voice.py +++ b/aiogram/methods/send_voice.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -31,42 +31,40 @@ class SendVoice(TelegramMethod[Message]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" voice: InputFileUnion """Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be sent""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" - direct_messages_topic_id: Optional[int] = None + direct_messages_topic_id: int | None = None """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" - caption: Optional[str] = None + caption: str | None = None """Voice message caption, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """Mode for parsing entities in the voice message caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - duration: Optional[int] = None + duration: int | None = None """Duration of the voice message in seconds""" - disable_notification: Optional[bool] = None + disable_notification: bool | None = None """Sends the message `silently `_. Users will receive a notification with no sound.""" - protect_content: Optional[Union[bool, Default]] = Default("protect_content") + protect_content: bool | Default | None = Default("protect_content") """Protects the contents of the sent message from forwarding and saving""" - allow_paid_broadcast: Optional[bool] = None + allow_paid_broadcast: bool | None = None """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits `_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" - message_effect_id: Optional[str] = None + message_effect_id: str | None = None """Unique identifier of the message effect to be added to the message; for private chats only""" - suggested_post_parameters: Optional[SuggestedPostParameters] = None + suggested_post_parameters: SuggestedPostParameters | None = None """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" - reply_parameters: Optional[ReplyParameters] = None + reply_parameters: ReplyParameters | None = None """Description of the message to reply to""" - reply_markup: Optional[ReplyMarkupUnion] = None + reply_markup: ReplyMarkupUnion | None = None """Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove a reply keyboard or to force a reply from the user""" - allow_sending_without_reply: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """If the message is a reply, ID of the original message .. deprecated:: API:7.0 @@ -81,22 +79,22 @@ class SendVoice(TelegramMethod[Message]): *, chat_id: ChatIdUnion, voice: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_business_account_bio.py b/aiogram/methods/set_business_account_bio.py index 04bb3f32..51de976a 100644 --- a/aiogram/methods/set_business_account_bio.py +++ b/aiogram/methods/set_business_account_bio.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -17,7 +17,7 @@ class SetBusinessAccountBio(TelegramMethod[bool]): business_connection_id: str """Unique identifier of the business connection""" - bio: Optional[str] = None + bio: str | None = None """The new value of the bio for the business account; 0-140 characters""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class SetBusinessAccountBio(TelegramMethod[bool]): __pydantic__self__, *, business_connection_id: str, - bio: Optional[str] = None, + bio: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_business_account_name.py b/aiogram/methods/set_business_account_name.py index 7bb9e69f..50132db3 100644 --- a/aiogram/methods/set_business_account_name.py +++ b/aiogram/methods/set_business_account_name.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -19,7 +19,7 @@ class SetBusinessAccountName(TelegramMethod[bool]): """Unique identifier of the business connection""" first_name: str """The new value of the first name for the business account; 1-64 characters""" - last_name: Optional[str] = None + last_name: str | None = None """The new value of the last name for the business account; 0-64 characters""" if TYPE_CHECKING: @@ -31,7 +31,7 @@ class SetBusinessAccountName(TelegramMethod[bool]): *, business_connection_id: str, first_name: str, - last_name: Optional[str] = None, + last_name: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_business_account_profile_photo.py b/aiogram/methods/set_business_account_profile_photo.py index 330ceb65..529d80a8 100644 --- a/aiogram/methods/set_business_account_profile_photo.py +++ b/aiogram/methods/set_business_account_profile_photo.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InputProfilePhotoUnion from .base import TelegramMethod @@ -20,7 +20,7 @@ class SetBusinessAccountProfilePhoto(TelegramMethod[bool]): """Unique identifier of the business connection""" photo: InputProfilePhotoUnion """The new profile photo to set""" - is_public: Optional[bool] = None + is_public: bool | None = None """Pass :code:`True` to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.""" if TYPE_CHECKING: @@ -32,7 +32,7 @@ class SetBusinessAccountProfilePhoto(TelegramMethod[bool]): *, business_connection_id: str, photo: InputProfilePhotoUnion, - is_public: Optional[bool] = None, + is_public: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_business_account_username.py b/aiogram/methods/set_business_account_username.py index 6c67b9b0..a67c9d91 100644 --- a/aiogram/methods/set_business_account_username.py +++ b/aiogram/methods/set_business_account_username.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -17,7 +17,7 @@ class SetBusinessAccountUsername(TelegramMethod[bool]): business_connection_id: str """Unique identifier of the business connection""" - username: Optional[str] = None + username: str | None = None """The new value of the username for the business account; 0-32 characters""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class SetBusinessAccountUsername(TelegramMethod[bool]): __pydantic__self__, *, business_connection_id: str, - username: Optional[str] = None, + username: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_chat_description.py b/aiogram/methods/set_chat_description.py index 0cd15924..f877e653 100644 --- a/aiogram/methods/set_chat_description.py +++ b/aiogram/methods/set_chat_description.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -18,7 +18,7 @@ class SetChatDescription(TelegramMethod[bool]): chat_id: ChatIdUnion """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" - description: Optional[str] = None + description: str | None = None """New chat description, 0-255 characters""" if TYPE_CHECKING: @@ -29,7 +29,7 @@ class SetChatDescription(TelegramMethod[bool]): __pydantic__self__, *, chat_id: ChatIdUnion, - description: Optional[str] = None, + description: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_chat_menu_button.py b/aiogram/methods/set_chat_menu_button.py index 8ba8acc6..ced4e56f 100644 --- a/aiogram/methods/set_chat_menu_button.py +++ b/aiogram/methods/set_chat_menu_button.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import MenuButtonUnion from .base import TelegramMethod @@ -16,9 +16,9 @@ class SetChatMenuButton(TelegramMethod[bool]): __returning__ = bool __api_method__ = "setChatMenuButton" - chat_id: Optional[int] = None + chat_id: int | None = None """Unique identifier for the target private chat. If not specified, default bot's menu button will be changed""" - menu_button: Optional[MenuButtonUnion] = None + menu_button: MenuButtonUnion | None = None """A JSON-serialized object for the bot's new menu button. Defaults to :class:`aiogram.types.menu_button_default.MenuButtonDefault`""" if TYPE_CHECKING: @@ -28,8 +28,8 @@ class SetChatMenuButton(TelegramMethod[bool]): def __init__( __pydantic__self__, *, - chat_id: Optional[int] = None, - menu_button: Optional[MenuButtonUnion] = None, + chat_id: int | None = None, + menu_button: MenuButtonUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_chat_permissions.py b/aiogram/methods/set_chat_permissions.py index 65b3a585..fdc58352 100644 --- a/aiogram/methods/set_chat_permissions.py +++ b/aiogram/methods/set_chat_permissions.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ChatPermissions from .base import TelegramMethod @@ -20,7 +20,7 @@ class SetChatPermissions(TelegramMethod[bool]): """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)""" permissions: ChatPermissions """A JSON-serialized object for new default chat permissions""" - use_independent_chat_permissions: Optional[bool] = None + use_independent_chat_permissions: bool | None = None """Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission.""" if TYPE_CHECKING: @@ -32,7 +32,7 @@ class SetChatPermissions(TelegramMethod[bool]): *, chat_id: ChatIdUnion, permissions: ChatPermissions, - use_independent_chat_permissions: Optional[bool] = None, + use_independent_chat_permissions: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py b/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py index 47e9c033..0259052d 100644 --- a/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py +++ b/aiogram/methods/set_custom_emoji_sticker_set_thumbnail.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -17,7 +17,7 @@ class SetCustomEmojiStickerSetThumbnail(TelegramMethod[bool]): name: str """Sticker set name""" - custom_emoji_id: Optional[str] = None + custom_emoji_id: str | None = None """Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class SetCustomEmojiStickerSetThumbnail(TelegramMethod[bool]): __pydantic__self__, *, name: str, - custom_emoji_id: Optional[str] = None, + custom_emoji_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_game_score.py b/aiogram/methods/set_game_score.py index 38e5374f..86ba9d52 100644 --- a/aiogram/methods/set_game_score.py +++ b/aiogram/methods/set_game_score.py @@ -1,34 +1,34 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..types import Message from .base import TelegramMethod -class SetGameScore(TelegramMethod[Union[Message, bool]]): +class SetGameScore(TelegramMethod[Message | bool]): """ Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is :code:`False`. Source: https://core.telegram.org/bots/api#setgamescore """ - __returning__ = Union[Message, bool] + __returning__ = Message | bool __api_method__ = "setGameScore" user_id: int """User identifier""" score: int """New score, must be non-negative""" - force: Optional[bool] = None + force: bool | None = None """Pass :code:`True` if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters""" - disable_edit_message: Optional[bool] = None + disable_edit_message: bool | None = None """Pass :code:`True` if the game message should not be automatically edited to include the current scoreboard""" - chat_id: Optional[int] = None + chat_id: int | None = None """Required if *inline_message_id* is not specified. Unique identifier for the target chat""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the sent message""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" if TYPE_CHECKING: @@ -40,11 +40,11 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]): *, user_id: int, score: int, - force: Optional[bool] = None, - disable_edit_message: Optional[bool] = None, - chat_id: Optional[int] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, + force: bool | None = None, + disable_edit_message: bool | None = None, + chat_id: int | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_message_reaction.py b/aiogram/methods/set_message_reaction.py index 6af7edb1..f8a3c47e 100644 --- a/aiogram/methods/set_message_reaction.py +++ b/aiogram/methods/set_message_reaction.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, ReactionTypeUnion from .base import TelegramMethod @@ -18,9 +18,9 @@ class SetMessageReaction(TelegramMethod[bool]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" message_id: int """Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.""" - reaction: Optional[list[ReactionTypeUnion]] = None + reaction: list[ReactionTypeUnion] | None = None """A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.""" - is_big: Optional[bool] = None + is_big: bool | None = None """Pass :code:`True` to set the reaction with a big animation""" if TYPE_CHECKING: @@ -32,8 +32,8 @@ class SetMessageReaction(TelegramMethod[bool]): *, chat_id: ChatIdUnion, message_id: int, - reaction: Optional[list[ReactionTypeUnion]] = None, - is_big: Optional[bool] = None, + reaction: list[ReactionTypeUnion] | None = None, + is_big: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_my_commands.py b/aiogram/methods/set_my_commands.py index 5f9a0552..8f687e3f 100644 --- a/aiogram/methods/set_my_commands.py +++ b/aiogram/methods/set_my_commands.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import BotCommand, BotCommandScopeUnion from .base import TelegramMethod @@ -18,9 +18,9 @@ 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[BotCommandScopeUnion] = None + scope: BotCommandScopeUnion | None = 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 + language_code: str | None = 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""" if TYPE_CHECKING: @@ -31,8 +31,8 @@ class SetMyCommands(TelegramMethod[bool]): __pydantic__self__, *, commands: list[BotCommand], - scope: Optional[BotCommandScopeUnion] = None, - language_code: Optional[str] = None, + scope: BotCommandScopeUnion | None = None, + language_code: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_my_default_administrator_rights.py b/aiogram/methods/set_my_default_administrator_rights.py index 02aa7ada..e2f46633 100644 --- a/aiogram/methods/set_my_default_administrator_rights.py +++ b/aiogram/methods/set_my_default_administrator_rights.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatAdministratorRights from .base import TelegramMethod @@ -16,9 +16,9 @@ class SetMyDefaultAdministratorRights(TelegramMethod[bool]): __returning__ = bool __api_method__ = "setMyDefaultAdministratorRights" - rights: Optional[ChatAdministratorRights] = None + rights: ChatAdministratorRights | None = None """A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.""" - for_channels: Optional[bool] = None + for_channels: bool | None = None """Pass :code:`True` to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.""" if TYPE_CHECKING: @@ -28,8 +28,8 @@ class SetMyDefaultAdministratorRights(TelegramMethod[bool]): def __init__( __pydantic__self__, *, - rights: Optional[ChatAdministratorRights] = None, - for_channels: Optional[bool] = None, + rights: ChatAdministratorRights | None = None, + for_channels: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_my_description.py b/aiogram/methods/set_my_description.py index ee192c88..457f8711 100644 --- a/aiogram/methods/set_my_description.py +++ b/aiogram/methods/set_my_description.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -15,9 +15,9 @@ class SetMyDescription(TelegramMethod[bool]): __returning__ = bool __api_method__ = "setMyDescription" - description: Optional[str] = None + description: str | None = None """New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.""" - language_code: Optional[str] = None + language_code: str | None = None """A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.""" if TYPE_CHECKING: @@ -27,8 +27,8 @@ class SetMyDescription(TelegramMethod[bool]): def __init__( __pydantic__self__, *, - description: Optional[str] = None, - language_code: Optional[str] = None, + description: str | None = None, + language_code: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_my_name.py b/aiogram/methods/set_my_name.py index 3633fdc8..86bcdbab 100644 --- a/aiogram/methods/set_my_name.py +++ b/aiogram/methods/set_my_name.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -13,9 +13,9 @@ class SetMyName(TelegramMethod[bool]): __returning__ = bool __api_method__ = "setMyName" - name: Optional[str] = None + name: str | None = None """New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.""" - language_code: Optional[str] = None + language_code: str | None = None """A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.""" if TYPE_CHECKING: @@ -25,8 +25,8 @@ class SetMyName(TelegramMethod[bool]): def __init__( __pydantic__self__, *, - name: Optional[str] = None, - language_code: Optional[str] = None, + name: str | None = None, + language_code: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_my_short_description.py b/aiogram/methods/set_my_short_description.py index 22fa5817..0b0006cc 100644 --- a/aiogram/methods/set_my_short_description.py +++ b/aiogram/methods/set_my_short_description.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -15,9 +15,9 @@ class SetMyShortDescription(TelegramMethod[bool]): __returning__ = bool __api_method__ = "setMyShortDescription" - short_description: Optional[str] = None + short_description: str | None = None """New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.""" - language_code: Optional[str] = None + language_code: str | None = None """A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.""" if TYPE_CHECKING: @@ -27,8 +27,8 @@ class SetMyShortDescription(TelegramMethod[bool]): def __init__( __pydantic__self__, *, - short_description: Optional[str] = None, - language_code: Optional[str] = None, + short_description: str | None = None, + language_code: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_sticker_keywords.py b/aiogram/methods/set_sticker_keywords.py index 411f7299..38516cd1 100644 --- a/aiogram/methods/set_sticker_keywords.py +++ b/aiogram/methods/set_sticker_keywords.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -17,7 +17,7 @@ class SetStickerKeywords(TelegramMethod[bool]): sticker: str """File identifier of the sticker""" - keywords: Optional[list[str]] = None + keywords: list[str] | None = None """A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class SetStickerKeywords(TelegramMethod[bool]): __pydantic__self__, *, sticker: str, - keywords: Optional[list[str]] = None, + keywords: list[str] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_sticker_mask_position.py b/aiogram/methods/set_sticker_mask_position.py index 617e48b5..5ad0b4a7 100644 --- a/aiogram/methods/set_sticker_mask_position.py +++ b/aiogram/methods/set_sticker_mask_position.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import MaskPosition from .base import TelegramMethod @@ -18,7 +18,7 @@ class SetStickerMaskPosition(TelegramMethod[bool]): sticker: str """File identifier of the sticker""" - mask_position: Optional[MaskPosition] = None + mask_position: MaskPosition | None = None """A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.""" if TYPE_CHECKING: @@ -29,7 +29,7 @@ class SetStickerMaskPosition(TelegramMethod[bool]): __pydantic__self__, *, sticker: str, - mask_position: Optional[MaskPosition] = None, + mask_position: MaskPosition | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_sticker_set_thumbnail.py b/aiogram/methods/set_sticker_set_thumbnail.py index ef5d8ae8..40160baa 100644 --- a/aiogram/methods/set_sticker_set_thumbnail.py +++ b/aiogram/methods/set_sticker_set_thumbnail.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InputFileUnion from .base import TelegramMethod @@ -22,7 +22,7 @@ class SetStickerSetThumbnail(TelegramMethod[bool]): """User identifier of the sticker set owner""" format: str """Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video""" - thumbnail: Optional[InputFileUnion] = None + thumbnail: InputFileUnion | None = None """A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements `_`https://core.telegram.org/stickers#animation-requirements `_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements `_`https://core.telegram.org/stickers#video-requirements `_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » `. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.""" if TYPE_CHECKING: @@ -35,7 +35,7 @@ class SetStickerSetThumbnail(TelegramMethod[bool]): name: str, user_id: int, format: str, - thumbnail: Optional[InputFileUnion] = None, + thumbnail: InputFileUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_user_emoji_status.py b/aiogram/methods/set_user_emoji_status.py index b35b19c3..025b707b 100644 --- a/aiogram/methods/set_user_emoji_status.py +++ b/aiogram/methods/set_user_emoji_status.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import DateTimeUnion from .base import TelegramMethod @@ -18,9 +18,9 @@ class SetUserEmojiStatus(TelegramMethod[bool]): user_id: int """Unique identifier of the target user""" - emoji_status_custom_emoji_id: Optional[str] = None + emoji_status_custom_emoji_id: str | None = None """Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.""" - emoji_status_expiration_date: Optional[DateTimeUnion] = None + emoji_status_expiration_date: DateTimeUnion | None = None """Expiration date of the emoji status, if any""" if TYPE_CHECKING: @@ -31,8 +31,8 @@ class SetUserEmojiStatus(TelegramMethod[bool]): __pydantic__self__, *, user_id: int, - emoji_status_custom_emoji_id: Optional[str] = None, - emoji_status_expiration_date: Optional[DateTimeUnion] = None, + emoji_status_custom_emoji_id: str | None = None, + emoji_status_expiration_date: DateTimeUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/set_webhook.py b/aiogram/methods/set_webhook.py index e7076839..566103a3 100644 --- a/aiogram/methods/set_webhook.py +++ b/aiogram/methods/set_webhook.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import InputFile from .base import TelegramMethod @@ -28,17 +28,17 @@ class SetWebhook(TelegramMethod[bool]): url: str """HTTPS URL to send updates to. Use an empty string to remove webhook integration""" - certificate: Optional[InputFile] = None + certificate: InputFile | None = None """Upload your public key certificate so that the root certificate in use can be checked. See our `self-signed guide `_ for details.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS""" - max_connections: Optional[int] = None + max_connections: int | None = None """The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to *40*. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.""" - allowed_updates: Optional[list[str]] = None + allowed_updates: list[str] | None = None """A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`["message", "edited_channel_post", "callback_query"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.""" - drop_pending_updates: Optional[bool] = None + drop_pending_updates: bool | None = None """Pass :code:`True` to drop all pending updates""" - secret_token: Optional[str] = None + secret_token: str | None = None """A secret token to be sent in a header 'X-Telegram-Bot-Api-Secret-Token' in every webhook request, 1-256 characters. Only characters :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. The header is useful to ensure that the request comes from a webhook set by you.""" if TYPE_CHECKING: @@ -49,12 +49,12 @@ class SetWebhook(TelegramMethod[bool]): __pydantic__self__, *, url: str, - certificate: Optional[InputFile] = None, - ip_address: Optional[str] = None, - max_connections: Optional[int] = None, - allowed_updates: Optional[list[str]] = None, - drop_pending_updates: Optional[bool] = None, - secret_token: Optional[str] = None, + certificate: InputFile | None = None, + ip_address: str | None = None, + max_connections: int | None = None, + allowed_updates: list[str] | None = None, + drop_pending_updates: bool | None = None, + secret_token: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/stop_message_live_location.py b/aiogram/methods/stop_message_live_location.py index 04addd76..2d6bd2cd 100644 --- a/aiogram/methods/stop_message_live_location.py +++ b/aiogram/methods/stop_message_live_location.py @@ -1,30 +1,30 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, InlineKeyboardMarkup, Message from .base import TelegramMethod -class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]): +class StopMessageLiveLocation(TelegramMethod[Message | bool]): """ Use this method to stop updating a live location message before *live_period* expires. On success, if the message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Source: https://core.telegram.org/bots/api#stopmessagelivelocation """ - __returning__ = Union[Message, bool] + __returning__ = Message | bool __api_method__ = "stopMessageLiveLocation" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message to be edited was sent""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = 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`)""" - message_id: Optional[int] = None + message_id: int | None = None """Required if *inline_message_id* is not specified. Identifier of the message with live location to stop""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for a new `inline keyboard `_.""" if TYPE_CHECKING: @@ -34,11 +34,11 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]): def __init__( __pydantic__self__, *, - business_connection_id: Optional[str] = None, - chat_id: Optional[ChatIdUnion] = None, - message_id: Optional[int] = None, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + business_connection_id: str | None = None, + chat_id: ChatIdUnion | None = None, + message_id: int | None = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/stop_poll.py b/aiogram/methods/stop_poll.py index 2c4f16aa..925dd0e9 100644 --- a/aiogram/methods/stop_poll.py +++ b/aiogram/methods/stop_poll.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion, InlineKeyboardMarkup, Poll from .base import TelegramMethod @@ -20,9 +20,9 @@ class StopPoll(TelegramMethod[Poll]): """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" message_id: int """Identifier of the original message with the poll""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message to be edited was sent""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """A JSON-serialized object for a new message `inline keyboard `_.""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class StopPoll(TelegramMethod[Poll]): *, chat_id: ChatIdUnion, message_id: int, - business_connection_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + business_connection_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/transfer_gift.py b/aiogram/methods/transfer_gift.py index 3ca0b80c..ee05c055 100644 --- a/aiogram/methods/transfer_gift.py +++ b/aiogram/methods/transfer_gift.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -21,7 +21,7 @@ class TransferGift(TelegramMethod[bool]): """Unique identifier of the regular gift that should be transferred""" new_owner_chat_id: int """Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.""" - star_count: Optional[int] = None + star_count: int | None = None """The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the *can_transfer_stars* business bot right is required.""" if TYPE_CHECKING: @@ -34,7 +34,7 @@ class TransferGift(TelegramMethod[bool]): business_connection_id: str, owned_gift_id: str, new_owner_chat_id: int, - star_count: Optional[int] = None, + star_count: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/unban_chat_member.py b/aiogram/methods/unban_chat_member.py index 20178bc8..e7719845 100644 --- a/aiogram/methods/unban_chat_member.py +++ b/aiogram/methods/unban_chat_member.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -20,7 +20,7 @@ class UnbanChatMember(TelegramMethod[bool]): """Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)""" user_id: int """Unique identifier of the target user""" - only_if_banned: Optional[bool] = None + only_if_banned: bool | None = None """Do nothing if the user is not banned""" if TYPE_CHECKING: @@ -32,7 +32,7 @@ class UnbanChatMember(TelegramMethod[bool]): *, chat_id: ChatIdUnion, user_id: int, - only_if_banned: Optional[bool] = None, + only_if_banned: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/unpin_chat_message.py b/aiogram/methods/unpin_chat_message.py index 69d9e2d5..b7056367 100644 --- a/aiogram/methods/unpin_chat_message.py +++ b/aiogram/methods/unpin_chat_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -18,9 +18,9 @@ class UnpinChatMessage(TelegramMethod[bool]): chat_id: ChatIdUnion """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """Unique identifier of the business connection on behalf of which the message will be unpinned""" - message_id: Optional[int] = None + message_id: int | None = None """Identifier of the message to unpin. Required if *business_connection_id* is specified. If not specified, the most recent pinned message (by sending date) will be unpinned.""" if TYPE_CHECKING: @@ -31,8 +31,8 @@ class UnpinChatMessage(TelegramMethod[bool]): __pydantic__self__, *, chat_id: ChatIdUnion, - business_connection_id: Optional[str] = None, - message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/upgrade_gift.py b/aiogram/methods/upgrade_gift.py index c157ed08..707ba042 100644 --- a/aiogram/methods/upgrade_gift.py +++ b/aiogram/methods/upgrade_gift.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -19,9 +19,9 @@ class UpgradeGift(TelegramMethod[bool]): """Unique identifier of the business connection""" owned_gift_id: str """Unique identifier of the regular gift that should be upgraded to a unique one""" - keep_original_details: Optional[bool] = None + keep_original_details: bool | None = None """Pass :code:`True` to keep the original gift text, sender and receiver in the upgraded gift""" - star_count: Optional[int] = None + star_count: int | None = None """The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If :code:`gift.prepaid_upgrade_star_count > 0`, then pass 0, otherwise, the *can_transfer_stars* business bot right is required and :code:`gift.upgrade_star_count` must be passed.""" if TYPE_CHECKING: @@ -33,8 +33,8 @@ class UpgradeGift(TelegramMethod[bool]): *, business_connection_id: str, owned_gift_id: str, - keep_original_details: Optional[bool] = None, - star_count: Optional[int] = None, + keep_original_details: bool | None = None, + star_count: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/verify_chat.py b/aiogram/methods/verify_chat.py index 4c443579..62791eb5 100644 --- a/aiogram/methods/verify_chat.py +++ b/aiogram/methods/verify_chat.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..types import ChatIdUnion from .base import TelegramMethod @@ -18,7 +18,7 @@ class VerifyChat(TelegramMethod[bool]): chat_id: ChatIdUnion """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`). Channel direct messages chats can't be verified.""" - custom_description: Optional[str] = None + custom_description: str | None = None """Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.""" if TYPE_CHECKING: @@ -29,7 +29,7 @@ class VerifyChat(TelegramMethod[bool]): __pydantic__self__, *, chat_id: ChatIdUnion, - custom_description: Optional[str] = None, + custom_description: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/methods/verify_user.py b/aiogram/methods/verify_user.py index 449081ba..3ae9875c 100644 --- a/aiogram/methods/verify_user.py +++ b/aiogram/methods/verify_user.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramMethod @@ -17,7 +17,7 @@ class VerifyUser(TelegramMethod[bool]): user_id: int """Unique identifier of the target user""" - custom_description: Optional[str] = None + custom_description: str | None = None """Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class VerifyUser(TelegramMethod[bool]): __pydantic__self__, *, user_id: int, - custom_description: Optional[str] = None, + custom_description: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/affiliate_info.py b/aiogram/types/affiliate_info.py index ac231abc..786a0b8b 100644 --- a/aiogram/types/affiliate_info.py +++ b/aiogram/types/affiliate_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -20,11 +20,11 @@ class AffiliateInfo(TelegramObject): """The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users""" amount: int """Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds""" - affiliate_user: Optional[User] = None + affiliate_user: User | None = None """*Optional*. The bot or the user that received an affiliate commission if it was received by a bot or a user""" - affiliate_chat: Optional[Chat] = None + affiliate_chat: Chat | None = None """*Optional*. The chat that received an affiliate commission if it was received by a chat""" - nanostar_amount: Optional[int] = None + nanostar_amount: int | None = None """*Optional*. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds""" if TYPE_CHECKING: @@ -36,9 +36,9 @@ class AffiliateInfo(TelegramObject): *, commission_per_mille: int, amount: int, - affiliate_user: Optional[User] = None, - affiliate_chat: Optional[Chat] = None, - nanostar_amount: Optional[int] = None, + affiliate_user: User | None = None, + affiliate_chat: Chat | None = None, + nanostar_amount: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/animation.py b/aiogram/types/animation.py index 1fb45b71..30533d54 100644 --- a/aiogram/types/animation.py +++ b/aiogram/types/animation.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -25,13 +25,13 @@ class Animation(TelegramObject): """Video height as defined by the sender""" duration: int """Duration of the video in seconds as defined by the sender""" - thumbnail: Optional[PhotoSize] = None + thumbnail: PhotoSize | None = None """*Optional*. Animation thumbnail as defined by the sender""" - file_name: Optional[str] = None + file_name: str | None = None """*Optional*. Original animation filename as defined by the sender""" - mime_type: Optional[str] = None + mime_type: str | None = None """*Optional*. MIME type of the file as defined by the sender""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" if TYPE_CHECKING: @@ -46,10 +46,10 @@ class Animation(TelegramObject): width: int, height: int, duration: int, - thumbnail: Optional[PhotoSize] = None, - file_name: Optional[str] = None, - mime_type: Optional[str] = None, - file_size: Optional[int] = None, + thumbnail: PhotoSize | None = None, + file_name: str | None = None, + mime_type: str | None = None, + file_size: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/audio.py b/aiogram/types/audio.py index 8c114126..cc9d2f03 100644 --- a/aiogram/types/audio.py +++ b/aiogram/types/audio.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -21,17 +21,17 @@ class Audio(TelegramObject): """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" duration: int """Duration of the audio in seconds as defined by the sender""" - performer: Optional[str] = None + performer: str | None = None """*Optional*. Performer of the audio as defined by the sender or by audio tags""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title of the audio as defined by the sender or by audio tags""" - file_name: Optional[str] = None + file_name: str | None = None """*Optional*. Original filename as defined by the sender""" - mime_type: Optional[str] = None + mime_type: str | None = None """*Optional*. MIME type of the file as defined by the sender""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" - thumbnail: Optional[PhotoSize] = None + thumbnail: PhotoSize | None = None """*Optional*. Thumbnail of the album cover to which the music file belongs""" if TYPE_CHECKING: @@ -44,12 +44,12 @@ class Audio(TelegramObject): file_id: str, file_unique_id: str, duration: int, - performer: Optional[str] = None, - title: Optional[str] = None, - file_name: Optional[str] = None, - mime_type: Optional[str] = None, - file_size: Optional[int] = None, - thumbnail: Optional[PhotoSize] = None, + performer: str | None = None, + title: str | None = None, + file_name: str | None = None, + mime_type: str | None = None, + file_size: int | None = None, + thumbnail: PhotoSize | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/background_fill_union.py b/aiogram/types/background_fill_union.py index cb54f511..e5a0a71e 100644 --- a/aiogram/types/background_fill_union.py +++ b/aiogram/types/background_fill_union.py @@ -1,11 +1,11 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .background_fill_freeform_gradient import BackgroundFillFreeformGradient from .background_fill_gradient import BackgroundFillGradient from .background_fill_solid import BackgroundFillSolid -BackgroundFillUnion = Union[ - BackgroundFillSolid, BackgroundFillGradient, BackgroundFillFreeformGradient -] +BackgroundFillUnion: TypeAlias = ( + BackgroundFillSolid | BackgroundFillGradient | BackgroundFillFreeformGradient +) diff --git a/aiogram/types/background_type_pattern.py b/aiogram/types/background_type_pattern.py index f7e0b8cc..1988fb98 100644 --- a/aiogram/types/background_type_pattern.py +++ b/aiogram/types/background_type_pattern.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from .background_type import BackgroundType @@ -24,9 +24,9 @@ class BackgroundTypePattern(BackgroundType): """The background fill that is combined with the pattern""" intensity: int """Intensity of the pattern when it is shown above the filled background; 0-100""" - is_inverted: Optional[bool] = None + is_inverted: bool | None = None """*Optional*. :code:`True`, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only""" - is_moving: Optional[bool] = None + is_moving: bool | None = None """*Optional*. :code:`True`, if the background moves slightly when the device is tilted""" if TYPE_CHECKING: @@ -40,8 +40,8 @@ class BackgroundTypePattern(BackgroundType): document: Document, fill: BackgroundFillUnion, intensity: int, - is_inverted: Optional[bool] = None, - is_moving: Optional[bool] = None, + is_inverted: bool | None = None, + is_moving: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/background_type_union.py b/aiogram/types/background_type_union.py index 66a2582d..1e685784 100644 --- a/aiogram/types/background_type_union.py +++ b/aiogram/types/background_type_union.py @@ -1,12 +1,12 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .background_type_chat_theme import BackgroundTypeChatTheme from .background_type_fill import BackgroundTypeFill from .background_type_pattern import BackgroundTypePattern from .background_type_wallpaper import BackgroundTypeWallpaper -BackgroundTypeUnion = Union[ - BackgroundTypeFill, BackgroundTypeWallpaper, BackgroundTypePattern, BackgroundTypeChatTheme -] +BackgroundTypeUnion: TypeAlias = ( + BackgroundTypeFill | BackgroundTypeWallpaper | BackgroundTypePattern | BackgroundTypeChatTheme +) diff --git a/aiogram/types/background_type_wallpaper.py b/aiogram/types/background_type_wallpaper.py index 4ad29050..a4a2ac70 100644 --- a/aiogram/types/background_type_wallpaper.py +++ b/aiogram/types/background_type_wallpaper.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from .background_type import BackgroundType @@ -21,9 +21,9 @@ class BackgroundTypeWallpaper(BackgroundType): """Document with the wallpaper""" dark_theme_dimming: int """Dimming of the background in dark themes, as a percentage; 0-100""" - is_blurred: Optional[bool] = None + is_blurred: bool | None = None """*Optional*. :code:`True`, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12""" - is_moving: Optional[bool] = None + is_moving: bool | None = None """*Optional*. :code:`True`, if the background moves slightly when the device is tilted""" if TYPE_CHECKING: @@ -36,8 +36,8 @@ class BackgroundTypeWallpaper(BackgroundType): type: Literal["wallpaper"] = "wallpaper", document: Document, dark_theme_dimming: int, - is_blurred: Optional[bool] = None, - is_moving: Optional[bool] = None, + is_blurred: bool | None = None, + is_moving: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/base.py b/aiogram/types/base.py index 7ae00524..7e47b564 100644 --- a/aiogram/types/base.py +++ b/aiogram/types/base.py @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any from unittest.mock import sentinel from pydantic import BaseModel, ConfigDict, model_validator @@ -20,7 +20,7 @@ class TelegramObject(BotContextController, BaseModel): @model_validator(mode="before") @classmethod - def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]: + def remove_unset(cls, values: dict[str, Any]) -> dict[str, Any]: """ Remove UNSET before fields validation. diff --git a/aiogram/types/birthdate.py b/aiogram/types/birthdate.py index 69555540..6bada73d 100644 --- a/aiogram/types/birthdate.py +++ b/aiogram/types/birthdate.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -16,7 +16,7 @@ class Birthdate(TelegramObject): """Day of the user's birth; 1-31""" month: int """Month of the user's birth; 1-12""" - year: Optional[int] = None + year: int | None = None """*Optional*. Year of the user's birth""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class Birthdate(TelegramObject): *, day: int, month: int, - year: Optional[int] = None, + year: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/bot_command_scope_union.py b/aiogram/types/bot_command_scope_union.py index 45788f94..9e305e11 100644 --- a/aiogram/types/bot_command_scope_union.py +++ b/aiogram/types/bot_command_scope_union.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .bot_command_scope_all_chat_administrators import ( BotCommandScopeAllChatAdministrators, @@ -12,12 +12,12 @@ from .bot_command_scope_chat_administrators import BotCommandScopeChatAdministra from .bot_command_scope_chat_member import BotCommandScopeChatMember from .bot_command_scope_default import BotCommandScopeDefault -BotCommandScopeUnion = Union[ - BotCommandScopeDefault, - BotCommandScopeAllPrivateChats, - BotCommandScopeAllGroupChats, - BotCommandScopeAllChatAdministrators, - BotCommandScopeChat, - BotCommandScopeChatAdministrators, - BotCommandScopeChatMember, -] +BotCommandScopeUnion: TypeAlias = ( + BotCommandScopeDefault + | BotCommandScopeAllPrivateChats + | BotCommandScopeAllGroupChats + | BotCommandScopeAllChatAdministrators + | BotCommandScopeChat + | BotCommandScopeChatAdministrators + | BotCommandScopeChatMember +) diff --git a/aiogram/types/business_bot_rights.py b/aiogram/types/business_bot_rights.py index b4a721ba..6efad628 100644 --- a/aiogram/types/business_bot_rights.py +++ b/aiogram/types/business_bot_rights.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -14,37 +14,35 @@ class BusinessBotRights(TelegramObject): Source: https://core.telegram.org/bots/api#businessbotrights """ - can_reply: Optional[bool] = None + can_reply: bool | None = None """*Optional*. :code:`True`, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours""" - can_read_messages: Optional[bool] = None + can_read_messages: bool | None = None """*Optional*. :code:`True`, if the bot can mark incoming private messages as read""" - can_delete_sent_messages: Optional[bool] = None + can_delete_sent_messages: bool | None = None """*Optional*. :code:`True`, if the bot can delete messages sent by the bot""" - can_delete_all_messages: Optional[bool] = None + can_delete_all_messages: bool | None = None """*Optional*. :code:`True`, if the bot can delete all private messages in managed chats""" - can_edit_name: Optional[bool] = None + can_edit_name: bool | None = None """*Optional*. :code:`True`, if the bot can edit the first and last name of the business account""" - can_edit_bio: Optional[bool] = None + can_edit_bio: bool | None = None """*Optional*. :code:`True`, if the bot can edit the bio of the business account""" - can_edit_profile_photo: Optional[bool] = None + can_edit_profile_photo: bool | None = None """*Optional*. :code:`True`, if the bot can edit the profile photo of the business account""" - can_edit_username: Optional[bool] = None + can_edit_username: bool | None = None """*Optional*. :code:`True`, if the bot can edit the username of the business account""" - can_change_gift_settings: Optional[bool] = None + can_change_gift_settings: bool | None = None """*Optional*. :code:`True`, if the bot can change the privacy settings pertaining to gifts for the business account""" - can_view_gifts_and_stars: Optional[bool] = None + can_view_gifts_and_stars: bool | None = None """*Optional*. :code:`True`, if the bot can view gifts and the amount of Telegram Stars owned by the business account""" - can_convert_gifts_to_stars: Optional[bool] = None + can_convert_gifts_to_stars: bool | None = None """*Optional*. :code:`True`, if the bot can convert regular gifts owned by the business account to Telegram Stars""" - can_transfer_and_upgrade_gifts: Optional[bool] = None + can_transfer_and_upgrade_gifts: bool | None = None """*Optional*. :code:`True`, if the bot can transfer and upgrade gifts owned by the business account""" - can_transfer_stars: Optional[bool] = None + can_transfer_stars: bool | None = None """*Optional*. :code:`True`, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts""" - can_manage_stories: Optional[bool] = None + can_manage_stories: bool | None = None """*Optional*. :code:`True`, if the bot can post, edit and delete stories on behalf of the business account""" - can_delete_outgoing_messages: Optional[bool] = Field( - None, json_schema_extra={"deprecated": True} - ) + can_delete_outgoing_messages: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. True, if the bot can delete messages sent by the bot .. deprecated:: API:9.1 @@ -57,21 +55,21 @@ class BusinessBotRights(TelegramObject): def __init__( __pydantic__self__, *, - can_reply: Optional[bool] = None, - can_read_messages: Optional[bool] = None, - can_delete_sent_messages: Optional[bool] = None, - can_delete_all_messages: Optional[bool] = None, - can_edit_name: Optional[bool] = None, - can_edit_bio: Optional[bool] = None, - can_edit_profile_photo: Optional[bool] = None, - can_edit_username: Optional[bool] = None, - can_change_gift_settings: Optional[bool] = None, - can_view_gifts_and_stars: Optional[bool] = None, - can_convert_gifts_to_stars: Optional[bool] = None, - can_transfer_and_upgrade_gifts: Optional[bool] = None, - can_transfer_stars: Optional[bool] = None, - can_manage_stories: Optional[bool] = None, - can_delete_outgoing_messages: Optional[bool] = None, + can_reply: bool | None = None, + can_read_messages: bool | None = None, + can_delete_sent_messages: bool | None = None, + can_delete_all_messages: bool | None = None, + can_edit_name: bool | None = None, + can_edit_bio: bool | None = None, + can_edit_profile_photo: bool | None = None, + can_edit_username: bool | None = None, + can_change_gift_settings: bool | None = None, + can_view_gifts_and_stars: bool | None = None, + can_convert_gifts_to_stars: bool | None = None, + can_transfer_and_upgrade_gifts: bool | None = None, + can_transfer_stars: bool | None = None, + can_manage_stories: bool | None = None, + can_delete_outgoing_messages: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/business_connection.py b/aiogram/types/business_connection.py index d8f76256..65597f4b 100644 --- a/aiogram/types/business_connection.py +++ b/aiogram/types/business_connection.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -29,9 +29,9 @@ class BusinessConnection(TelegramObject): """Date the connection was established in Unix time""" is_enabled: bool """:code:`True`, if the connection is active""" - rights: Optional[BusinessBotRights] = None + rights: BusinessBotRights | None = None """*Optional*. Rights of the business bot""" - can_reply: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + can_reply: bool | None = Field(None, json_schema_extra={"deprecated": True}) """True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours .. deprecated:: API:9.0 @@ -49,8 +49,8 @@ class BusinessConnection(TelegramObject): user_chat_id: int, date: DateTime, is_enabled: bool, - rights: Optional[BusinessBotRights] = None, - can_reply: Optional[bool] = None, + rights: BusinessBotRights | None = None, + can_reply: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/business_intro.py b/aiogram/types/business_intro.py index c360fbe9..80b40204 100644 --- a/aiogram/types/business_intro.py +++ b/aiogram/types/business_intro.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -15,11 +15,11 @@ class BusinessIntro(TelegramObject): Source: https://core.telegram.org/bots/api#businessintro """ - title: Optional[str] = None + title: str | None = None """*Optional*. Title text of the business intro""" - message: Optional[str] = None + message: str | None = None """*Optional*. Message text of the business intro""" - sticker: Optional[Sticker] = None + sticker: Sticker | None = None """*Optional*. Sticker of the business intro""" if TYPE_CHECKING: @@ -29,9 +29,9 @@ class BusinessIntro(TelegramObject): def __init__( __pydantic__self__, *, - title: Optional[str] = None, - message: Optional[str] = None, - sticker: Optional[Sticker] = None, + title: str | None = None, + message: str | None = None, + sticker: Sticker | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/business_location.py b/aiogram/types/business_location.py index af7989a0..421259db 100644 --- a/aiogram/types/business_location.py +++ b/aiogram/types/business_location.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -17,7 +17,7 @@ class BusinessLocation(TelegramObject): address: str """Address of the business""" - location: Optional[Location] = None + location: Location | None = None """*Optional*. Location of the business""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class BusinessLocation(TelegramObject): __pydantic__self__, *, address: str, - location: Optional[Location] = None, + location: Location | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/callback_query.py b/aiogram/types/callback_query.py index d976c1b8..1ccbb753 100644 --- a/aiogram/types/callback_query.py +++ b/aiogram/types/callback_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -27,13 +27,13 @@ class CallbackQuery(TelegramObject): """Sender""" chat_instance: str """Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in :class:`aiogram.methods.games.Games`.""" - message: Optional[MaybeInaccessibleMessageUnion] = None + message: MaybeInaccessibleMessageUnion | None = None """*Optional*. Message sent by the bot with the callback button that originated the query""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """*Optional*. Identifier of the message sent via the bot in inline mode, that originated the query.""" - data: Optional[str] = None + data: str | None = None """*Optional*. Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data.""" - game_short_name: Optional[str] = None + game_short_name: str | None = None """*Optional*. Short name of a `Game `_ to be returned, serves as the unique identifier for the game""" if TYPE_CHECKING: @@ -46,10 +46,10 @@ class CallbackQuery(TelegramObject): id: str, from_user: User, chat_instance: str, - message: Optional[MaybeInaccessibleMessageUnion] = None, - inline_message_id: Optional[str] = None, - data: Optional[str] = None, - game_short_name: Optional[str] = None, + message: MaybeInaccessibleMessageUnion | None = None, + inline_message_id: str | None = None, + data: str | None = None, + game_short_name: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -69,10 +69,10 @@ class CallbackQuery(TelegramObject): def answer( self, - text: Optional[str] = None, - show_alert: Optional[bool] = None, - url: Optional[str] = None, - cache_time: Optional[int] = None, + text: str | None = None, + show_alert: bool | None = None, + url: str | None = None, + cache_time: int | None = None, **kwargs: Any, ) -> AnswerCallbackQuery: """ diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py index 8d0377ed..bea95afb 100644 --- a/aiogram/types/chat.py +++ b/aiogram/types/chat.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -62,207 +62,203 @@ class Chat(TelegramObject): """Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.""" type: str """Type of the chat, can be either 'private', 'group', 'supergroup' or 'channel'""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title, for supergroups, channels and group chats""" - username: Optional[str] = None + username: str | None = None """*Optional*. Username, for private chats, supergroups and channels if available""" - first_name: Optional[str] = None + first_name: str | None = None """*Optional*. First name of the other party in a private chat""" - last_name: Optional[str] = None + last_name: str | None = None """*Optional*. Last name of the other party in a private chat""" - is_forum: Optional[bool] = None + is_forum: bool | None = None """*Optional*. :code:`True`, if the supergroup chat is a forum (has `topics `_ enabled)""" - is_direct_messages: Optional[bool] = None + is_direct_messages: bool | None = None """*Optional*. :code:`True`, if the chat is the direct messages chat of a channel""" - accent_color_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + accent_color_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See `accent colors `_ for more details. Returned only in :class:`aiogram.methods.get_chat.GetChat`. Always returned in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - active_usernames: Optional[list[str]] = Field(None, json_schema_extra={"deprecated": True}) + active_usernames: list[str] | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. If non-empty, the list of all `active chat usernames `_; for private chats, supergroups and channels. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - available_reactions: Optional[list[ReactionTypeUnion]] = Field( + available_reactions: list[ReactionTypeUnion] | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions `_ are allowed. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - background_custom_emoji_id: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + background_custom_emoji_id: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - bio: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + bio: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Bio of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - birthdate: Optional[Birthdate] = Field(None, json_schema_extra={"deprecated": True}) + birthdate: Birthdate | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For private chats, the date of birth of the user. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - business_intro: Optional[BusinessIntro] = Field(None, json_schema_extra={"deprecated": True}) + business_intro: BusinessIntro | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For private chats with business accounts, the intro of the business. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - business_location: Optional[BusinessLocation] = Field( + business_location: BusinessLocation | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional*. For private chats with business accounts, the location of the business. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - business_opening_hours: Optional[BusinessOpeningHours] = Field( + business_opening_hours: BusinessOpeningHours | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional*. For private chats with business accounts, the opening hours of the business. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - can_set_sticker_set: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + can_set_sticker_set: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if the bot can change the group sticker set. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - custom_emoji_sticker_set_name: Optional[str] = Field( - None, json_schema_extra={"deprecated": True} - ) + custom_emoji_sticker_set_name: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - description: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + description: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Description, for groups, supergroups and channel chats. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - emoji_status_custom_emoji_id: Optional[str] = Field( - None, json_schema_extra={"deprecated": True} - ) + emoji_status_custom_emoji_id: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - emoji_status_expiration_date: Optional[DateTime] = Field( + emoji_status_expiration_date: DateTime | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional*. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - has_aggressive_anti_spam_enabled: Optional[bool] = Field( + has_aggressive_anti_spam_enabled: bool | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional*. :code:`True`, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - has_hidden_members: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + has_hidden_members: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if non-administrators can only get the list of bots and administrators in the chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - has_private_forwards: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + has_private_forwards: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if privacy settings of the other party in the private chat allows to use :code:`tg://user?id=` links only in chats with the user. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - has_protected_content: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + has_protected_content: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if messages from the chat can't be forwarded to other chats. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - has_restricted_voice_and_video_messages: Optional[bool] = Field( + has_restricted_voice_and_video_messages: bool | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional*. :code:`True`, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - has_visible_history: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + has_visible_history: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if new chat members will have access to old messages; available only to chat administrators. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - invite_link: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + invite_link: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Primary invite link, for groups, supergroups and channel chats. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - join_by_request: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + join_by_request: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - join_to_send_messages: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + join_to_send_messages: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if users need to join the supergroup before they can send messages. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - linked_chat_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + linked_chat_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - location: Optional[ChatLocation] = Field(None, json_schema_extra={"deprecated": True}) + location: ChatLocation | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For supergroups, the location to which the supergroup is connected. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - message_auto_delete_time: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + message_auto_delete_time: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - permissions: Optional[ChatPermissions] = Field(None, json_schema_extra={"deprecated": True}) + permissions: ChatPermissions | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Default chat member permissions, for groups and supergroups. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - personal_chat: Optional[Chat] = Field(None, json_schema_extra={"deprecated": True}) + personal_chat: Chat | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For private chats, the personal channel of the user. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - photo: Optional[ChatPhoto] = Field(None, json_schema_extra={"deprecated": True}) + photo: ChatPhoto | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Chat photo. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - pinned_message: Optional[Message] = Field(None, json_schema_extra={"deprecated": True}) + pinned_message: Message | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. The most recent pinned message (by sending date). Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - profile_accent_color_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + profile_accent_color_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Identifier of the accent color for the chat's profile background. See `profile accent colors `_ for more details. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - profile_background_custom_emoji_id: Optional[str] = Field( + profile_background_custom_emoji_id: str | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional*. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - slow_mode_delay: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + slow_mode_delay: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - sticker_set_name: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + sticker_set_name: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For supergroups, name of group sticker set. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 https://core.telegram.org/bots/api-changelog#may-6-2024""" - unrestrict_boost_count: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + unrestrict_boost_count: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in :class:`aiogram.methods.get_chat.GetChat`. .. deprecated:: API:7.3 @@ -277,47 +273,47 @@ class Chat(TelegramObject): *, id: int, type: str, - title: Optional[str] = None, - username: Optional[str] = None, - first_name: Optional[str] = None, - last_name: Optional[str] = None, - is_forum: Optional[bool] = None, - is_direct_messages: Optional[bool] = None, - accent_color_id: Optional[int] = None, - active_usernames: Optional[list[str]] = None, - available_reactions: Optional[list[ReactionTypeUnion]] = None, - background_custom_emoji_id: Optional[str] = None, - bio: Optional[str] = None, - birthdate: Optional[Birthdate] = None, - business_intro: Optional[BusinessIntro] = None, - business_location: Optional[BusinessLocation] = None, - business_opening_hours: Optional[BusinessOpeningHours] = None, - can_set_sticker_set: Optional[bool] = None, - custom_emoji_sticker_set_name: Optional[str] = None, - description: Optional[str] = None, - emoji_status_custom_emoji_id: Optional[str] = None, - emoji_status_expiration_date: Optional[DateTime] = None, - has_aggressive_anti_spam_enabled: Optional[bool] = None, - has_hidden_members: Optional[bool] = None, - has_private_forwards: Optional[bool] = None, - has_protected_content: Optional[bool] = None, - has_restricted_voice_and_video_messages: Optional[bool] = None, - has_visible_history: Optional[bool] = None, - invite_link: Optional[str] = None, - join_by_request: Optional[bool] = None, - join_to_send_messages: Optional[bool] = None, - linked_chat_id: Optional[int] = None, - location: Optional[ChatLocation] = None, - message_auto_delete_time: Optional[int] = None, - permissions: Optional[ChatPermissions] = None, - personal_chat: Optional[Chat] = None, - photo: Optional[ChatPhoto] = None, - pinned_message: Optional[Message] = None, - profile_accent_color_id: Optional[int] = None, - profile_background_custom_emoji_id: Optional[str] = None, - slow_mode_delay: Optional[int] = None, - sticker_set_name: Optional[str] = None, - unrestrict_boost_count: Optional[int] = None, + title: str | None = None, + username: str | None = None, + first_name: str | None = None, + last_name: str | None = None, + is_forum: bool | None = None, + is_direct_messages: bool | None = None, + accent_color_id: int | None = None, + active_usernames: list[str] | None = None, + available_reactions: list[ReactionTypeUnion] | None = None, + background_custom_emoji_id: str | None = None, + bio: str | None = None, + birthdate: Birthdate | None = None, + business_intro: BusinessIntro | None = None, + business_location: BusinessLocation | None = None, + business_opening_hours: BusinessOpeningHours | None = None, + can_set_sticker_set: bool | None = None, + custom_emoji_sticker_set_name: str | None = None, + description: str | None = None, + emoji_status_custom_emoji_id: str | None = None, + emoji_status_expiration_date: DateTime | None = None, + has_aggressive_anti_spam_enabled: bool | None = None, + has_hidden_members: bool | None = None, + has_private_forwards: bool | None = None, + has_protected_content: bool | None = None, + has_restricted_voice_and_video_messages: bool | None = None, + has_visible_history: bool | None = None, + invite_link: str | None = None, + join_by_request: bool | None = None, + join_to_send_messages: bool | None = None, + linked_chat_id: int | None = None, + location: ChatLocation | None = None, + message_auto_delete_time: int | None = None, + permissions: ChatPermissions | None = None, + personal_chat: Chat | None = None, + photo: ChatPhoto | None = None, + pinned_message: Message | None = None, + profile_accent_color_id: int | None = None, + profile_background_custom_emoji_id: str | None = None, + slow_mode_delay: int | None = None, + sticker_set_name: str | None = None, + unrestrict_boost_count: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -567,10 +563,10 @@ class Chat(TelegramObject): def edit_invite_link( self, invite_link: str, - name: Optional[str] = None, - expire_date: Optional[DateTimeUnion] = None, - member_limit: Optional[int] = None, - creates_join_request: Optional[bool] = None, + name: str | None = None, + expire_date: DateTimeUnion | None = None, + member_limit: int | None = None, + creates_join_request: bool | None = None, **kwargs: Any, ) -> EditChatInviteLink: """ @@ -607,10 +603,10 @@ class Chat(TelegramObject): def create_invite_link( self, - name: Optional[str] = None, - expire_date: Optional[DateTimeUnion] = None, - member_limit: Optional[int] = None, - creates_join_request: Optional[bool] = None, + name: str | None = None, + expire_date: DateTimeUnion | None = None, + member_limit: int | None = None, + creates_join_request: bool | None = None, **kwargs: Any, ) -> CreateChatInviteLink: """ @@ -674,8 +670,8 @@ class Chat(TelegramObject): def do( self, action: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, **kwargs: Any, ) -> SendChatAction: """ @@ -874,8 +870,8 @@ class Chat(TelegramObject): def unpin_message( self, - business_connection_id: Optional[str] = None, - message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_id: int | None = None, **kwargs: Any, ) -> UnpinChatMessage: """ @@ -907,8 +903,8 @@ class Chat(TelegramObject): def pin_message( self, message_id: int, - business_connection_id: Optional[str] = None, - disable_notification: Optional[bool] = None, + business_connection_id: str | None = None, + disable_notification: bool | None = None, **kwargs: Any, ) -> PinChatMessage: """ @@ -974,7 +970,7 @@ class Chat(TelegramObject): def set_permissions( self, permissions: ChatPermissions, - use_independent_chat_permissions: Optional[bool] = None, + use_independent_chat_permissions: bool | None = None, **kwargs: Any, ) -> SetChatPermissions: """ @@ -1006,22 +1002,22 @@ class Chat(TelegramObject): def promote( self, user_id: int, - is_anonymous: Optional[bool] = None, - can_manage_chat: Optional[bool] = None, - can_delete_messages: Optional[bool] = None, - can_manage_video_chats: Optional[bool] = None, - can_restrict_members: Optional[bool] = None, - can_promote_members: Optional[bool] = None, - can_change_info: Optional[bool] = None, - can_invite_users: Optional[bool] = None, - can_post_stories: Optional[bool] = None, - can_edit_stories: Optional[bool] = None, - can_delete_stories: Optional[bool] = None, - can_post_messages: Optional[bool] = None, - can_edit_messages: Optional[bool] = None, - can_pin_messages: Optional[bool] = None, - can_manage_topics: Optional[bool] = None, - can_manage_direct_messages: Optional[bool] = None, + is_anonymous: bool | None = None, + can_manage_chat: bool | None = None, + can_delete_messages: bool | None = None, + can_manage_video_chats: bool | None = None, + can_restrict_members: bool | None = None, + can_promote_members: bool | None = None, + can_change_info: bool | None = None, + can_invite_users: bool | None = None, + can_post_stories: bool | None = None, + can_edit_stories: bool | None = None, + can_delete_stories: bool | None = None, + can_post_messages: bool | None = None, + can_edit_messages: bool | None = None, + can_pin_messages: bool | None = None, + can_manage_topics: bool | None = None, + can_manage_direct_messages: bool | None = None, **kwargs: Any, ) -> PromoteChatMember: """ @@ -1084,8 +1080,8 @@ class Chat(TelegramObject): self, user_id: int, permissions: ChatPermissions, - use_independent_chat_permissions: Optional[bool] = None, - until_date: Optional[DateTimeUnion] = None, + use_independent_chat_permissions: bool | None = None, + until_date: DateTimeUnion | None = None, **kwargs: Any, ) -> RestrictChatMember: """ @@ -1121,7 +1117,7 @@ class Chat(TelegramObject): def unban( self, user_id: int, - only_if_banned: Optional[bool] = None, + only_if_banned: bool | None = None, **kwargs: Any, ) -> UnbanChatMember: """ @@ -1153,8 +1149,8 @@ class Chat(TelegramObject): def ban( self, user_id: int, - until_date: Optional[DateTimeUnion] = None, - revoke_messages: Optional[bool] = None, + until_date: DateTimeUnion | None = None, + revoke_messages: bool | None = None, **kwargs: Any, ) -> BanChatMember: """ @@ -1187,7 +1183,7 @@ class Chat(TelegramObject): def set_description( self, - description: Optional[str] = None, + description: str | None = None, **kwargs: Any, ) -> SetChatDescription: """ diff --git a/aiogram/types/chat_administrator_rights.py b/aiogram/types/chat_administrator_rights.py index a822fdf2..cac9ae01 100644 --- a/aiogram/types/chat_administrator_rights.py +++ b/aiogram/types/chat_administrator_rights.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -37,15 +37,15 @@ class ChatAdministratorRights(TelegramObject): """:code:`True`, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive""" can_delete_stories: bool """:code:`True`, if the administrator can delete stories posted by other users""" - can_post_messages: Optional[bool] = None + can_post_messages: bool | None = None """*Optional*. :code:`True`, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only""" - can_edit_messages: Optional[bool] = None + can_edit_messages: bool | None = None """*Optional*. :code:`True`, if the administrator can edit messages of other users and can pin messages; for channels only""" - can_pin_messages: Optional[bool] = None + can_pin_messages: bool | None = None """*Optional*. :code:`True`, if the user is allowed to pin messages; for groups and supergroups only""" - can_manage_topics: Optional[bool] = None + can_manage_topics: bool | None = None """*Optional*. :code:`True`, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only""" - can_manage_direct_messages: Optional[bool] = None + can_manage_direct_messages: bool | None = None """*Optional*. :code:`True`, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only""" if TYPE_CHECKING: @@ -66,11 +66,11 @@ class ChatAdministratorRights(TelegramObject): can_post_stories: bool, can_edit_stories: bool, can_delete_stories: bool, - can_post_messages: Optional[bool] = None, - can_edit_messages: Optional[bool] = None, - can_pin_messages: Optional[bool] = None, - can_manage_topics: Optional[bool] = None, - can_manage_direct_messages: Optional[bool] = None, + can_post_messages: bool | None = None, + can_edit_messages: bool | None = None, + can_pin_messages: bool | None = None, + can_manage_topics: bool | None = None, + can_manage_direct_messages: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_boost_source_giveaway.py b/aiogram/types/chat_boost_source_giveaway.py index a1babf0d..89b1d675 100644 --- a/aiogram/types/chat_boost_source_giveaway.py +++ b/aiogram/types/chat_boost_source_giveaway.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import ChatBoostSourceType from .chat_boost_source import ChatBoostSource @@ -20,11 +20,11 @@ class ChatBoostSourceGiveaway(ChatBoostSource): """Source of the boost, always 'giveaway'""" giveaway_message_id: int """Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet.""" - user: Optional[User] = None + user: User | None = None """*Optional*. User that won the prize in the giveaway if any; for Telegram Premium giveaways only""" - prize_star_count: Optional[int] = None + prize_star_count: int | None = None """*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only""" - is_unclaimed: Optional[bool] = None + is_unclaimed: bool | None = None """*Optional*. :code:`True`, if the giveaway was completed, but there was no user to win the prize""" if TYPE_CHECKING: @@ -36,9 +36,9 @@ class ChatBoostSourceGiveaway(ChatBoostSource): *, source: Literal[ChatBoostSourceType.GIVEAWAY] = ChatBoostSourceType.GIVEAWAY, giveaway_message_id: int, - user: Optional[User] = None, - prize_star_count: Optional[int] = None, - is_unclaimed: Optional[bool] = None, + user: User | None = None, + prize_star_count: int | None = None, + is_unclaimed: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_boost_source_union.py b/aiogram/types/chat_boost_source_union.py index 8b69aa66..0fb9e73c 100644 --- a/aiogram/types/chat_boost_source_union.py +++ b/aiogram/types/chat_boost_source_union.py @@ -1,11 +1,11 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .chat_boost_source_gift_code import ChatBoostSourceGiftCode from .chat_boost_source_giveaway import ChatBoostSourceGiveaway from .chat_boost_source_premium import ChatBoostSourcePremium -ChatBoostSourceUnion = Union[ - ChatBoostSourcePremium, ChatBoostSourceGiftCode, ChatBoostSourceGiveaway -] +ChatBoostSourceUnion: TypeAlias = ( + ChatBoostSourcePremium | ChatBoostSourceGiftCode | ChatBoostSourceGiveaway +) diff --git a/aiogram/types/chat_full_info.py b/aiogram/types/chat_full_info.py index 327d1a98..9505aebf 100644 --- a/aiogram/types/chat_full_info.py +++ b/aiogram/types/chat_full_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -39,97 +39,97 @@ class ChatFullInfo(Chat): """The maximum number of reactions that can be set on a message in the chat""" accepted_gift_types: AcceptedGiftTypes """Information about types of gifts that are accepted by the chat or by the corresponding user for private chats""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title, for supergroups, channels and group chats""" - username: Optional[str] = None + username: str | None = None """*Optional*. Username, for private chats, supergroups and channels if available""" - first_name: Optional[str] = None + first_name: str | None = None """*Optional*. First name of the other party in a private chat""" - last_name: Optional[str] = None + last_name: str | None = None """*Optional*. Last name of the other party in a private chat""" - is_forum: Optional[bool] = None + is_forum: bool | None = None """*Optional*. :code:`True`, if the supergroup chat is a forum (has `topics `_ enabled)""" - is_direct_messages: Optional[bool] = None + is_direct_messages: bool | None = None """*Optional*. :code:`True`, if the chat is the direct messages chat of a channel""" - photo: Optional[ChatPhoto] = None + photo: ChatPhoto | None = None """*Optional*. Chat photo""" - active_usernames: Optional[list[str]] = None + active_usernames: list[str] | None = None """*Optional*. If non-empty, the list of all `active chat usernames `_; for private chats, supergroups and channels""" - birthdate: Optional[Birthdate] = None + birthdate: Birthdate | None = None """*Optional*. For private chats, the date of birth of the user""" - business_intro: Optional[BusinessIntro] = None + business_intro: BusinessIntro | None = None """*Optional*. For private chats with business accounts, the intro of the business""" - business_location: Optional[BusinessLocation] = None + business_location: BusinessLocation | None = None """*Optional*. For private chats with business accounts, the location of the business""" - business_opening_hours: Optional[BusinessOpeningHours] = None + business_opening_hours: BusinessOpeningHours | None = None """*Optional*. For private chats with business accounts, the opening hours of the business""" - personal_chat: Optional[Chat] = None + personal_chat: Chat | None = None """*Optional*. For private chats, the personal channel of the user""" - parent_chat: Optional[Chat] = None + parent_chat: Chat | None = None """*Optional*. Information about the corresponding channel chat; for direct messages chats only""" - available_reactions: Optional[list[ReactionTypeUnion]] = None + available_reactions: list[ReactionTypeUnion] | None = None """*Optional*. List of available reactions allowed in the chat. If omitted, then all `emoji reactions `_ are allowed.""" - background_custom_emoji_id: Optional[str] = None + background_custom_emoji_id: str | None = None """*Optional*. Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background""" - profile_accent_color_id: Optional[int] = None + profile_accent_color_id: int | None = None """*Optional*. Identifier of the accent color for the chat's profile background. See `profile accent colors `_ for more details.""" - profile_background_custom_emoji_id: Optional[str] = None + profile_background_custom_emoji_id: str | None = None """*Optional*. Custom emoji identifier of the emoji chosen by the chat for its profile background""" - emoji_status_custom_emoji_id: Optional[str] = None + emoji_status_custom_emoji_id: str | None = None """*Optional*. Custom emoji identifier of the emoji status of the chat or the other party in a private chat""" - emoji_status_expiration_date: Optional[DateTime] = None + emoji_status_expiration_date: DateTime | None = None """*Optional*. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any""" - bio: Optional[str] = None + bio: str | None = None """*Optional*. Bio of the other party in a private chat""" - has_private_forwards: Optional[bool] = None + has_private_forwards: bool | None = None """*Optional*. :code:`True`, if privacy settings of the other party in the private chat allows to use :code:`tg://user?id=` links only in chats with the user""" - has_restricted_voice_and_video_messages: Optional[bool] = None + has_restricted_voice_and_video_messages: bool | None = None """*Optional*. :code:`True`, if the privacy settings of the other party restrict sending voice and video note messages in the private chat""" - join_to_send_messages: Optional[bool] = None + join_to_send_messages: bool | None = None """*Optional*. :code:`True`, if users need to join the supergroup before they can send messages""" - join_by_request: Optional[bool] = None + join_by_request: bool | None = None """*Optional*. :code:`True`, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators""" - description: Optional[str] = None + description: str | None = None """*Optional*. Description, for groups, supergroups and channel chats""" - invite_link: Optional[str] = None + invite_link: str | None = None """*Optional*. Primary invite link, for groups, supergroups and channel chats""" - pinned_message: Optional[Message] = None + pinned_message: Message | None = None """*Optional*. The most recent pinned message (by sending date)""" - permissions: Optional[ChatPermissions] = None + permissions: ChatPermissions | None = None """*Optional*. Default chat member permissions, for groups and supergroups""" - can_send_paid_media: Optional[bool] = None + can_send_paid_media: bool | None = None """*Optional*. :code:`True`, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.""" - slow_mode_delay: Optional[int] = None + slow_mode_delay: int | None = None """*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds""" - unrestrict_boost_count: Optional[int] = None + unrestrict_boost_count: int | None = None """*Optional*. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions""" - message_auto_delete_time: Optional[int] = None + message_auto_delete_time: int | None = None """*Optional*. The time after which all messages sent to the chat will be automatically deleted; in seconds""" - has_aggressive_anti_spam_enabled: Optional[bool] = None + has_aggressive_anti_spam_enabled: bool | None = None """*Optional*. :code:`True`, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators.""" - has_hidden_members: Optional[bool] = None + has_hidden_members: bool | None = None """*Optional*. :code:`True`, if non-administrators can only get the list of bots and administrators in the chat""" - has_protected_content: Optional[bool] = None + has_protected_content: bool | None = None """*Optional*. :code:`True`, if messages from the chat can't be forwarded to other chats""" - has_visible_history: Optional[bool] = None + has_visible_history: bool | None = None """*Optional*. :code:`True`, if new chat members will have access to old messages; available only to chat administrators""" - sticker_set_name: Optional[str] = None + sticker_set_name: str | None = None """*Optional*. For supergroups, name of the group sticker set""" - can_set_sticker_set: Optional[bool] = None + can_set_sticker_set: bool | None = None """*Optional*. :code:`True`, if the bot can change the group sticker set""" - custom_emoji_sticker_set_name: Optional[str] = None + custom_emoji_sticker_set_name: str | None = None """*Optional*. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.""" - linked_chat_id: Optional[int] = None + linked_chat_id: int | None = None """*Optional*. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.""" - location: Optional[ChatLocation] = None + location: ChatLocation | None = None """*Optional*. For supergroups, the location to which the supergroup is connected""" - rating: Optional[UserRating] = None + rating: UserRating | None = None """*Optional*. For private chats, the rating of the user if any""" - unique_gift_colors: Optional[UniqueGiftColors] = None + unique_gift_colors: UniqueGiftColors | None = None """*Optional*. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews""" - paid_message_star_count: Optional[int] = None + paid_message_star_count: int | None = None """*Optional*. The number of Telegram Stars a general user have to pay to send a message to the chat""" - can_send_gift: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + can_send_gift: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. :code:`True`, if gifts can be sent to the chat .. deprecated:: API:9.0 @@ -147,52 +147,52 @@ class ChatFullInfo(Chat): accent_color_id: int, max_reaction_count: int, accepted_gift_types: AcceptedGiftTypes, - title: Optional[str] = None, - username: Optional[str] = None, - first_name: Optional[str] = None, - last_name: Optional[str] = None, - is_forum: Optional[bool] = None, - is_direct_messages: Optional[bool] = None, - photo: Optional[ChatPhoto] = None, - active_usernames: Optional[list[str]] = None, - birthdate: Optional[Birthdate] = None, - business_intro: Optional[BusinessIntro] = None, - business_location: Optional[BusinessLocation] = None, - business_opening_hours: Optional[BusinessOpeningHours] = None, - personal_chat: Optional[Chat] = None, - parent_chat: Optional[Chat] = None, - available_reactions: Optional[list[ReactionTypeUnion]] = None, - background_custom_emoji_id: Optional[str] = None, - profile_accent_color_id: Optional[int] = None, - profile_background_custom_emoji_id: Optional[str] = None, - emoji_status_custom_emoji_id: Optional[str] = None, - emoji_status_expiration_date: Optional[DateTime] = None, - bio: Optional[str] = None, - has_private_forwards: Optional[bool] = None, - has_restricted_voice_and_video_messages: Optional[bool] = None, - join_to_send_messages: Optional[bool] = None, - join_by_request: Optional[bool] = None, - description: Optional[str] = None, - invite_link: Optional[str] = None, - pinned_message: Optional[Message] = None, - permissions: Optional[ChatPermissions] = None, - can_send_paid_media: Optional[bool] = None, - slow_mode_delay: Optional[int] = None, - unrestrict_boost_count: Optional[int] = None, - message_auto_delete_time: Optional[int] = None, - has_aggressive_anti_spam_enabled: Optional[bool] = None, - has_hidden_members: Optional[bool] = None, - has_protected_content: Optional[bool] = None, - has_visible_history: Optional[bool] = None, - sticker_set_name: Optional[str] = None, - can_set_sticker_set: Optional[bool] = None, - custom_emoji_sticker_set_name: Optional[str] = None, - linked_chat_id: Optional[int] = None, - location: Optional[ChatLocation] = None, - rating: Optional[UserRating] = None, - unique_gift_colors: Optional[UniqueGiftColors] = None, - paid_message_star_count: Optional[int] = None, - can_send_gift: Optional[bool] = None, + title: str | None = None, + username: str | None = None, + first_name: str | None = None, + last_name: str | None = None, + is_forum: bool | None = None, + is_direct_messages: bool | None = None, + photo: ChatPhoto | None = None, + active_usernames: list[str] | None = None, + birthdate: Birthdate | None = None, + business_intro: BusinessIntro | None = None, + business_location: BusinessLocation | None = None, + business_opening_hours: BusinessOpeningHours | None = None, + personal_chat: Chat | None = None, + parent_chat: Chat | None = None, + available_reactions: list[ReactionTypeUnion] | None = None, + background_custom_emoji_id: str | None = None, + profile_accent_color_id: int | None = None, + profile_background_custom_emoji_id: str | None = None, + emoji_status_custom_emoji_id: str | None = None, + emoji_status_expiration_date: DateTime | None = None, + bio: str | None = None, + has_private_forwards: bool | None = None, + has_restricted_voice_and_video_messages: bool | None = None, + join_to_send_messages: bool | None = None, + join_by_request: bool | None = None, + description: str | None = None, + invite_link: str | None = None, + pinned_message: Message | None = None, + permissions: ChatPermissions | None = None, + can_send_paid_media: bool | None = None, + slow_mode_delay: int | None = None, + unrestrict_boost_count: int | None = None, + message_auto_delete_time: int | None = None, + has_aggressive_anti_spam_enabled: bool | None = None, + has_hidden_members: bool | None = None, + has_protected_content: bool | None = None, + has_visible_history: bool | None = None, + sticker_set_name: str | None = None, + can_set_sticker_set: bool | None = None, + custom_emoji_sticker_set_name: str | None = None, + linked_chat_id: int | None = None, + location: ChatLocation | None = None, + rating: UserRating | None = None, + unique_gift_colors: UniqueGiftColors | None = None, + paid_message_star_count: int | None = None, + can_send_gift: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_id_union.py b/aiogram/types/chat_id_union.py index 1ed35693..c5ec3c33 100644 --- a/aiogram/types/chat_id_union.py +++ b/aiogram/types/chat_id_union.py @@ -1,5 +1,5 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias -ChatIdUnion = Union[int, str] +ChatIdUnion: TypeAlias = int | str diff --git a/aiogram/types/chat_invite_link.py b/aiogram/types/chat_invite_link.py index be495a5b..3761e464 100644 --- a/aiogram/types/chat_invite_link.py +++ b/aiogram/types/chat_invite_link.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject from .custom import DateTime @@ -26,17 +26,17 @@ class ChatInviteLink(TelegramObject): """:code:`True`, if the link is primary""" is_revoked: bool """:code:`True`, if the link is revoked""" - name: Optional[str] = None + name: str | None = None """*Optional*. Invite link name""" - expire_date: Optional[DateTime] = None + expire_date: DateTime | None = None """*Optional*. Point in time (Unix timestamp) when the link will expire or has been expired""" - member_limit: Optional[int] = None + member_limit: int | None = None """*Optional*. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999""" - pending_join_request_count: Optional[int] = None + pending_join_request_count: int | None = None """*Optional*. Number of pending join requests created using this link""" - subscription_period: Optional[int] = None + subscription_period: int | None = None """*Optional*. The number of seconds the subscription will be active for before the next payment""" - subscription_price: Optional[int] = None + subscription_price: int | None = None """*Optional*. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link""" if TYPE_CHECKING: @@ -51,12 +51,12 @@ class ChatInviteLink(TelegramObject): creates_join_request: bool, is_primary: bool, is_revoked: bool, - name: Optional[str] = None, - expire_date: Optional[DateTime] = None, - member_limit: Optional[int] = None, - pending_join_request_count: Optional[int] = None, - subscription_period: Optional[int] = None, - subscription_price: Optional[int] = None, + name: str | None = None, + expire_date: DateTime | None = None, + member_limit: int | None = None, + pending_join_request_count: int | None = None, + subscription_period: int | None = None, + subscription_price: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_join_request.py b/aiogram/types/chat_join_request.py index 6910eb84..899e567b 100644 --- a/aiogram/types/chat_join_request.py +++ b/aiogram/types/chat_join_request.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -62,9 +62,9 @@ class ChatJoinRequest(TelegramObject): """Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.""" date: DateTime """Date the request was sent in Unix time""" - bio: Optional[str] = None + bio: str | None = None """*Optional*. Bio of the user.""" - invite_link: Optional[ChatInviteLink] = None + invite_link: ChatInviteLink | None = None """*Optional*. Chat invite link that was used by the user to send the join request""" if TYPE_CHECKING: @@ -78,8 +78,8 @@ class ChatJoinRequest(TelegramObject): from_user: User, user_chat_id: int, date: DateTime, - bio: Optional[str] = None, - invite_link: Optional[ChatInviteLink] = None, + bio: str | None = None, + invite_link: ChatInviteLink | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -155,26 +155,22 @@ class ChatJoinRequest(TelegramObject): def answer( self, text: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMessage: """ @@ -236,26 +232,22 @@ class ChatJoinRequest(TelegramObject): def answer_pm( self, text: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMessage: """ @@ -317,29 +309,27 @@ class ChatJoinRequest(TelegramObject): def answer_animation( self, animation: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAnimation: """ @@ -411,29 +401,27 @@ class ChatJoinRequest(TelegramObject): def answer_animation_pm( self, animation: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAnimation: """ @@ -505,25 +493,25 @@ class ChatJoinRequest(TelegramObject): def answer_audio( self, audio: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAudio: """ @@ -592,25 +580,25 @@ class ChatJoinRequest(TelegramObject): def answer_audio_pm( self, audio: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAudio: """ @@ -680,20 +668,20 @@ class ChatJoinRequest(TelegramObject): self, phone_number: str, first_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendContact: """ @@ -754,20 +742,20 @@ class ChatJoinRequest(TelegramObject): self, phone_number: str, first_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendContact: """ @@ -827,23 +815,23 @@ class ChatJoinRequest(TelegramObject): def answer_document( self, document: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDocument: """ @@ -907,23 +895,23 @@ class ChatJoinRequest(TelegramObject): def answer_document_pm( self, document: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDocument: """ @@ -987,16 +975,16 @@ class ChatJoinRequest(TelegramObject): def answer_game( self, game_short_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendGame: """ @@ -1046,16 +1034,16 @@ class ChatJoinRequest(TelegramObject): def answer_game_pm( self, game_short_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendGame: """ @@ -1109,33 +1097,33 @@ class ChatJoinRequest(TelegramObject): payload: str, currency: str, prices: list[LabeledPrice], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendInvoice: """ @@ -1231,33 +1219,33 @@ class ChatJoinRequest(TelegramObject): payload: str, currency: str, prices: list[LabeledPrice], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendInvoice: """ @@ -1350,22 +1338,22 @@ class ChatJoinRequest(TelegramObject): self, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendLocation: """ @@ -1430,22 +1418,22 @@ class ChatJoinRequest(TelegramObject): self, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendLocation: """ @@ -1509,16 +1497,16 @@ class ChatJoinRequest(TelegramObject): def answer_media_group( self, media: list[MediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMediaGroup: """ @@ -1568,16 +1556,16 @@ class ChatJoinRequest(TelegramObject): def answer_media_group_pm( self, media: list[MediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMediaGroup: """ @@ -1627,25 +1615,23 @@ class ChatJoinRequest(TelegramObject): def answer_photo( self, photo: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPhoto: """ @@ -1709,25 +1695,23 @@ class ChatJoinRequest(TelegramObject): def answer_photo_pm( self, photo: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPhoto: """ @@ -1792,28 +1776,28 @@ class ChatJoinRequest(TelegramObject): self, question: str, options: list[InputPollOptionUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPoll: """ @@ -1890,28 +1874,28 @@ class ChatJoinRequest(TelegramObject): self, question: str, options: list[InputPollOptionUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPoll: """ @@ -1986,19 +1970,19 @@ class ChatJoinRequest(TelegramObject): def answer_dice( self, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDice: """ @@ -2051,19 +2035,19 @@ class ChatJoinRequest(TelegramObject): def answer_dice_pm( self, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDice: """ @@ -2117,19 +2101,19 @@ class ChatJoinRequest(TelegramObject): def answer_sticker( self, sticker: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendSticker: """ @@ -2185,19 +2169,19 @@ class ChatJoinRequest(TelegramObject): def answer_sticker_pm( self, sticker: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendSticker: """ @@ -2256,22 +2240,22 @@ class ChatJoinRequest(TelegramObject): longitude: float, title: str, address: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVenue: """ @@ -2342,22 +2326,22 @@ class ChatJoinRequest(TelegramObject): longitude: float, title: str, address: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVenue: """ @@ -2425,32 +2409,30 @@ class ChatJoinRequest(TelegramObject): def answer_video( self, video: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideo: """ @@ -2528,32 +2510,30 @@ class ChatJoinRequest(TelegramObject): def answer_video_pm( self, video: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideo: """ @@ -2631,21 +2611,21 @@ class ChatJoinRequest(TelegramObject): def answer_video_note( self, video_note: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideoNote: """ @@ -2705,21 +2685,21 @@ class ChatJoinRequest(TelegramObject): def answer_video_note_pm( self, video_note: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideoNote: """ @@ -2779,22 +2759,22 @@ class ChatJoinRequest(TelegramObject): def answer_voice( self, voice: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVoice: """ @@ -2856,22 +2836,22 @@ class ChatJoinRequest(TelegramObject): def answer_voice_pm( self, voice: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVoice: """ diff --git a/aiogram/types/chat_member_administrator.py b/aiogram/types/chat_member_administrator.py index 87846e8c..b24dece3 100644 --- a/aiogram/types/chat_member_administrator.py +++ b/aiogram/types/chat_member_administrator.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import ChatMemberStatus from .chat_member import ChatMember @@ -44,17 +44,17 @@ class ChatMemberAdministrator(ChatMember): """:code:`True`, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive""" can_delete_stories: bool """:code:`True`, if the administrator can delete stories posted by other users""" - can_post_messages: Optional[bool] = None + can_post_messages: bool | None = None """*Optional*. :code:`True`, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only""" - can_edit_messages: Optional[bool] = None + can_edit_messages: bool | None = None """*Optional*. :code:`True`, if the administrator can edit messages of other users and can pin messages; for channels only""" - can_pin_messages: Optional[bool] = None + can_pin_messages: bool | None = None """*Optional*. :code:`True`, if the user is allowed to pin messages; for groups and supergroups only""" - can_manage_topics: Optional[bool] = None + can_manage_topics: bool | None = None """*Optional*. :code:`True`, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only""" - can_manage_direct_messages: Optional[bool] = None + can_manage_direct_messages: bool | None = None """*Optional*. :code:`True`, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only""" - custom_title: Optional[str] = None + custom_title: str | None = None """*Optional*. Custom title for this user""" if TYPE_CHECKING: @@ -78,12 +78,12 @@ class ChatMemberAdministrator(ChatMember): can_post_stories: bool, can_edit_stories: bool, can_delete_stories: bool, - can_post_messages: Optional[bool] = None, - can_edit_messages: Optional[bool] = None, - can_pin_messages: Optional[bool] = None, - can_manage_topics: Optional[bool] = None, - can_manage_direct_messages: Optional[bool] = None, - custom_title: Optional[str] = None, + can_post_messages: bool | None = None, + can_edit_messages: bool | None = None, + can_pin_messages: bool | None = None, + can_manage_topics: bool | None = None, + can_manage_direct_messages: bool | None = None, + custom_title: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_member_member.py b/aiogram/types/chat_member_member.py index 12ef33e4..5b3ce5e0 100644 --- a/aiogram/types/chat_member_member.py +++ b/aiogram/types/chat_member_member.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import ChatMemberStatus from .chat_member import ChatMember @@ -21,7 +21,7 @@ class ChatMemberMember(ChatMember): """The member's status in the chat, always 'member'""" user: User """Information about the user""" - until_date: Optional[DateTime] = None + until_date: DateTime | None = None """*Optional*. Date when the user's subscription will expire; Unix time""" if TYPE_CHECKING: @@ -33,7 +33,7 @@ class ChatMemberMember(ChatMember): *, status: Literal[ChatMemberStatus.MEMBER] = ChatMemberStatus.MEMBER, user: User, - until_date: Optional[DateTime] = None, + until_date: DateTime | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_member_owner.py b/aiogram/types/chat_member_owner.py index 1429435e..c3f9ddf3 100644 --- a/aiogram/types/chat_member_owner.py +++ b/aiogram/types/chat_member_owner.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import ChatMemberStatus from .chat_member import ChatMember @@ -22,7 +22,7 @@ class ChatMemberOwner(ChatMember): """Information about the user""" is_anonymous: bool """:code:`True`, if the user's presence in the chat is hidden""" - custom_title: Optional[str] = None + custom_title: str | None = None """*Optional*. Custom title for this user""" if TYPE_CHECKING: @@ -35,7 +35,7 @@ class ChatMemberOwner(ChatMember): status: Literal[ChatMemberStatus.CREATOR] = ChatMemberStatus.CREATOR, user: User, is_anonymous: bool, - custom_title: Optional[str] = None, + custom_title: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_member_union.py b/aiogram/types/chat_member_union.py index 83289769..f8e4b769 100644 --- a/aiogram/types/chat_member_union.py +++ b/aiogram/types/chat_member_union.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .chat_member_administrator import ChatMemberAdministrator from .chat_member_banned import ChatMemberBanned @@ -9,11 +9,11 @@ from .chat_member_member import ChatMemberMember from .chat_member_owner import ChatMemberOwner from .chat_member_restricted import ChatMemberRestricted -ChatMemberUnion = Union[ - ChatMemberOwner, - ChatMemberAdministrator, - ChatMemberMember, - ChatMemberRestricted, - ChatMemberLeft, - ChatMemberBanned, -] +ChatMemberUnion: TypeAlias = ( + ChatMemberOwner + | ChatMemberAdministrator + | ChatMemberMember + | ChatMemberRestricted + | ChatMemberLeft + | ChatMemberBanned +) diff --git a/aiogram/types/chat_member_updated.py b/aiogram/types/chat_member_updated.py index 684db0f7..b693f491 100644 --- a/aiogram/types/chat_member_updated.py +++ b/aiogram/types/chat_member_updated.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -63,11 +63,11 @@ class ChatMemberUpdated(TelegramObject): """Previous information about the chat member""" new_chat_member: ChatMemberUnion """New information about the chat member""" - invite_link: Optional[ChatInviteLink] = None + invite_link: ChatInviteLink | None = None """*Optional*. Chat invite link, which was used by the user to join the chat; for joining by invite link events only.""" - via_join_request: Optional[bool] = None + via_join_request: bool | None = None """*Optional*. :code:`True`, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator""" - via_chat_folder_invite_link: Optional[bool] = None + via_chat_folder_invite_link: bool | None = None """*Optional*. :code:`True`, if the user joined the chat via a chat folder invite link""" if TYPE_CHECKING: @@ -82,9 +82,9 @@ class ChatMemberUpdated(TelegramObject): date: DateTime, old_chat_member: ChatMemberUnion, new_chat_member: ChatMemberUnion, - invite_link: Optional[ChatInviteLink] = None, - via_join_request: Optional[bool] = None, - via_chat_folder_invite_link: Optional[bool] = None, + invite_link: ChatInviteLink | None = None, + via_join_request: bool | None = None, + via_chat_folder_invite_link: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -106,26 +106,22 @@ class ChatMemberUpdated(TelegramObject): def answer( self, text: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMessage: """ @@ -187,29 +183,27 @@ class ChatMemberUpdated(TelegramObject): def answer_animation( self, animation: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAnimation: """ @@ -281,25 +275,25 @@ class ChatMemberUpdated(TelegramObject): def answer_audio( self, audio: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAudio: """ @@ -369,20 +363,20 @@ class ChatMemberUpdated(TelegramObject): self, phone_number: str, first_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendContact: """ @@ -442,23 +436,23 @@ class ChatMemberUpdated(TelegramObject): def answer_document( self, document: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDocument: """ @@ -522,16 +516,16 @@ class ChatMemberUpdated(TelegramObject): def answer_game( self, game_short_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendGame: """ @@ -585,33 +579,33 @@ class ChatMemberUpdated(TelegramObject): payload: str, currency: str, prices: list[LabeledPrice], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendInvoice: """ @@ -704,22 +698,22 @@ class ChatMemberUpdated(TelegramObject): self, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendLocation: """ @@ -783,16 +777,16 @@ class ChatMemberUpdated(TelegramObject): def answer_media_group( self, media: list[MediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMediaGroup: """ @@ -842,25 +836,23 @@ class ChatMemberUpdated(TelegramObject): def answer_photo( self, photo: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPhoto: """ @@ -925,28 +917,28 @@ class ChatMemberUpdated(TelegramObject): self, question: str, options: list[InputPollOptionUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPoll: """ @@ -1021,19 +1013,19 @@ class ChatMemberUpdated(TelegramObject): def answer_dice( self, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDice: """ @@ -1087,19 +1079,19 @@ class ChatMemberUpdated(TelegramObject): def answer_sticker( self, sticker: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendSticker: """ @@ -1158,22 +1150,22 @@ class ChatMemberUpdated(TelegramObject): longitude: float, title: str, address: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVenue: """ @@ -1241,32 +1233,30 @@ class ChatMemberUpdated(TelegramObject): def answer_video( self, video: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideo: """ @@ -1344,21 +1334,21 @@ class ChatMemberUpdated(TelegramObject): def answer_video_note( self, video_note: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideoNote: """ @@ -1418,22 +1408,22 @@ class ChatMemberUpdated(TelegramObject): def answer_voice( self, voice: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVoice: """ diff --git a/aiogram/types/chat_permissions.py b/aiogram/types/chat_permissions.py index 38775b89..dfb0fb77 100644 --- a/aiogram/types/chat_permissions.py +++ b/aiogram/types/chat_permissions.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import MutableTelegramObject @@ -12,33 +12,33 @@ class ChatPermissions(MutableTelegramObject): Source: https://core.telegram.org/bots/api#chatpermissions """ - can_send_messages: Optional[bool] = None + can_send_messages: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues""" - can_send_audios: Optional[bool] = None + can_send_audios: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send audios""" - can_send_documents: Optional[bool] = None + can_send_documents: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send documents""" - can_send_photos: Optional[bool] = None + can_send_photos: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send photos""" - can_send_videos: Optional[bool] = None + can_send_videos: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send videos""" - can_send_video_notes: Optional[bool] = None + can_send_video_notes: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send video notes""" - can_send_voice_notes: Optional[bool] = None + can_send_voice_notes: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send voice notes""" - can_send_polls: Optional[bool] = None + can_send_polls: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send polls and checklists""" - can_send_other_messages: Optional[bool] = None + can_send_other_messages: bool | None = None """*Optional*. :code:`True`, if the user is allowed to send animations, games, stickers and use inline bots""" - can_add_web_page_previews: Optional[bool] = None + can_add_web_page_previews: bool | None = None """*Optional*. :code:`True`, if the user is allowed to add web page previews to their messages""" - can_change_info: Optional[bool] = None + can_change_info: bool | None = None """*Optional*. :code:`True`, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups""" - can_invite_users: Optional[bool] = None + can_invite_users: bool | None = None """*Optional*. :code:`True`, if the user is allowed to invite new users to the chat""" - can_pin_messages: Optional[bool] = None + can_pin_messages: bool | None = None """*Optional*. :code:`True`, if the user is allowed to pin messages. Ignored in public supergroups""" - can_manage_topics: Optional[bool] = None + can_manage_topics: bool | None = None """*Optional*. :code:`True`, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages""" if TYPE_CHECKING: @@ -48,20 +48,20 @@ class ChatPermissions(MutableTelegramObject): def __init__( __pydantic__self__, *, - can_send_messages: Optional[bool] = None, - can_send_audios: Optional[bool] = None, - can_send_documents: Optional[bool] = None, - can_send_photos: Optional[bool] = None, - can_send_videos: Optional[bool] = None, - can_send_video_notes: Optional[bool] = None, - can_send_voice_notes: Optional[bool] = None, - can_send_polls: Optional[bool] = None, - can_send_other_messages: Optional[bool] = None, - can_add_web_page_previews: Optional[bool] = None, - can_change_info: Optional[bool] = None, - can_invite_users: Optional[bool] = None, - can_pin_messages: Optional[bool] = None, - can_manage_topics: Optional[bool] = None, + can_send_messages: bool | None = None, + can_send_audios: bool | None = None, + can_send_documents: bool | None = None, + can_send_photos: bool | None = None, + can_send_videos: bool | None = None, + can_send_video_notes: bool | None = None, + can_send_voice_notes: bool | None = None, + can_send_polls: bool | None = None, + can_send_other_messages: bool | None = None, + can_add_web_page_previews: bool | None = None, + can_change_info: bool | None = None, + can_invite_users: bool | None = None, + can_pin_messages: bool | None = None, + can_manage_topics: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chat_shared.py b/aiogram/types/chat_shared.py index 73be7b1f..80c38e1a 100644 --- a/aiogram/types/chat_shared.py +++ b/aiogram/types/chat_shared.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from aiogram.types import TelegramObject @@ -19,11 +19,11 @@ class ChatShared(TelegramObject): """Identifier of the request""" chat_id: int """Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means.""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title of the chat, if the title was requested by the bot.""" - username: Optional[str] = None + username: str | None = None """*Optional*. Username of the chat, if the username was requested by the bot and available.""" - photo: Optional[list[PhotoSize]] = None + photo: list[PhotoSize] | None = None """*Optional*. Available sizes of the chat photo, if the photo was requested by the bot""" if TYPE_CHECKING: @@ -35,9 +35,9 @@ class ChatShared(TelegramObject): *, request_id: int, chat_id: int, - title: Optional[str] = None, - username: Optional[str] = None, - photo: Optional[list[PhotoSize]] = None, + title: str | None = None, + username: str | None = None, + photo: list[PhotoSize] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/checklist.py b/aiogram/types/checklist.py index 21393719..fd2cb209 100644 --- a/aiogram/types/checklist.py +++ b/aiogram/types/checklist.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -20,11 +20,11 @@ class Checklist(TelegramObject): """Title of the checklist""" tasks: list[ChecklistTask] """List of tasks in the checklist""" - title_entities: Optional[list[MessageEntity]] = None + title_entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in the checklist title""" - others_can_add_tasks: Optional[bool] = None + others_can_add_tasks: bool | None = None """*Optional*. :code:`True`, if users other than the creator of the list can add tasks to the list""" - others_can_mark_tasks_as_done: Optional[bool] = None + others_can_mark_tasks_as_done: bool | None = None """*Optional*. :code:`True`, if users other than the creator of the list can mark tasks as done or not done""" if TYPE_CHECKING: @@ -36,9 +36,9 @@ class Checklist(TelegramObject): *, title: str, tasks: list[ChecklistTask], - title_entities: Optional[list[MessageEntity]] = None, - others_can_add_tasks: Optional[bool] = None, - others_can_mark_tasks_as_done: Optional[bool] = None, + title_entities: list[MessageEntity] | None = None, + others_can_add_tasks: bool | None = None, + others_can_mark_tasks_as_done: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/checklist_task.py b/aiogram/types/checklist_task.py index 0e1de526..3926320b 100644 --- a/aiogram/types/checklist_task.py +++ b/aiogram/types/checklist_task.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -21,13 +21,13 @@ class ChecklistTask(TelegramObject): """Unique identifier of the task""" text: str """Text of the task""" - text_entities: Optional[list[MessageEntity]] = None + text_entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in the task text""" - completed_by_user: Optional[User] = None + completed_by_user: User | None = None """*Optional*. User that completed the task; omitted if the task wasn't completed by a user""" - completed_by_chat: Optional[Chat] = None + completed_by_chat: Chat | None = None """*Optional*. Chat that completed the task; omitted if the task wasn't completed by a chat""" - completion_date: Optional[int] = None + completion_date: int | None = None """*Optional*. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed""" if TYPE_CHECKING: @@ -39,10 +39,10 @@ class ChecklistTask(TelegramObject): *, id: int, text: str, - text_entities: Optional[list[MessageEntity]] = None, - completed_by_user: Optional[User] = None, - completed_by_chat: Optional[Chat] = None, - completion_date: Optional[int] = None, + text_entities: list[MessageEntity] | None = None, + completed_by_user: User | None = None, + completed_by_chat: Chat | None = None, + completion_date: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/checklist_tasks_added.py b/aiogram/types/checklist_tasks_added.py index 234b08ae..ede97075 100644 --- a/aiogram/types/checklist_tasks_added.py +++ b/aiogram/types/checklist_tasks_added.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,7 +18,7 @@ class ChecklistTasksAdded(TelegramObject): tasks: list[ChecklistTask] """List of tasks added to the checklist""" - checklist_message: Optional[Message] = None + checklist_message: Message | None = None """*Optional*. Message containing the checklist to which the tasks were added. Note that the :class:`aiogram.types.message.Message` object in this field will not contain the *reply_to_message* field even if it itself is a reply.""" if TYPE_CHECKING: @@ -29,7 +29,7 @@ class ChecklistTasksAdded(TelegramObject): __pydantic__self__, *, tasks: list[ChecklistTask], - checklist_message: Optional[Message] = None, + checklist_message: Message | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/checklist_tasks_done.py b/aiogram/types/checklist_tasks_done.py index ba480445..1bb841f8 100644 --- a/aiogram/types/checklist_tasks_done.py +++ b/aiogram/types/checklist_tasks_done.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -15,11 +15,11 @@ class ChecklistTasksDone(TelegramObject): Source: https://core.telegram.org/bots/api#checklisttasksdone """ - checklist_message: Optional[Message] = None + checklist_message: Message | None = None """*Optional*. Message containing the checklist whose tasks were marked as done or not done. Note that the :class:`aiogram.types.message.Message` object in this field will not contain the *reply_to_message* field even if it itself is a reply.""" - marked_as_done_task_ids: Optional[list[int]] = None + marked_as_done_task_ids: list[int] | None = None """*Optional*. Identifiers of the tasks that were marked as done""" - marked_as_not_done_task_ids: Optional[list[int]] = None + marked_as_not_done_task_ids: list[int] | None = None """*Optional*. Identifiers of the tasks that were marked as not done""" if TYPE_CHECKING: @@ -29,9 +29,9 @@ class ChecklistTasksDone(TelegramObject): def __init__( __pydantic__self__, *, - checklist_message: Optional[Message] = None, - marked_as_done_task_ids: Optional[list[int]] = None, - marked_as_not_done_task_ids: Optional[list[int]] = None, + checklist_message: Message | None = None, + marked_as_done_task_ids: list[int] | None = None, + marked_as_not_done_task_ids: list[int] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/chosen_inline_result.py b/aiogram/types/chosen_inline_result.py index 510a0e12..1364ab39 100644 --- a/aiogram/types/chosen_inline_result.py +++ b/aiogram/types/chosen_inline_result.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -25,9 +25,9 @@ class ChosenInlineResult(TelegramObject): """The user that chose the result""" query: str """The query that was used to obtain the result""" - location: Optional[Location] = None + location: Location | None = None """*Optional*. Sender location, only for bots that require user location""" - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """*Optional*. Identifier of the sent inline message. Available only if there is an `inline keyboard `_ attached to the message. Will be also received in `callback queries `_ and can be used to `edit `_ the message.""" if TYPE_CHECKING: @@ -40,8 +40,8 @@ class ChosenInlineResult(TelegramObject): result_id: str, from_user: User, query: str, - location: Optional[Location] = None, - inline_message_id: Optional[str] = None, + location: Location | None = None, + inline_message_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/contact.py b/aiogram/types/contact.py index 1fb7f834..acc53765 100644 --- a/aiogram/types/contact.py +++ b/aiogram/types/contact.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -16,11 +16,11 @@ class Contact(TelegramObject): """Contact's phone number""" first_name: str """Contact's first name""" - last_name: Optional[str] = None + last_name: str | None = None """*Optional*. Contact's last name""" - user_id: Optional[int] = None + user_id: int | None = None """*Optional*. Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.""" - vcard: Optional[str] = None + vcard: str | None = None """*Optional*. Additional data about the contact in the form of a `vCard `_""" if TYPE_CHECKING: @@ -32,9 +32,9 @@ class Contact(TelegramObject): *, phone_number: str, first_name: str, - last_name: Optional[str] = None, - user_id: Optional[int] = None, - vcard: Optional[str] = None, + last_name: str | None = None, + user_id: int | None = None, + vcard: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/date_time_union.py b/aiogram/types/date_time_union.py index 8ac15f17..8245313a 100644 --- a/aiogram/types/date_time_union.py +++ b/aiogram/types/date_time_union.py @@ -1,6 +1,6 @@ from __future__ import annotations import datetime -from typing import Union +from typing import TypeAlias -DateTimeUnion = Union[datetime.datetime, datetime.timedelta, int] +DateTimeUnion: TypeAlias = datetime.datetime | datetime.timedelta | int diff --git a/aiogram/types/direct_message_price_changed.py b/aiogram/types/direct_message_price_changed.py index 415d818a..cc35e56d 100644 --- a/aiogram/types/direct_message_price_changed.py +++ b/aiogram/types/direct_message_price_changed.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -14,7 +14,7 @@ class DirectMessagePriceChanged(TelegramObject): are_direct_messages_enabled: bool """:code:`True`, if direct messages are enabled for the channel chat; false otherwise""" - direct_message_star_count: Optional[int] = None + direct_message_star_count: int | None = None """*Optional*. The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Does not apply to users who have been exempted by administrators. Defaults to 0.""" if TYPE_CHECKING: @@ -25,7 +25,7 @@ class DirectMessagePriceChanged(TelegramObject): __pydantic__self__, *, are_direct_messages_enabled: bool, - direct_message_star_count: Optional[int] = None, + direct_message_star_count: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/direct_messages_topic.py b/aiogram/types/direct_messages_topic.py index e3d8bafe..f0f7b2e7 100644 --- a/aiogram/types/direct_messages_topic.py +++ b/aiogram/types/direct_messages_topic.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -17,7 +17,7 @@ class DirectMessagesTopic(TelegramObject): topic_id: int """Unique identifier of the topic. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.""" - user: Optional[User] = None + user: User | None = None """*Optional*. Information about the user that created the topic. Currently, it is always present""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class DirectMessagesTopic(TelegramObject): __pydantic__self__, *, topic_id: int, - user: Optional[User] = None, + user: User | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/document.py b/aiogram/types/document.py index 18acff7a..4d549ad5 100644 --- a/aiogram/types/document.py +++ b/aiogram/types/document.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -19,13 +19,13 @@ class Document(TelegramObject): """Identifier for this file, which can be used to download or reuse the file""" file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" - thumbnail: Optional[PhotoSize] = None + thumbnail: PhotoSize | None = None """*Optional*. Document thumbnail as defined by the sender""" - file_name: Optional[str] = None + file_name: str | None = None """*Optional*. Original filename as defined by the sender""" - mime_type: Optional[str] = None + mime_type: str | None = None """*Optional*. MIME type of the file as defined by the sender""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" if TYPE_CHECKING: @@ -37,10 +37,10 @@ class Document(TelegramObject): *, file_id: str, file_unique_id: str, - thumbnail: Optional[PhotoSize] = None, - file_name: Optional[str] = None, - mime_type: Optional[str] = None, - file_size: Optional[int] = None, + thumbnail: PhotoSize | None = None, + file_name: str | None = None, + mime_type: str | None = None, + file_size: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/encrypted_passport_element.py b/aiogram/types/encrypted_passport_element.py index efc779b3..89612a51 100644 --- a/aiogram/types/encrypted_passport_element.py +++ b/aiogram/types/encrypted_passport_element.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -19,21 +19,21 @@ class EncryptedPassportElement(TelegramObject): """Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration', 'phone_number', 'email'.""" hash: str """Base64-encoded element hash for using in :class:`aiogram.types.passport_element_error_unspecified.PassportElementErrorUnspecified`""" - data: Optional[str] = None + data: str | None = None """*Optional*. Base64-encoded encrypted Telegram Passport element data provided by the user; available only for 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and 'address' types. Can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`.""" - phone_number: Optional[str] = None + phone_number: str | None = None """*Optional*. User's verified phone number; available only for 'phone_number' type""" - email: Optional[str] = None + email: str | None = None """*Optional*. User's verified email address; available only for 'email' type""" - files: Optional[list[PassportFile]] = None + files: list[PassportFile] | None = None """*Optional*. Array of encrypted files with documents provided by the user; available only for 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`.""" - front_side: Optional[PassportFile] = None + front_side: PassportFile | None = None """*Optional*. Encrypted file with the front side of the document, provided by the user; available only for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`.""" - reverse_side: Optional[PassportFile] = None + reverse_side: PassportFile | None = None """*Optional*. Encrypted file with the reverse side of the document, provided by the user; available only for 'driver_license' and 'identity_card'. The file can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`.""" - selfie: Optional[PassportFile] = None + selfie: PassportFile | None = None """*Optional*. Encrypted file with the selfie of the user holding a document, provided by the user; available if requested for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`.""" - translation: Optional[list[PassportFile]] = None + translation: list[PassportFile] | None = None """*Optional*. Array of encrypted files with translated versions of documents provided by the user; available if requested for 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying :class:`aiogram.types.encrypted_credentials.EncryptedCredentials`.""" if TYPE_CHECKING: @@ -45,14 +45,14 @@ class EncryptedPassportElement(TelegramObject): *, type: str, hash: str, - data: Optional[str] = None, - phone_number: Optional[str] = None, - email: Optional[str] = None, - files: Optional[list[PassportFile]] = None, - front_side: Optional[PassportFile] = None, - reverse_side: Optional[PassportFile] = None, - selfie: Optional[PassportFile] = None, - translation: Optional[list[PassportFile]] = None, + data: str | None = None, + phone_number: str | None = None, + email: str | None = None, + files: list[PassportFile] | None = None, + front_side: PassportFile | None = None, + reverse_side: PassportFile | None = None, + selfie: PassportFile | None = None, + translation: list[PassportFile] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/external_reply_info.py b/aiogram/types/external_reply_info.py index da3675b2..1b8797b0 100644 --- a/aiogram/types/external_reply_info.py +++ b/aiogram/types/external_reply_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -39,53 +39,53 @@ class ExternalReplyInfo(TelegramObject): origin: MessageOriginUnion """Origin of the message replied to by the given message""" - chat: Optional[Chat] = None + chat: Chat | None = None """*Optional*. Chat the original message belongs to. Available only if the chat is a supergroup or a channel.""" - message_id: Optional[int] = None + message_id: int | None = None """*Optional*. Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel.""" - link_preview_options: Optional[LinkPreviewOptions] = None + link_preview_options: LinkPreviewOptions | None = None """*Optional*. Options used for link preview generation for the original message, if it is a text message""" - animation: Optional[Animation] = None + animation: Animation | None = None """*Optional*. Message is an animation, information about the animation""" - audio: Optional[Audio] = None + audio: Audio | None = None """*Optional*. Message is an audio file, information about the file""" - document: Optional[Document] = None + document: Document | None = None """*Optional*. Message is a general file, information about the file""" - paid_media: Optional[PaidMediaInfo] = None + paid_media: PaidMediaInfo | None = None """*Optional*. Message contains paid media; information about the paid media""" - photo: Optional[list[PhotoSize]] = None + photo: list[PhotoSize] | None = None """*Optional*. Message is a photo, available sizes of the photo""" - sticker: Optional[Sticker] = None + sticker: Sticker | None = None """*Optional*. Message is a sticker, information about the sticker""" - story: Optional[Story] = None + story: Story | None = None """*Optional*. Message is a forwarded story""" - video: Optional[Video] = None + video: Video | None = None """*Optional*. Message is a video, information about the video""" - video_note: Optional[VideoNote] = None + video_note: VideoNote | None = None """*Optional*. Message is a `video note `_, information about the video message""" - voice: Optional[Voice] = None + voice: Voice | None = None """*Optional*. Message is a voice message, information about the file""" - has_media_spoiler: Optional[bool] = None + has_media_spoiler: bool | None = None """*Optional*. :code:`True`, if the message media is covered by a spoiler animation""" - checklist: Optional[Checklist] = None + checklist: Checklist | None = None """*Optional*. Message is a checklist""" - contact: Optional[Contact] = None + contact: Contact | None = None """*Optional*. Message is a shared contact, information about the contact""" - dice: Optional[Dice] = None + dice: Dice | None = None """*Optional*. Message is a dice with random value""" - game: Optional[Game] = None + game: Game | None = None """*Optional*. Message is a game, information about the game. `More about games » `_""" - giveaway: Optional[Giveaway] = None + giveaway: Giveaway | None = None """*Optional*. Message is a scheduled giveaway, information about the giveaway""" - giveaway_winners: Optional[GiveawayWinners] = None + giveaway_winners: GiveawayWinners | None = None """*Optional*. A giveaway with public winners was completed""" - invoice: Optional[Invoice] = None + invoice: Invoice | None = None """*Optional*. Message is an invoice for a `payment `_, information about the invoice. `More about payments » `_""" - location: Optional[Location] = None + location: Location | None = None """*Optional*. Message is a shared location, information about the location""" - poll: Optional[Poll] = None + poll: Poll | None = None """*Optional*. Message is a native poll, information about the poll""" - venue: Optional[Venue] = None + venue: Venue | None = None """*Optional*. Message is a venue, information about the venue""" if TYPE_CHECKING: @@ -96,30 +96,30 @@ class ExternalReplyInfo(TelegramObject): __pydantic__self__, *, origin: MessageOriginUnion, - chat: Optional[Chat] = None, - message_id: Optional[int] = None, - link_preview_options: Optional[LinkPreviewOptions] = None, - animation: Optional[Animation] = None, - audio: Optional[Audio] = None, - document: Optional[Document] = None, - paid_media: Optional[PaidMediaInfo] = None, - photo: Optional[list[PhotoSize]] = None, - sticker: Optional[Sticker] = None, - story: Optional[Story] = None, - video: Optional[Video] = None, - video_note: Optional[VideoNote] = None, - voice: Optional[Voice] = None, - has_media_spoiler: Optional[bool] = None, - checklist: Optional[Checklist] = None, - contact: Optional[Contact] = None, - dice: Optional[Dice] = None, - game: Optional[Game] = None, - giveaway: Optional[Giveaway] = None, - giveaway_winners: Optional[GiveawayWinners] = None, - invoice: Optional[Invoice] = None, - location: Optional[Location] = None, - poll: Optional[Poll] = None, - venue: Optional[Venue] = None, + chat: Chat | None = None, + message_id: int | None = None, + link_preview_options: LinkPreviewOptions | None = None, + animation: Animation | None = None, + audio: Audio | None = None, + document: Document | None = None, + paid_media: PaidMediaInfo | None = None, + photo: list[PhotoSize] | None = None, + sticker: Sticker | None = None, + story: Story | None = None, + video: Video | None = None, + video_note: VideoNote | None = None, + voice: Voice | None = None, + has_media_spoiler: bool | None = None, + checklist: Checklist | None = None, + contact: Contact | None = None, + dice: Dice | None = None, + game: Game | None = None, + giveaway: Giveaway | None = None, + giveaway_winners: GiveawayWinners | None = None, + invoice: Invoice | None = None, + location: Location | None = None, + poll: Poll | None = None, + venue: Venue | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/file.py b/aiogram/types/file.py index 252c230b..2569d540 100644 --- a/aiogram/types/file.py +++ b/aiogram/types/file.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,9 +18,9 @@ class File(TelegramObject): """Identifier for this file, which can be used to download or reuse the file""" file_unique_id: str """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" - file_path: Optional[str] = None + file_path: str | None = None """*Optional*. File path. Use :code:`https://api.telegram.org/file/bot/` to get the file.""" if TYPE_CHECKING: @@ -32,8 +32,8 @@ class File(TelegramObject): *, file_id: str, file_unique_id: str, - file_size: Optional[int] = None, - file_path: Optional[str] = None, + file_size: int | None = None, + file_path: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/force_reply.py b/aiogram/types/force_reply.py index 14b9c1c5..053c8d02 100644 --- a/aiogram/types/force_reply.py +++ b/aiogram/types/force_reply.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from .base import MutableTelegramObject @@ -21,9 +21,9 @@ class ForceReply(MutableTelegramObject): force_reply: Literal[True] = True """Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'""" - input_field_placeholder: Optional[str] = None + input_field_placeholder: str | None = None """*Optional*. The placeholder to be shown in the input field when the reply is active; 1-64 characters""" - selective: Optional[bool] = None + selective: bool | None = None """*Optional*. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the *text* of the :class:`aiogram.types.message.Message` object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class ForceReply(MutableTelegramObject): __pydantic__self__, *, force_reply: Literal[True] = True, - input_field_placeholder: Optional[str] = None, - selective: Optional[bool] = None, + input_field_placeholder: str | None = None, + selective: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/forum_topic.py b/aiogram/types/forum_topic.py index 02938ad5..db3da10f 100644 --- a/aiogram/types/forum_topic.py +++ b/aiogram/types/forum_topic.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,9 +18,9 @@ class ForumTopic(TelegramObject): """Name of the topic""" icon_color: int """Color of the topic icon in RGB format""" - icon_custom_emoji_id: Optional[str] = None + icon_custom_emoji_id: str | None = None """*Optional*. Unique identifier of the custom emoji shown as the topic icon""" - is_name_implicit: Optional[bool] = None + is_name_implicit: bool | None = None """*Optional*. :code:`True`, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot""" if TYPE_CHECKING: @@ -33,8 +33,8 @@ class ForumTopic(TelegramObject): message_thread_id: int, name: str, icon_color: int, - icon_custom_emoji_id: Optional[str] = None, - is_name_implicit: Optional[bool] = None, + icon_custom_emoji_id: str | None = None, + is_name_implicit: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/forum_topic_created.py b/aiogram/types/forum_topic_created.py index ec2426af..1625014a 100644 --- a/aiogram/types/forum_topic_created.py +++ b/aiogram/types/forum_topic_created.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -16,9 +16,9 @@ class ForumTopicCreated(TelegramObject): """Name of the topic""" icon_color: int """Color of the topic icon in RGB format""" - icon_custom_emoji_id: Optional[str] = None + icon_custom_emoji_id: str | None = None """*Optional*. Unique identifier of the custom emoji shown as the topic icon""" - is_name_implicit: Optional[bool] = None + is_name_implicit: bool | None = None """*Optional*. :code:`True`, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot""" if TYPE_CHECKING: @@ -30,8 +30,8 @@ class ForumTopicCreated(TelegramObject): *, name: str, icon_color: int, - icon_custom_emoji_id: Optional[str] = None, - is_name_implicit: Optional[bool] = None, + icon_custom_emoji_id: str | None = None, + is_name_implicit: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/forum_topic_edited.py b/aiogram/types/forum_topic_edited.py index b7b61965..6b011ca4 100644 --- a/aiogram/types/forum_topic_edited.py +++ b/aiogram/types/forum_topic_edited.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from aiogram.types import TelegramObject @@ -10,9 +10,9 @@ class ForumTopicEdited(TelegramObject): Source: https://core.telegram.org/bots/api#forumtopicedited """ - name: Optional[str] = None + name: str | None = None """*Optional*. New name of the topic, if it was edited""" - icon_custom_emoji_id: Optional[str] = None + icon_custom_emoji_id: str | None = None """*Optional*. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed""" if TYPE_CHECKING: @@ -22,8 +22,8 @@ class ForumTopicEdited(TelegramObject): def __init__( __pydantic__self__, *, - name: Optional[str] = None, - icon_custom_emoji_id: Optional[str] = None, + name: str | None = None, + icon_custom_emoji_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/game.py b/aiogram/types/game.py index e3388fe4..e8034969 100644 --- a/aiogram/types/game.py +++ b/aiogram/types/game.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -23,11 +23,11 @@ class Game(TelegramObject): """Description of the game""" photo: list[PhotoSize] """Photo that will be displayed in the game message in chats.""" - text: Optional[str] = None + text: str | None = None """*Optional*. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls :class:`aiogram.methods.set_game_score.SetGameScore`, or manually edited using :class:`aiogram.methods.edit_message_text.EditMessageText`. 0-4096 characters.""" - text_entities: Optional[list[MessageEntity]] = None + text_entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in *text*, such as usernames, URLs, bot commands, etc.""" - animation: Optional[Animation] = None + animation: Animation | None = None """*Optional*. Animation that will be displayed in the game message in chats. Upload via `BotFather `_""" if TYPE_CHECKING: @@ -40,9 +40,9 @@ class Game(TelegramObject): title: str, description: str, photo: list[PhotoSize], - text: Optional[str] = None, - text_entities: Optional[list[MessageEntity]] = None, - animation: Optional[Animation] = None, + text: str | None = None, + text_entities: list[MessageEntity] | None = None, + animation: Animation | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/gift.py b/aiogram/types/gift.py index a3be7a48..78e6e5d1 100644 --- a/aiogram/types/gift.py +++ b/aiogram/types/gift.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -23,25 +23,25 @@ class Gift(TelegramObject): """The sticker that represents the gift""" star_count: int """The number of Telegram Stars that must be paid to send the sticker""" - upgrade_star_count: Optional[int] = None + upgrade_star_count: int | None = None """*Optional*. The number of Telegram Stars that must be paid to upgrade the gift to a unique one""" - is_premium: Optional[bool] = None + is_premium: bool | None = None """*Optional*. :code:`True`, if the gift can only be purchased by Telegram Premium subscribers""" - has_colors: Optional[bool] = None + has_colors: bool | None = None """*Optional*. :code:`True`, if the gift can be used (after being upgraded) to customize a user's appearance""" - total_count: Optional[int] = None + total_count: int | None = None """*Optional*. The total number of gifts of this type that can be sent by all users; for limited gifts only""" - remaining_count: Optional[int] = None + remaining_count: int | None = None """*Optional*. The number of remaining gifts of this type that can be sent by all users; for limited gifts only""" - personal_total_count: Optional[int] = None + personal_total_count: int | None = None """*Optional*. The total number of gifts of this type that can be sent by the bot; for limited gifts only""" - personal_remaining_count: Optional[int] = None + personal_remaining_count: int | None = None """*Optional*. The number of remaining gifts of this type that can be sent by the bot; for limited gifts only""" - background: Optional[GiftBackground] = None + background: GiftBackground | None = None """*Optional*. Background of the gift""" - unique_gift_variant_count: Optional[int] = None + unique_gift_variant_count: int | None = None """*Optional*. The total number of different unique gifts that can be obtained by upgrading the gift""" - publisher_chat: Optional[Chat] = None + publisher_chat: Chat | None = None """*Optional*. Information about the chat that published the gift""" if TYPE_CHECKING: @@ -54,16 +54,16 @@ class Gift(TelegramObject): id: str, sticker: Sticker, star_count: int, - upgrade_star_count: Optional[int] = None, - is_premium: Optional[bool] = None, - has_colors: Optional[bool] = None, - total_count: Optional[int] = None, - remaining_count: Optional[int] = None, - personal_total_count: Optional[int] = None, - personal_remaining_count: Optional[int] = None, - background: Optional[GiftBackground] = None, - unique_gift_variant_count: Optional[int] = None, - publisher_chat: Optional[Chat] = None, + upgrade_star_count: int | None = None, + is_premium: bool | None = None, + has_colors: bool | None = None, + total_count: int | None = None, + remaining_count: int | None = None, + personal_total_count: int | None = None, + personal_remaining_count: int | None = None, + background: GiftBackground | None = None, + unique_gift_variant_count: int | None = None, + publisher_chat: Chat | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/gift_info.py b/aiogram/types/gift_info.py index e09f5fd5..bfaf49ca 100644 --- a/aiogram/types/gift_info.py +++ b/aiogram/types/gift_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,23 +18,23 @@ class GiftInfo(TelegramObject): gift: Gift """Information about the gift""" - owned_gift_id: Optional[str] = None + owned_gift_id: str | None = None """*Optional*. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts""" - convert_star_count: Optional[int] = None + convert_star_count: int | None = None """*Optional*. Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible""" - prepaid_upgrade_star_count: Optional[int] = None + prepaid_upgrade_star_count: int | None = None """*Optional*. Number of Telegram Stars that were prepaid for the ability to upgrade the gift""" - is_upgrade_separate: Optional[bool] = None + is_upgrade_separate: bool | None = None """*Optional*. :code:`True`, if the gift's upgrade was purchased after the gift was sent""" - can_be_upgraded: Optional[bool] = None + can_be_upgraded: bool | None = None """*Optional*. :code:`True`, if the gift can be upgraded to a unique gift""" - text: Optional[str] = None + text: str | None = None """*Optional*. Text of the message that was added to the gift""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in the text""" - is_private: Optional[bool] = None + is_private: bool | None = None """*Optional*. :code:`True`, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them""" - unique_gift_number: Optional[int] = None + unique_gift_number: int | None = None """*Optional*. Unique number reserved for this gift when upgraded. See the *number* field in :class:`aiogram.types.unique_gift.UniqueGift`""" if TYPE_CHECKING: @@ -45,15 +45,15 @@ class GiftInfo(TelegramObject): __pydantic__self__, *, gift: Gift, - owned_gift_id: Optional[str] = None, - convert_star_count: Optional[int] = None, - prepaid_upgrade_star_count: Optional[int] = None, - is_upgrade_separate: Optional[bool] = None, - can_be_upgraded: Optional[bool] = None, - text: Optional[str] = None, - entities: Optional[list[MessageEntity]] = None, - is_private: Optional[bool] = None, - unique_gift_number: Optional[int] = None, + owned_gift_id: str | None = None, + convert_star_count: int | None = None, + prepaid_upgrade_star_count: int | None = None, + is_upgrade_separate: bool | None = None, + can_be_upgraded: bool | None = None, + text: str | None = None, + entities: list[MessageEntity] | None = None, + is_private: bool | None = None, + unique_gift_number: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/giveaway.py b/aiogram/types/giveaway.py index f18e3e30..b07482a5 100644 --- a/aiogram/types/giveaway.py +++ b/aiogram/types/giveaway.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -22,17 +22,17 @@ class Giveaway(TelegramObject): """Point in time (Unix timestamp) when winners of the giveaway will be selected""" winner_count: int """The number of users which are supposed to be selected as winners of the giveaway""" - only_new_members: Optional[bool] = None + only_new_members: bool | None = None """*Optional*. :code:`True`, if only users who join the chats after the giveaway started should be eligible to win""" - has_public_winners: Optional[bool] = None + has_public_winners: bool | None = None """*Optional*. :code:`True`, if the list of giveaway winners will be visible to everyone""" - prize_description: Optional[str] = None + prize_description: str | None = None """*Optional*. Description of additional giveaway prize""" - country_codes: Optional[list[str]] = None + country_codes: list[str] | None = None """*Optional*. A list of two-letter `ISO 3166-1 alpha-2 `_ country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.""" - prize_star_count: Optional[int] = None + prize_star_count: int | None = None """*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only""" - premium_subscription_month_count: Optional[int] = None + premium_subscription_month_count: int | None = None """*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only""" if TYPE_CHECKING: @@ -45,12 +45,12 @@ class Giveaway(TelegramObject): chats: list[Chat], winners_selection_date: DateTime, winner_count: int, - only_new_members: Optional[bool] = None, - has_public_winners: Optional[bool] = None, - prize_description: Optional[str] = None, - country_codes: Optional[list[str]] = None, - prize_star_count: Optional[int] = None, - premium_subscription_month_count: Optional[int] = None, + only_new_members: bool | None = None, + has_public_winners: bool | None = None, + prize_description: str | None = None, + country_codes: list[str] | None = None, + prize_star_count: int | None = None, + premium_subscription_month_count: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/giveaway_completed.py b/aiogram/types/giveaway_completed.py index 54a371c4..18b9244c 100644 --- a/aiogram/types/giveaway_completed.py +++ b/aiogram/types/giveaway_completed.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -17,11 +17,11 @@ class GiveawayCompleted(TelegramObject): winner_count: int """Number of winners in the giveaway""" - unclaimed_prize_count: Optional[int] = None + unclaimed_prize_count: int | None = None """*Optional*. Number of undistributed prizes""" - giveaway_message: Optional[Message] = None + giveaway_message: Message | None = None """*Optional*. Message with the giveaway that was completed, if it wasn't deleted""" - is_star_giveaway: Optional[bool] = None + is_star_giveaway: bool | None = None """*Optional*. :code:`True`, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.""" if TYPE_CHECKING: @@ -32,9 +32,9 @@ class GiveawayCompleted(TelegramObject): __pydantic__self__, *, winner_count: int, - unclaimed_prize_count: Optional[int] = None, - giveaway_message: Optional[Message] = None, - is_star_giveaway: Optional[bool] = None, + unclaimed_prize_count: int | None = None, + giveaway_message: Message | None = None, + is_star_giveaway: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/giveaway_created.py b/aiogram/types/giveaway_created.py index 78bb0f14..fad0c39a 100644 --- a/aiogram/types/giveaway_created.py +++ b/aiogram/types/giveaway_created.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -12,7 +12,7 @@ class GiveawayCreated(TelegramObject): Source: https://core.telegram.org/bots/api#giveawaycreated """ - prize_star_count: Optional[int] = None + prize_star_count: int | None = None """*Optional*. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only""" if TYPE_CHECKING: @@ -20,7 +20,7 @@ class GiveawayCreated(TelegramObject): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, *, prize_star_count: Optional[int] = None, **__pydantic_kwargs: Any + __pydantic__self__, *, prize_star_count: int | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/types/giveaway_winners.py b/aiogram/types/giveaway_winners.py index b364c65b..61ebff3c 100644 --- a/aiogram/types/giveaway_winners.py +++ b/aiogram/types/giveaway_winners.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -27,19 +27,19 @@ class GiveawayWinners(TelegramObject): """Total number of winners in the giveaway""" winners: list[User] """List of up to 100 winners of the giveaway""" - additional_chat_count: Optional[int] = None + additional_chat_count: int | None = None """*Optional*. The number of other chats the user had to join in order to be eligible for the giveaway""" - prize_star_count: Optional[int] = None + prize_star_count: int | None = None """*Optional*. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only""" - premium_subscription_month_count: Optional[int] = None + premium_subscription_month_count: int | None = None """*Optional*. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only""" - unclaimed_prize_count: Optional[int] = None + unclaimed_prize_count: int | None = None """*Optional*. Number of undistributed prizes""" - only_new_members: Optional[bool] = None + only_new_members: bool | None = None """*Optional*. :code:`True`, if only users who had joined the chats after the giveaway started were eligible to win""" - was_refunded: Optional[bool] = None + was_refunded: bool | None = None """*Optional*. :code:`True`, if the giveaway was canceled because the payment for it was refunded""" - prize_description: Optional[str] = None + prize_description: str | None = None """*Optional*. Description of additional giveaway prize""" if TYPE_CHECKING: @@ -54,13 +54,13 @@ class GiveawayWinners(TelegramObject): winners_selection_date: DateTime, winner_count: int, winners: list[User], - additional_chat_count: Optional[int] = None, - prize_star_count: Optional[int] = None, - premium_subscription_month_count: Optional[int] = None, - unclaimed_prize_count: Optional[int] = None, - only_new_members: Optional[bool] = None, - was_refunded: Optional[bool] = None, - prize_description: Optional[str] = None, + additional_chat_count: int | None = None, + prize_star_count: int | None = None, + premium_subscription_month_count: int | None = None, + unclaimed_prize_count: int | None = None, + only_new_members: bool | None = None, + was_refunded: bool | None = None, + prize_description: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inaccessible_message.py b/aiogram/types/inaccessible_message.py index dbeea26a..30c48a70 100644 --- a/aiogram/types/inaccessible_message.py +++ b/aiogram/types/inaccessible_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, List, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from aiogram.types.chat import Chat @@ -78,26 +78,22 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer( self, text: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMessage: """ @@ -163,24 +159,20 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply( self, text: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), **kwargs: Any, ) -> SendMessage: """ @@ -244,29 +236,27 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_animation( self, animation: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAnimation: """ @@ -342,27 +332,25 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_animation( self, animation: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendAnimation: """ @@ -436,25 +424,25 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_audio( self, audio: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAudio: """ @@ -527,23 +515,23 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_audio( self, audio: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendAudio: """ @@ -615,20 +603,20 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, phone_number: str, first_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendContact: """ @@ -693,18 +681,18 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, phone_number: str, first_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendContact: """ @@ -766,23 +754,23 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_document( self, document: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDocument: """ @@ -850,21 +838,21 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_document( self, document: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendDocument: """ @@ -930,16 +918,16 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_game( self, game_short_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendGame: """ @@ -993,14 +981,14 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_game( self, game_short_name: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendGame: """ @@ -1056,33 +1044,33 @@ class InaccessibleMessage(MaybeInaccessibleMessage): payload: str, currency: str, prices: list[LabeledPrice], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendInvoice: """ @@ -1182,31 +1170,31 @@ class InaccessibleMessage(MaybeInaccessibleMessage): payload: str, currency: str, prices: list[LabeledPrice], - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendInvoice: """ @@ -1301,22 +1289,22 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendLocation: """ @@ -1385,20 +1373,20 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, latitude: float, longitude: float, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendLocation: """ @@ -1464,16 +1452,16 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_media_group( self, media: list[MediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMediaGroup: """ @@ -1527,14 +1515,14 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_media_group( self, media: list[MediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendMediaGroup: """ @@ -1586,25 +1574,23 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_photo( self, photo: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPhoto: """ @@ -1672,23 +1658,21 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_photo( self, photo: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendPhoto: """ @@ -1755,28 +1739,28 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, question: str, options: list[InputPollOptionUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPoll: """ @@ -1857,26 +1841,26 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, question: str, options: list[InputPollOptionUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendPoll: """ @@ -1953,19 +1937,19 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_dice( self, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDice: """ @@ -2022,17 +2006,17 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_dice( self, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendDice: """ @@ -2088,19 +2072,19 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_sticker( self, sticker: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendSticker: """ @@ -2160,17 +2144,17 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_sticker( self, sticker: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendSticker: """ @@ -2231,22 +2215,22 @@ class InaccessibleMessage(MaybeInaccessibleMessage): longitude: float, title: str, address: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVenue: """ @@ -2321,20 +2305,20 @@ class InaccessibleMessage(MaybeInaccessibleMessage): longitude: float, title: str, address: str, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVenue: """ @@ -2404,32 +2388,30 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_video( self, video: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideo: """ @@ -2511,30 +2493,28 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_video( self, video: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVideo: """ @@ -2614,21 +2594,21 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_video_note( self, video_note: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideoNote: """ @@ -2692,19 +2672,19 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_video_note( self, video_note: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVideoNote: """ @@ -2766,22 +2746,22 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def answer_voice( self, voice: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVoice: """ @@ -2847,20 +2827,20 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def reply_voice( self, voice: InputFileUnion, - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVoice: """ @@ -2925,20 +2905,20 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, star_count: int, media: list[InputPaidMediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - payload: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - allow_paid_broadcast: Optional[bool] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + payload: str | None = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + allow_paid_broadcast: bool | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, **kwargs: Any, ) -> SendPaidMedia: """ @@ -3003,19 +2983,19 @@ class InaccessibleMessage(MaybeInaccessibleMessage): self, star_count: int, media: list[InputPaidMediaUnion], - business_connection_id: Optional[str] = None, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - payload: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - allow_paid_broadcast: Optional[bool] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, + business_connection_id: str | None = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + payload: str | None = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + allow_paid_broadcast: bool | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, **kwargs: Any, ) -> SendPaidMedia: """ @@ -3078,13 +3058,13 @@ class InaccessibleMessage(MaybeInaccessibleMessage): def as_reply_parameters( self, - allow_sending_without_reply: Optional[Union[bool, Default]] = Default( + allow_sending_without_reply: bool | Default | None = Default( "allow_sending_without_reply" ), - quote: Optional[str] = None, - quote_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - quote_entities: Optional[List[MessageEntity]] = None, - quote_position: Optional[int] = None, + quote: str | None = None, + quote_parse_mode: str | Default | None = Default("parse_mode"), + quote_entities: list[MessageEntity] | None = None, + quote_position: int | None = None, ) -> ReplyParameters: return ReplyParameters( message_id=self.message_id, diff --git a/aiogram/types/inline_keyboard_button.py b/aiogram/types/inline_keyboard_button.py index abe688f6..bc4e934f 100644 --- a/aiogram/types/inline_keyboard_button.py +++ b/aiogram/types/inline_keyboard_button.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import MutableTelegramObject @@ -21,25 +21,25 @@ class InlineKeyboardButton(MutableTelegramObject): text: str """Label text on the button""" - url: Optional[str] = None + url: str | None = None """*Optional*. HTTP or tg:// URL to be opened when the button is pressed. Links :code:`tg://user?id=` can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.""" - callback_data: Optional[str] = None + callback_data: str | None = None """*Optional*. Data to be sent in a `callback query `_ to the bot when the button is pressed, 1-64 bytes""" - web_app: Optional[WebAppInfo] = None + web_app: WebAppInfo | None = None """*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.""" - login_url: Optional[LoginUrl] = None + login_url: LoginUrl | None = None """*Optional*. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the `Telegram Login Widget `_.""" - switch_inline_query: Optional[str] = None + switch_inline_query: str | None = None """*Optional*. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account.""" - switch_inline_query_current_chat: Optional[str] = None + switch_inline_query_current_chat: str | None = None """*Optional*. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.""" - switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = None + switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat | None = None """*Optional*. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account.""" - copy_text: Optional[CopyTextButton] = None + copy_text: CopyTextButton | None = None """*Optional*. Description of the button that copies the specified text to the clipboard.""" - callback_game: Optional[CallbackGame] = None + callback_game: CallbackGame | None = None """*Optional*. Description of the game that will be launched when the user presses the button.""" - pay: Optional[bool] = None + pay: bool | None = None """*Optional*. Specify :code:`True`, to send a `Pay button `_. Substrings '⭐' and 'XTR' in the buttons's text will be replaced with a Telegram Star icon.""" if TYPE_CHECKING: @@ -50,16 +50,16 @@ class InlineKeyboardButton(MutableTelegramObject): __pydantic__self__, *, text: str, - url: Optional[str] = None, - callback_data: Optional[str] = None, - web_app: Optional[WebAppInfo] = None, - login_url: Optional[LoginUrl] = None, - switch_inline_query: Optional[str] = None, - switch_inline_query_current_chat: Optional[str] = None, - switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat] = None, - copy_text: Optional[CopyTextButton] = None, - callback_game: Optional[CallbackGame] = None, - pay: Optional[bool] = None, + url: str | None = None, + callback_data: str | None = None, + web_app: WebAppInfo | None = None, + login_url: LoginUrl | None = None, + switch_inline_query: str | None = None, + switch_inline_query_current_chat: str | None = None, + switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat | None = None, + copy_text: CopyTextButton | None = None, + callback_game: CallbackGame | None = None, + pay: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query.py b/aiogram/types/inline_query.py index cbac7e51..1443dd18 100644 --- a/aiogram/types/inline_query.py +++ b/aiogram/types/inline_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -29,9 +29,9 @@ class InlineQuery(TelegramObject): """Text of the query (up to 256 characters)""" offset: str """Offset of the results to be returned, can be controlled by the bot""" - chat_type: Optional[str] = None + chat_type: str | None = None """*Optional*. Type of the chat from which the inline query was sent. Can be either 'sender' for a private chat with the inline query sender, 'private', 'group', 'supergroup', or 'channel'. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat""" - location: Optional[Location] = None + location: Location | None = None """*Optional*. Sender location, only for bots that request user location""" if TYPE_CHECKING: @@ -45,8 +45,8 @@ class InlineQuery(TelegramObject): from_user: User, query: str, offset: str, - chat_type: Optional[str] = None, - location: Optional[Location] = None, + chat_type: str | None = None, + location: Location | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -66,12 +66,12 @@ class InlineQuery(TelegramObject): def answer( self, results: list[InlineQueryResultUnion], - cache_time: Optional[int] = None, - is_personal: Optional[bool] = None, - next_offset: Optional[str] = None, - button: Optional[InlineQueryResultsButton] = None, - switch_pm_parameter: Optional[str] = None, - switch_pm_text: Optional[str] = None, + cache_time: int | None = None, + is_personal: bool | None = None, + next_offset: str | None = None, + button: InlineQueryResultsButton | None = None, + switch_pm_parameter: str | None = None, + switch_pm_text: str | None = None, **kwargs: Any, ) -> AnswerInlineQuery: """ diff --git a/aiogram/types/inline_query_result_article.py b/aiogram/types/inline_query_result_article.py index f922bee4..5032987a 100644 --- a/aiogram/types/inline_query_result_article.py +++ b/aiogram/types/inline_query_result_article.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from pydantic import Field @@ -27,19 +27,19 @@ class InlineQueryResultArticle(InlineQueryResult): """Title of the result""" input_message_content: InputMessageContentUnion """Content of the message to be sent""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - url: Optional[str] = None + url: str | None = None """*Optional*. URL of the result""" - description: Optional[str] = None + description: str | None = None """*Optional*. Short description of the result""" - thumbnail_url: Optional[str] = None + thumbnail_url: str | None = None """*Optional*. Url of the thumbnail for the result""" - thumbnail_width: Optional[int] = None + thumbnail_width: int | None = None """*Optional*. Thumbnail width""" - thumbnail_height: Optional[int] = None + thumbnail_height: int | None = None """*Optional*. Thumbnail height""" - hide_url: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + hide_url: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Pass :code:`True` if you don't want the URL to be shown in the message .. deprecated:: API:8.2 @@ -56,13 +56,13 @@ class InlineQueryResultArticle(InlineQueryResult): id: str, title: str, input_message_content: InputMessageContentUnion, - reply_markup: Optional[InlineKeyboardMarkup] = None, - url: Optional[str] = None, - description: Optional[str] = None, - thumbnail_url: Optional[str] = None, - thumbnail_width: Optional[int] = None, - thumbnail_height: Optional[int] = None, - hide_url: Optional[bool] = None, + reply_markup: InlineKeyboardMarkup | None = None, + url: str | None = None, + description: str | None = None, + thumbnail_url: str | None = None, + thumbnail_width: int | None = None, + thumbnail_height: int | None = None, + hide_url: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_audio.py b/aiogram/types/inline_query_result_audio.py index 51f81f66..1be55609 100644 --- a/aiogram/types/inline_query_result_audio.py +++ b/aiogram/types/inline_query_result_audio.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,19 +27,19 @@ class InlineQueryResultAudio(InlineQueryResult): """A valid URL for the audio file""" title: str """Title""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the audio caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - performer: Optional[str] = None + performer: str | None = None """*Optional*. Performer""" - audio_duration: Optional[int] = None + audio_duration: int | None = None """*Optional*. Audio duration in seconds""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the audio""" if TYPE_CHECKING: @@ -53,13 +53,13 @@ class InlineQueryResultAudio(InlineQueryResult): id: str, audio_url: str, title: str, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - performer: Optional[str] = None, - audio_duration: Optional[int] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + performer: str | None = None, + audio_duration: int | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_audio.py b/aiogram/types/inline_query_result_cached_audio.py index fdacd87e..488ac02c 100644 --- a/aiogram/types/inline_query_result_cached_audio.py +++ b/aiogram/types/inline_query_result_cached_audio.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -25,15 +25,15 @@ class InlineQueryResultCachedAudio(InlineQueryResult): """Unique identifier for this result, 1-64 bytes""" audio_file_id: str """A valid file identifier for the audio file""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the audio caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the audio""" if TYPE_CHECKING: @@ -46,11 +46,11 @@ class InlineQueryResultCachedAudio(InlineQueryResult): type: Literal[InlineQueryResultType.AUDIO] = InlineQueryResultType.AUDIO, id: str, audio_file_id: str, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_document.py b/aiogram/types/inline_query_result_cached_document.py index 1552f507..4f6c29f6 100644 --- a/aiogram/types/inline_query_result_cached_document.py +++ b/aiogram/types/inline_query_result_cached_document.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,17 +27,17 @@ class InlineQueryResultCachedDocument(InlineQueryResult): """Title for the result""" document_file_id: str """A valid file identifier for the file""" - description: Optional[str] = None + description: str | None = None """*Optional*. Short description of the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the document to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the document caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the file""" if TYPE_CHECKING: @@ -51,12 +51,12 @@ class InlineQueryResultCachedDocument(InlineQueryResult): id: str, title: str, document_file_id: str, - description: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + description: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_gif.py b/aiogram/types/inline_query_result_cached_gif.py index 8c534941..e646e870 100644 --- a/aiogram/types/inline_query_result_cached_gif.py +++ b/aiogram/types/inline_query_result_cached_gif.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -25,19 +25,19 @@ class InlineQueryResultCachedGif(InlineQueryResult): """Unique identifier for this result, 1-64 bytes""" gif_file_id: str """A valid file identifier for the GIF file""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title for the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the GIF file to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the GIF animation""" if TYPE_CHECKING: @@ -50,15 +50,13 @@ class InlineQueryResultCachedGif(InlineQueryResult): type: Literal[InlineQueryResultType.GIF] = InlineQueryResultType.GIF, id: str, gif_file_id: str, - title: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + title: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_mpeg4_gif.py b/aiogram/types/inline_query_result_cached_mpeg4_gif.py index 7dd710fd..70ff56cc 100644 --- a/aiogram/types/inline_query_result_cached_mpeg4_gif.py +++ b/aiogram/types/inline_query_result_cached_mpeg4_gif.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -25,19 +25,19 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): """Unique identifier for this result, 1-64 bytes""" mpeg4_file_id: str """A valid file identifier for the MPEG4 file""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title for the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the video animation""" if TYPE_CHECKING: @@ -50,15 +50,13 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): type: Literal[InlineQueryResultType.MPEG4_GIF] = InlineQueryResultType.MPEG4_GIF, id: str, mpeg4_file_id: str, - title: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + title: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_photo.py b/aiogram/types/inline_query_result_cached_photo.py index 46df4ea1..513ba79e 100644 --- a/aiogram/types/inline_query_result_cached_photo.py +++ b/aiogram/types/inline_query_result_cached_photo.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -25,21 +25,21 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): """Unique identifier for this result, 1-64 bytes""" photo_file_id: str """A valid file identifier of the photo""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title for the result""" - description: Optional[str] = None + description: str | None = None """*Optional*. Short description of the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the photo to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the photo caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the photo""" if TYPE_CHECKING: @@ -52,16 +52,14 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): type: Literal[InlineQueryResultType.PHOTO] = InlineQueryResultType.PHOTO, id: str, photo_file_id: str, - title: Optional[str] = None, - description: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + title: str | None = None, + description: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_sticker.py b/aiogram/types/inline_query_result_cached_sticker.py index d8ae36b3..eb472222 100644 --- a/aiogram/types/inline_query_result_cached_sticker.py +++ b/aiogram/types/inline_query_result_cached_sticker.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult @@ -23,9 +23,9 @@ class InlineQueryResultCachedSticker(InlineQueryResult): """Unique identifier for this result, 1-64 bytes""" sticker_file_id: str """A valid file identifier of the sticker""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the sticker""" if TYPE_CHECKING: @@ -38,8 +38,8 @@ class InlineQueryResultCachedSticker(InlineQueryResult): type: Literal[InlineQueryResultType.STICKER] = InlineQueryResultType.STICKER, id: str, sticker_file_id: str, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_video.py b/aiogram/types/inline_query_result_cached_video.py index 450f7115..e759bab0 100644 --- a/aiogram/types/inline_query_result_cached_video.py +++ b/aiogram/types/inline_query_result_cached_video.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,19 +27,19 @@ class InlineQueryResultCachedVideo(InlineQueryResult): """A valid file identifier for the video file""" title: str """Title for the result""" - description: Optional[str] = None + description: str | None = None """*Optional*. Short description of the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the video to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the video caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the video""" if TYPE_CHECKING: @@ -53,15 +53,13 @@ class InlineQueryResultCachedVideo(InlineQueryResult): id: str, video_file_id: str, title: str, - description: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + description: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_cached_voice.py b/aiogram/types/inline_query_result_cached_voice.py index 5a7701c7..833cf2da 100644 --- a/aiogram/types/inline_query_result_cached_voice.py +++ b/aiogram/types/inline_query_result_cached_voice.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,15 +27,15 @@ class InlineQueryResultCachedVoice(InlineQueryResult): """A valid file identifier for the voice message""" title: str """Voice message title""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the voice message caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the voice message""" if TYPE_CHECKING: @@ -49,11 +49,11 @@ class InlineQueryResultCachedVoice(InlineQueryResult): id: str, voice_file_id: str, title: str, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_contact.py b/aiogram/types/inline_query_result_contact.py index 71c93975..be46226b 100644 --- a/aiogram/types/inline_query_result_contact.py +++ b/aiogram/types/inline_query_result_contact.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult @@ -25,19 +25,19 @@ class InlineQueryResultContact(InlineQueryResult): """Contact's phone number""" first_name: str """Contact's first name""" - last_name: Optional[str] = None + last_name: str | None = None """*Optional*. Contact's last name""" - vcard: Optional[str] = None + vcard: str | None = None """*Optional*. Additional data about the contact in the form of a `vCard `_, 0-2048 bytes""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the contact""" - thumbnail_url: Optional[str] = None + thumbnail_url: str | None = None """*Optional*. Url of the thumbnail for the result""" - thumbnail_width: Optional[int] = None + thumbnail_width: int | None = None """*Optional*. Thumbnail width""" - thumbnail_height: Optional[int] = None + thumbnail_height: int | None = None """*Optional*. Thumbnail height""" if TYPE_CHECKING: @@ -51,13 +51,13 @@ class InlineQueryResultContact(InlineQueryResult): id: str, phone_number: str, first_name: str, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, - thumbnail_url: Optional[str] = None, - thumbnail_width: Optional[int] = None, - thumbnail_height: Optional[int] = None, + last_name: str | None = None, + vcard: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, + thumbnail_url: str | None = None, + thumbnail_width: int | None = None, + thumbnail_height: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_document.py b/aiogram/types/inline_query_result_document.py index dc1172f8..c40d31b8 100644 --- a/aiogram/types/inline_query_result_document.py +++ b/aiogram/types/inline_query_result_document.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -29,23 +29,23 @@ class InlineQueryResultDocument(InlineQueryResult): """A valid URL for the file""" mime_type: str """MIME type of the content of the file, either 'application/pdf' or 'application/zip'""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the document to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the document caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - description: Optional[str] = None + description: str | None = None """*Optional*. Short description of the result""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. Inline keyboard attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the file""" - thumbnail_url: Optional[str] = None + thumbnail_url: str | None = None """*Optional*. URL of the thumbnail (JPEG only) for the file""" - thumbnail_width: Optional[int] = None + thumbnail_width: int | None = None """*Optional*. Thumbnail width""" - thumbnail_height: Optional[int] = None + thumbnail_height: int | None = None """*Optional*. Thumbnail height""" if TYPE_CHECKING: @@ -60,15 +60,15 @@ class InlineQueryResultDocument(InlineQueryResult): title: str, document_url: str, mime_type: str, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - description: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, - thumbnail_url: Optional[str] = None, - thumbnail_width: Optional[int] = None, - thumbnail_height: Optional[int] = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + description: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, + thumbnail_url: str | None = None, + thumbnail_width: int | None = None, + thumbnail_height: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_game.py b/aiogram/types/inline_query_result_game.py index 3c7dcde5..81332b0f 100644 --- a/aiogram/types/inline_query_result_game.py +++ b/aiogram/types/inline_query_result_game.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult @@ -22,7 +22,7 @@ class InlineQueryResultGame(InlineQueryResult): """Unique identifier for this result, 1-64 bytes""" game_short_name: str """Short name of the game""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" if TYPE_CHECKING: @@ -35,7 +35,7 @@ class InlineQueryResultGame(InlineQueryResult): type: Literal[InlineQueryResultType.GAME] = InlineQueryResultType.GAME, id: str, game_short_name: str, - reply_markup: Optional[InlineKeyboardMarkup] = None, + reply_markup: InlineKeyboardMarkup | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_gif.py b/aiogram/types/inline_query_result_gif.py index 910b21a9..8911916b 100644 --- a/aiogram/types/inline_query_result_gif.py +++ b/aiogram/types/inline_query_result_gif.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,27 +27,27 @@ class InlineQueryResultGif(InlineQueryResult): """A valid URL for the GIF file""" thumbnail_url: str """URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result""" - gif_width: Optional[int] = None + gif_width: int | None = None """*Optional*. Width of the GIF""" - gif_height: Optional[int] = None + gif_height: int | None = None """*Optional*. Height of the GIF""" - gif_duration: Optional[int] = None + gif_duration: int | None = None """*Optional*. Duration of the GIF in seconds""" - thumbnail_mime_type: Optional[str] = None + thumbnail_mime_type: str | None = None """*Optional*. MIME type of the thumbnail, must be one of 'image/jpeg', 'image/gif', or 'video/mp4'. Defaults to 'image/jpeg'""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title for the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the GIF file to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the GIF animation""" if TYPE_CHECKING: @@ -61,19 +61,17 @@ class InlineQueryResultGif(InlineQueryResult): id: str, gif_url: str, thumbnail_url: str, - gif_width: Optional[int] = None, - gif_height: Optional[int] = None, - gif_duration: Optional[int] = None, - thumbnail_mime_type: Optional[str] = None, - title: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + gif_width: int | None = None, + gif_height: int | None = None, + gif_duration: int | None = None, + thumbnail_mime_type: str | None = None, + title: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_location.py b/aiogram/types/inline_query_result_location.py index e62e8083..ac943df4 100644 --- a/aiogram/types/inline_query_result_location.py +++ b/aiogram/types/inline_query_result_location.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult @@ -27,23 +27,23 @@ class InlineQueryResultLocation(InlineQueryResult): """Location longitude in degrees""" title: str """Location title""" - horizontal_accuracy: Optional[float] = None + horizontal_accuracy: float | None = None """*Optional*. The radius of uncertainty for the location, measured in meters; 0-1500""" - live_period: Optional[int] = None + live_period: int | None = None """*Optional*. Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.""" - heading: Optional[int] = None + heading: int | None = None """*Optional*. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.""" - proximity_alert_radius: Optional[int] = None + proximity_alert_radius: int | None = None """*Optional*. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the location""" - thumbnail_url: Optional[str] = None + thumbnail_url: str | None = None """*Optional*. Url of the thumbnail for the result""" - thumbnail_width: Optional[int] = None + thumbnail_width: int | None = None """*Optional*. Thumbnail width""" - thumbnail_height: Optional[int] = None + thumbnail_height: int | None = None """*Optional*. Thumbnail height""" if TYPE_CHECKING: @@ -58,15 +58,15 @@ class InlineQueryResultLocation(InlineQueryResult): latitude: float, longitude: float, title: str, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, - thumbnail_url: Optional[str] = None, - thumbnail_width: Optional[int] = None, - thumbnail_height: Optional[int] = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, + thumbnail_url: str | None = None, + thumbnail_width: int | None = None, + thumbnail_height: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_mpeg4_gif.py b/aiogram/types/inline_query_result_mpeg4_gif.py index 7e50dd74..85e26a58 100644 --- a/aiogram/types/inline_query_result_mpeg4_gif.py +++ b/aiogram/types/inline_query_result_mpeg4_gif.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,27 +27,27 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): """A valid URL for the MPEG4 file""" thumbnail_url: str """URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result""" - mpeg4_width: Optional[int] = None + mpeg4_width: int | None = None """*Optional*. Video width""" - mpeg4_height: Optional[int] = None + mpeg4_height: int | None = None """*Optional*. Video height""" - mpeg4_duration: Optional[int] = None + mpeg4_duration: int | None = None """*Optional*. Video duration in seconds""" - thumbnail_mime_type: Optional[str] = None + thumbnail_mime_type: str | None = None """*Optional*. MIME type of the thumbnail, must be one of 'image/jpeg', 'image/gif', or 'video/mp4'. Defaults to 'image/jpeg'""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title for the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the video animation""" if TYPE_CHECKING: @@ -61,19 +61,17 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): id: str, mpeg4_url: str, thumbnail_url: str, - mpeg4_width: Optional[int] = None, - mpeg4_height: Optional[int] = None, - mpeg4_duration: Optional[int] = None, - thumbnail_mime_type: Optional[str] = None, - title: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + mpeg4_width: int | None = None, + mpeg4_height: int | None = None, + mpeg4_duration: int | None = None, + thumbnail_mime_type: str | None = None, + title: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_photo.py b/aiogram/types/inline_query_result_photo.py index 7af052a3..53edabf3 100644 --- a/aiogram/types/inline_query_result_photo.py +++ b/aiogram/types/inline_query_result_photo.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,25 +27,25 @@ class InlineQueryResultPhoto(InlineQueryResult): """A valid URL of the photo. Photo must be in **JPEG** format. Photo size must not exceed 5MB""" thumbnail_url: str """URL of the thumbnail for the photo""" - photo_width: Optional[int] = None + photo_width: int | None = None """*Optional*. Width of the photo""" - photo_height: Optional[int] = None + photo_height: int | None = None """*Optional*. Height of the photo""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title for the result""" - description: Optional[str] = None + description: str | None = None """*Optional*. Short description of the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the photo to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the photo caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the photo""" if TYPE_CHECKING: @@ -59,18 +59,16 @@ class InlineQueryResultPhoto(InlineQueryResult): id: str, photo_url: str, thumbnail_url: str, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - title: Optional[str] = None, - description: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + photo_width: int | None = None, + photo_height: int | None = None, + title: str | None = None, + description: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_union.py b/aiogram/types/inline_query_result_union.py index c2132b20..da2d7021 100644 --- a/aiogram/types/inline_query_result_union.py +++ b/aiogram/types/inline_query_result_union.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .inline_query_result_article import InlineQueryResultArticle from .inline_query_result_audio import InlineQueryResultAudio @@ -23,25 +23,25 @@ from .inline_query_result_venue import InlineQueryResultVenue from .inline_query_result_video import InlineQueryResultVideo from .inline_query_result_voice import InlineQueryResultVoice -InlineQueryResultUnion = Union[ - InlineQueryResultCachedAudio, - InlineQueryResultCachedDocument, - InlineQueryResultCachedGif, - InlineQueryResultCachedMpeg4Gif, - InlineQueryResultCachedPhoto, - InlineQueryResultCachedSticker, - InlineQueryResultCachedVideo, - InlineQueryResultCachedVoice, - InlineQueryResultArticle, - InlineQueryResultAudio, - InlineQueryResultContact, - InlineQueryResultGame, - InlineQueryResultDocument, - InlineQueryResultGif, - InlineQueryResultLocation, - InlineQueryResultMpeg4Gif, - InlineQueryResultPhoto, - InlineQueryResultVenue, - InlineQueryResultVideo, - InlineQueryResultVoice, -] +InlineQueryResultUnion: TypeAlias = ( + InlineQueryResultCachedAudio + | InlineQueryResultCachedDocument + | InlineQueryResultCachedGif + | InlineQueryResultCachedMpeg4Gif + | InlineQueryResultCachedPhoto + | InlineQueryResultCachedSticker + | InlineQueryResultCachedVideo + | InlineQueryResultCachedVoice + | InlineQueryResultArticle + | InlineQueryResultAudio + | InlineQueryResultContact + | InlineQueryResultGame + | InlineQueryResultDocument + | InlineQueryResultGif + | InlineQueryResultLocation + | InlineQueryResultMpeg4Gif + | InlineQueryResultPhoto + | InlineQueryResultVenue + | InlineQueryResultVideo + | InlineQueryResultVoice +) diff --git a/aiogram/types/inline_query_result_venue.py b/aiogram/types/inline_query_result_venue.py index 24628d23..a06d3d9e 100644 --- a/aiogram/types/inline_query_result_venue.py +++ b/aiogram/types/inline_query_result_venue.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import InlineQueryResultType from .inline_query_result import InlineQueryResult @@ -29,23 +29,23 @@ class InlineQueryResultVenue(InlineQueryResult): """Title of the venue""" address: str """Address of the venue""" - foursquare_id: Optional[str] = None + foursquare_id: str | None = None """*Optional*. Foursquare identifier of the venue if known""" - foursquare_type: Optional[str] = None + foursquare_type: str | None = None """*Optional*. Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" - google_place_id: Optional[str] = None + google_place_id: str | None = None """*Optional*. Google Places identifier of the venue""" - google_place_type: Optional[str] = None + google_place_type: str | None = None """*Optional*. Google Places type of the venue. (See `supported types `_.)""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the venue""" - thumbnail_url: Optional[str] = None + thumbnail_url: str | None = None """*Optional*. Url of the thumbnail for the result""" - thumbnail_width: Optional[int] = None + thumbnail_width: int | None = None """*Optional*. Thumbnail width""" - thumbnail_height: Optional[int] = None + thumbnail_height: int | None = None """*Optional*. Thumbnail height""" if TYPE_CHECKING: @@ -61,15 +61,15 @@ class InlineQueryResultVenue(InlineQueryResult): longitude: float, title: str, address: str, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, - thumbnail_url: Optional[str] = None, - thumbnail_width: Optional[int] = None, - thumbnail_height: Optional[int] = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, + thumbnail_url: str | None = None, + thumbnail_width: int | None = None, + thumbnail_height: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_video.py b/aiogram/types/inline_query_result_video.py index 72aa6224..00496efd 100644 --- a/aiogram/types/inline_query_result_video.py +++ b/aiogram/types/inline_query_result_video.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -33,25 +33,25 @@ class InlineQueryResultVideo(InlineQueryResult): """URL of the thumbnail (JPEG only) for the video""" title: str """Title for the result""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the video to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the video caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - video_width: Optional[int] = None + video_width: int | None = None """*Optional*. Video width""" - video_height: Optional[int] = None + video_height: int | None = None """*Optional*. Video height""" - video_duration: Optional[int] = None + video_duration: int | None = None """*Optional*. Video duration in seconds""" - description: Optional[str] = None + description: str | None = None """*Optional*. Short description of the result""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the video. This field is **required** if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).""" if TYPE_CHECKING: @@ -67,18 +67,16 @@ class InlineQueryResultVideo(InlineQueryResult): mime_type: str, thumbnail_url: str, title: str, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - video_width: Optional[int] = None, - video_height: Optional[int] = None, - video_duration: Optional[int] = None, - description: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + video_width: int | None = None, + video_height: int | None = None, + video_duration: int | None = None, + description: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_result_voice.py b/aiogram/types/inline_query_result_voice.py index 0d7bfc9d..4260b43a 100644 --- a/aiogram/types/inline_query_result_voice.py +++ b/aiogram/types/inline_query_result_voice.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InlineQueryResultType @@ -27,17 +27,17 @@ class InlineQueryResultVoice(InlineQueryResult): """A valid URL for the voice recording""" title: str """Recording title""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the voice message caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - voice_duration: Optional[int] = None + voice_duration: int | None = None """*Optional*. Recording duration in seconds""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. `Inline keyboard `_ attached to the message""" - input_message_content: Optional[InputMessageContentUnion] = None + input_message_content: InputMessageContentUnion | None = None """*Optional*. Content of the message to be sent instead of the voice recording""" if TYPE_CHECKING: @@ -51,12 +51,12 @@ class InlineQueryResultVoice(InlineQueryResult): id: str, voice_url: str, title: str, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - voice_duration: Optional[int] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - input_message_content: Optional[InputMessageContentUnion] = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + voice_duration: int | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + input_message_content: InputMessageContentUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/inline_query_results_button.py b/aiogram/types/inline_query_results_button.py index 6943fb89..76fbf526 100644 --- a/aiogram/types/inline_query_results_button.py +++ b/aiogram/types/inline_query_results_button.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -17,9 +17,9 @@ class InlineQueryResultsButton(TelegramObject): text: str """Label text on the button""" - web_app: Optional[WebAppInfo] = None + web_app: WebAppInfo | None = None """*Optional*. Description of the `Web App `_ that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method `switchInlineQuery `_ inside the Web App.""" - start_parameter: Optional[str] = None + start_parameter: str | None = None """*Optional*. `Deep-linking `_ parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.""" if TYPE_CHECKING: @@ -30,8 +30,8 @@ class InlineQueryResultsButton(TelegramObject): __pydantic__self__, *, text: str, - web_app: Optional[WebAppInfo] = None, - start_parameter: Optional[str] = None, + web_app: WebAppInfo | None = None, + start_parameter: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_checklist.py b/aiogram/types/input_checklist.py index 4a0eebea..f5cd5135 100644 --- a/aiogram/types/input_checklist.py +++ b/aiogram/types/input_checklist.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -20,13 +20,13 @@ class InputChecklist(TelegramObject): """Title of the checklist; 1-255 characters after entities parsing""" tasks: list[InputChecklistTask] """List of 1-30 tasks in the checklist""" - parse_mode: Optional[str] = None + parse_mode: str | None = None """*Optional*. Mode for parsing entities in the title. See `formatting options `_ for more details.""" - title_entities: Optional[list[MessageEntity]] = None + title_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only *bold*, *italic*, *underline*, *strikethrough*, *spoiler*, and *custom_emoji* entities are allowed.""" - others_can_add_tasks: Optional[bool] = None + others_can_add_tasks: bool | None = None """*Optional*. Pass :code:`True` if other users can add tasks to the checklist""" - others_can_mark_tasks_as_done: Optional[bool] = None + others_can_mark_tasks_as_done: bool | None = None """*Optional*. Pass :code:`True` if other users can mark tasks as done or not done in the checklist""" if TYPE_CHECKING: @@ -38,10 +38,10 @@ class InputChecklist(TelegramObject): *, title: str, tasks: list[InputChecklistTask], - parse_mode: Optional[str] = None, - title_entities: Optional[list[MessageEntity]] = None, - others_can_add_tasks: Optional[bool] = None, - others_can_mark_tasks_as_done: Optional[bool] = None, + parse_mode: str | None = None, + title_entities: list[MessageEntity] | None = None, + others_can_add_tasks: bool | None = None, + others_can_mark_tasks_as_done: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_checklist_task.py b/aiogram/types/input_checklist_task.py index 15f57061..9cfbf131 100644 --- a/aiogram/types/input_checklist_task.py +++ b/aiogram/types/input_checklist_task.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -19,9 +19,9 @@ class InputChecklistTask(TelegramObject): """Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist""" text: str """Text of the task; 1-100 characters after entities parsing""" - parse_mode: Optional[str] = None + parse_mode: str | None = None """*Optional*. Mode for parsing entities in the text. See `formatting options `_ for more details.""" - text_entities: Optional[list[MessageEntity]] = None + text_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only *bold*, *italic*, *underline*, *strikethrough*, *spoiler*, and *custom_emoji* entities are allowed.""" if TYPE_CHECKING: @@ -33,8 +33,8 @@ class InputChecklistTask(TelegramObject): *, id: int, text: str, - parse_mode: Optional[str] = None, - text_entities: Optional[list[MessageEntity]] = None, + parse_mode: str | None = None, + text_entities: list[MessageEntity] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_contact_message_content.py b/aiogram/types/input_contact_message_content.py index 8bcb5819..bcae0b45 100644 --- a/aiogram/types/input_contact_message_content.py +++ b/aiogram/types/input_contact_message_content.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .input_message_content import InputMessageContent @@ -16,9 +16,9 @@ class InputContactMessageContent(InputMessageContent): """Contact's phone number""" first_name: str """Contact's first name""" - last_name: Optional[str] = None + last_name: str | None = None """*Optional*. Contact's last name""" - vcard: Optional[str] = None + vcard: str | None = None """*Optional*. Additional data about the contact in the form of a `vCard `_, 0-2048 bytes""" if TYPE_CHECKING: @@ -30,8 +30,8 @@ class InputContactMessageContent(InputMessageContent): *, phone_number: str, first_name: str, - last_name: Optional[str] = None, - vcard: Optional[str] = None, + last_name: str | None = None, + vcard: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_file.py b/aiogram/types/input_file.py index 5b730598..07cc0765 100644 --- a/aiogram/types/input_file.py +++ b/aiogram/types/input_file.py @@ -4,7 +4,7 @@ import io import os from abc import ABC, abstractmethod from pathlib import Path -from typing import TYPE_CHECKING, Any, AsyncGenerator, Dict, Optional, Union +from typing import TYPE_CHECKING, Any, AsyncGenerator import aiofiles @@ -21,7 +21,7 @@ class InputFile(ABC): Source: https://core.telegram.org/bots/api#inputfile """ - def __init__(self, filename: Optional[str] = None, chunk_size: int = DEFAULT_CHUNK_SIZE): + def __init__(self, filename: str | None = None, chunk_size: int = DEFAULT_CHUNK_SIZE): """ Base class for input files. Should not be used directly. Look at :class:`BufferedInputFile`, :class:`FSInputFile` :class:`URLInputFile` @@ -53,8 +53,8 @@ class BufferedInputFile(InputFile): @classmethod def from_file( cls, - path: Union[str, Path], - filename: Optional[str] = None, + path: str | Path, + filename: str | None = None, chunk_size: int = DEFAULT_CHUNK_SIZE, ) -> BufferedInputFile: """ @@ -81,8 +81,8 @@ class BufferedInputFile(InputFile): class FSInputFile(InputFile): def __init__( self, - path: Union[str, Path], - filename: Optional[str] = None, + path: str | Path, + filename: str | None = None, chunk_size: int = DEFAULT_CHUNK_SIZE, ): """ @@ -109,11 +109,11 @@ class URLInputFile(InputFile): def __init__( self, url: str, - headers: Optional[Dict[str, Any]] = None, - filename: Optional[str] = None, + headers: dict[str, Any] | None = None, + filename: str | None = None, chunk_size: int = DEFAULT_CHUNK_SIZE, timeout: int = 30, - bot: Optional["Bot"] = None, + bot: Bot | None = None, ): """ Represents object for streaming files from internet diff --git a/aiogram/types/input_file_union.py b/aiogram/types/input_file_union.py index 7038e400..5f820a7d 100644 --- a/aiogram/types/input_file_union.py +++ b/aiogram/types/input_file_union.py @@ -1,7 +1,7 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .input_file import InputFile -InputFileUnion = Union[str, InputFile] +InputFileUnion: TypeAlias = str | InputFile diff --git a/aiogram/types/input_invoice_message_content.py b/aiogram/types/input_invoice_message_content.py index 014e015e..e5ab7141 100644 --- a/aiogram/types/input_invoice_message_content.py +++ b/aiogram/types/input_invoice_message_content.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .input_message_content import InputMessageContent @@ -25,35 +25,35 @@ class InputInvoiceMessageContent(InputMessageContent): """Three-letter ISO 4217 currency code, see `more on currencies `_. Pass 'XTR' for payments in `Telegram Stars `_.""" prices: list[LabeledPrice] """Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars `_.""" - provider_token: Optional[str] = None + provider_token: str | None = None """*Optional*. Payment provider token, obtained via `@BotFather `_. Pass an empty string for payments in `Telegram Stars `_.""" - max_tip_amount: Optional[int] = None + max_tip_amount: int | None = None """*Optional*. The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars `_.""" - suggested_tip_amounts: Optional[list[int]] = None + suggested_tip_amounts: list[int] | None = None """*Optional*. A JSON-serialized array of suggested amounts of tip in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*.""" - provider_data: Optional[str] = None + provider_data: str | None = None """*Optional*. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider.""" - photo_url: Optional[str] = None + photo_url: str | None = None """*Optional*. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.""" - photo_size: Optional[int] = None + photo_size: int | None = None """*Optional*. Photo size in bytes""" - photo_width: Optional[int] = None + photo_width: int | None = None """*Optional*. Photo width""" - photo_height: Optional[int] = None + photo_height: int | None = None """*Optional*. Photo height""" - need_name: Optional[bool] = None + need_name: bool | None = None """*Optional*. Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_phone_number: Optional[bool] = None + need_phone_number: bool | None = None """*Optional*. Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_email: Optional[bool] = None + need_email: bool | None = None """*Optional*. Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars `_.""" - need_shipping_address: Optional[bool] = None + need_shipping_address: bool | None = None """*Optional*. Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars `_.""" - send_phone_number_to_provider: Optional[bool] = None + send_phone_number_to_provider: bool | None = None """*Optional*. Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars `_.""" - send_email_to_provider: Optional[bool] = None + send_email_to_provider: bool | None = None """*Optional*. Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars `_.""" - is_flexible: Optional[bool] = None + is_flexible: bool | None = None """*Optional*. Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars `_.""" if TYPE_CHECKING: @@ -68,21 +68,21 @@ class InputInvoiceMessageContent(InputMessageContent): payload: str, currency: str, prices: list[LabeledPrice], - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_location_message_content.py b/aiogram/types/input_location_message_content.py index 83400c13..37eb1b7c 100644 --- a/aiogram/types/input_location_message_content.py +++ b/aiogram/types/input_location_message_content.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .input_message_content import InputMessageContent @@ -16,13 +16,13 @@ class InputLocationMessageContent(InputMessageContent): """Latitude of the location in degrees""" longitude: float """Longitude of the location in degrees""" - horizontal_accuracy: Optional[float] = None + horizontal_accuracy: float | None = None """*Optional*. The radius of uncertainty for the location, measured in meters; 0-1500""" - live_period: Optional[int] = None + live_period: int | None = None """*Optional*. Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.""" - heading: Optional[int] = None + heading: int | None = None """*Optional*. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.""" - proximity_alert_radius: Optional[int] = None + proximity_alert_radius: int | None = None """*Optional*. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.""" if TYPE_CHECKING: @@ -34,10 +34,10 @@ class InputLocationMessageContent(InputMessageContent): *, latitude: float, longitude: float, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_media_animation.py b/aiogram/types/input_media_animation.py index 56d5a564..05eaf475 100644 --- a/aiogram/types/input_media_animation.py +++ b/aiogram/types/input_media_animation.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InputMediaType @@ -23,23 +23,23 @@ class InputMediaAnimation(InputMedia): """Type of the result, must be *animation*""" media: InputFileUnion """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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the animation to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the animation caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - width: Optional[int] = None + width: int | None = None """*Optional*. Animation width""" - height: Optional[int] = None + height: int | None = None """*Optional*. Animation height""" - duration: Optional[int] = None + duration: int | None = None """*Optional*. Animation duration in seconds""" - has_spoiler: Optional[bool] = None + has_spoiler: bool | None = None """*Optional*. Pass :code:`True` if the animation needs to be covered with a spoiler animation""" if TYPE_CHECKING: @@ -51,17 +51,15 @@ class InputMediaAnimation(InputMedia): *, type: Literal[InputMediaType.ANIMATION] = InputMediaType.ANIMATION, media: InputFileUnion, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - width: Optional[int] = None, - height: Optional[int] = None, - duration: Optional[int] = None, - has_spoiler: Optional[bool] = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + width: int | None = None, + height: int | None = None, + duration: int | None = None, + has_spoiler: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_media_audio.py b/aiogram/types/input_media_audio.py index b0214216..09d5a192 100644 --- a/aiogram/types/input_media_audio.py +++ b/aiogram/types/input_media_audio.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InputMediaType @@ -23,19 +23,19 @@ class InputMediaAudio(InputMedia): """Type of the result, must be *audio*""" media: InputFileUnion """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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the audio to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the audio caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - duration: Optional[int] = None + duration: int | None = None """*Optional*. Duration of the audio in seconds""" - performer: Optional[str] = None + performer: str | None = None """*Optional*. Performer of the audio""" - title: Optional[str] = None + title: str | None = None """*Optional*. Title of the audio""" if TYPE_CHECKING: @@ -47,13 +47,13 @@ class InputMediaAudio(InputMedia): *, type: Literal[InputMediaType.AUDIO] = InputMediaType.AUDIO, media: InputFileUnion, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_media_document.py b/aiogram/types/input_media_document.py index 4908f4e7..674a27c4 100644 --- a/aiogram/types/input_media_document.py +++ b/aiogram/types/input_media_document.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InputMediaType @@ -23,15 +23,15 @@ class InputMediaDocument(InputMedia): """Type of the result, must be *document*""" media: InputFileUnion """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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the document to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the document caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - disable_content_type_detection: Optional[bool] = None + disable_content_type_detection: bool | None = None """*Optional*. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always :code:`True`, if the document is sent as part of an album.""" if TYPE_CHECKING: @@ -43,11 +43,11 @@ class InputMediaDocument(InputMedia): *, type: Literal[InputMediaType.DOCUMENT] = InputMediaType.DOCUMENT, media: InputFileUnion, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_media_photo.py b/aiogram/types/input_media_photo.py index 2c460944..c789a672 100644 --- a/aiogram/types/input_media_photo.py +++ b/aiogram/types/input_media_photo.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InputMediaType @@ -22,15 +22,15 @@ class InputMediaPhoto(InputMedia): """Type of the result, must be *photo*""" media: InputFileUnion """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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the photo to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the photo caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - has_spoiler: Optional[bool] = None + has_spoiler: bool | None = None """*Optional*. Pass :code:`True` if the photo needs to be covered with a spoiler animation""" if TYPE_CHECKING: @@ -42,13 +42,11 @@ class InputMediaPhoto(InputMedia): *, type: Literal[InputMediaType.PHOTO] = InputMediaType.PHOTO, media: InputFileUnion, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_media_union.py b/aiogram/types/input_media_union.py index 89293822..5e1f92ff 100644 --- a/aiogram/types/input_media_union.py +++ b/aiogram/types/input_media_union.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .input_media_animation import InputMediaAnimation from .input_media_audio import InputMediaAudio @@ -8,6 +8,6 @@ from .input_media_document import InputMediaDocument from .input_media_photo import InputMediaPhoto from .input_media_video import InputMediaVideo -InputMediaUnion = Union[ - InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo -] +InputMediaUnion: TypeAlias = ( + InputMediaAnimation | InputMediaDocument | InputMediaAudio | InputMediaPhoto | InputMediaVideo +) diff --git a/aiogram/types/input_media_video.py b/aiogram/types/input_media_video.py index e9514b88..617bb5ff 100644 --- a/aiogram/types/input_media_video.py +++ b/aiogram/types/input_media_video.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Literal from ..client.default import Default from ..enums import InputMediaType @@ -24,29 +24,29 @@ class InputMediaVideo(InputMedia): """Type of the result, must be *video*""" media: InputFileUnion """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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - cover: Optional[InputFileUnion] = None + cover: InputFileUnion | None = None """*Optional*. Cover for the video in the message. 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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - start_timestamp: Optional[DateTimeUnion] = None + start_timestamp: DateTimeUnion | None = None """*Optional*. Start timestamp for the video in the message""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption of the video to be sent, 0-1024 characters after entities parsing""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the video caption. See `formatting options `_ for more details.""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*""" - show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") + show_caption_above_media: bool | Default | None = Default("show_caption_above_media") """*Optional*. Pass :code:`True`, if the caption must be shown above the message media""" - width: Optional[int] = None + width: int | None = None """*Optional*. Video width""" - height: Optional[int] = None + height: int | None = None """*Optional*. Video height""" - duration: Optional[int] = None + duration: int | None = None """*Optional*. Video duration in seconds""" - supports_streaming: Optional[bool] = None + supports_streaming: bool | None = None """*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming""" - has_spoiler: Optional[bool] = None + has_spoiler: bool | None = None """*Optional*. Pass :code:`True` if the video needs to be covered with a spoiler animation""" if TYPE_CHECKING: @@ -58,20 +58,18 @@ class InputMediaVideo(InputMedia): *, type: Literal[InputMediaType.VIDEO] = InputMediaType.VIDEO, media: InputFileUnion, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - width: Optional[int] = None, - height: Optional[int] = None, - duration: Optional[int] = None, - supports_streaming: Optional[bool] = None, - has_spoiler: Optional[bool] = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + width: int | None = None, + height: int | None = None, + duration: int | None = None, + supports_streaming: bool | None = None, + has_spoiler: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_message_content_union.py b/aiogram/types/input_message_content_union.py index 47454e39..aff60a13 100644 --- a/aiogram/types/input_message_content_union.py +++ b/aiogram/types/input_message_content_union.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .input_contact_message_content import InputContactMessageContent from .input_invoice_message_content import InputInvoiceMessageContent @@ -8,10 +8,10 @@ from .input_location_message_content import InputLocationMessageContent from .input_text_message_content import InputTextMessageContent from .input_venue_message_content import InputVenueMessageContent -InputMessageContentUnion = Union[ - InputTextMessageContent, - InputLocationMessageContent, - InputVenueMessageContent, - InputContactMessageContent, - InputInvoiceMessageContent, -] +InputMessageContentUnion: TypeAlias = ( + InputTextMessageContent + | InputLocationMessageContent + | InputVenueMessageContent + | InputContactMessageContent + | InputInvoiceMessageContent +) diff --git a/aiogram/types/input_paid_media_union.py b/aiogram/types/input_paid_media_union.py index 70c2465b..f87a7817 100644 --- a/aiogram/types/input_paid_media_union.py +++ b/aiogram/types/input_paid_media_union.py @@ -1,8 +1,8 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .input_paid_media_photo import InputPaidMediaPhoto from .input_paid_media_video import InputPaidMediaVideo -InputPaidMediaUnion = Union[InputPaidMediaPhoto, InputPaidMediaVideo] +InputPaidMediaUnion: TypeAlias = InputPaidMediaPhoto | InputPaidMediaVideo diff --git a/aiogram/types/input_paid_media_video.py b/aiogram/types/input_paid_media_video.py index 6af40867..49724fe2 100644 --- a/aiogram/types/input_paid_media_video.py +++ b/aiogram/types/input_paid_media_video.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import InputPaidMediaType from .date_time_union import DateTimeUnion @@ -20,19 +20,19 @@ class InputPaidMediaVideo(InputPaidMedia): """Type of the media, must be *video*""" media: InputFileUnion """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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - thumbnail: Optional[InputFile] = None + thumbnail: InputFile | None = 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://' if the thumbnail was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - cover: Optional[InputFileUnion] = None + cover: InputFileUnion | None = None """*Optional*. Cover for the video in the message. 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://' to upload a new one using multipart/form-data under name. :ref:`More information on Sending Files » `""" - start_timestamp: Optional[DateTimeUnion] = None + start_timestamp: DateTimeUnion | None = None """*Optional*. Start timestamp for the video in the message""" - width: Optional[int] = None + width: int | None = None """*Optional*. Video width""" - height: Optional[int] = None + height: int | None = None """*Optional*. Video height""" - duration: Optional[int] = None + duration: int | None = None """*Optional*. Video duration in seconds""" - supports_streaming: Optional[bool] = None + supports_streaming: bool | None = None """*Optional*. Pass :code:`True` if the uploaded video is suitable for streaming""" if TYPE_CHECKING: @@ -44,13 +44,13 @@ class InputPaidMediaVideo(InputPaidMedia): *, type: Literal[InputPaidMediaType.VIDEO] = InputPaidMediaType.VIDEO, media: InputFileUnion, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - width: Optional[int] = None, - height: Optional[int] = None, - duration: Optional[int] = None, - supports_streaming: Optional[bool] = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + width: int | None = None, + height: int | None = None, + duration: int | None = None, + supports_streaming: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_poll_option.py b/aiogram/types/input_poll_option.py index e856ef52..775f8a1f 100644 --- a/aiogram/types/input_poll_option.py +++ b/aiogram/types/input_poll_option.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..client.default import Default from .base import TelegramObject @@ -18,9 +18,9 @@ class InputPollOption(TelegramObject): text: str """Option text, 1-100 characters""" - text_parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + text_parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the text. See `formatting options `_ for more details. Currently, only custom emoji entities are allowed""" - text_entities: Optional[list[MessageEntity]] = None + text_entities: list[MessageEntity] | None = None """*Optional*. A JSON-serialized list of special entities that appear in the poll option text. It can be specified instead of *text_parse_mode*""" if TYPE_CHECKING: @@ -31,8 +31,8 @@ class InputPollOption(TelegramObject): __pydantic__self__, *, text: str, - text_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - text_entities: Optional[list[MessageEntity]] = None, + text_parse_mode: str | Default | None = Default("parse_mode"), + text_entities: list[MessageEntity] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_poll_option_union.py b/aiogram/types/input_poll_option_union.py index 30160880..da824977 100644 --- a/aiogram/types/input_poll_option_union.py +++ b/aiogram/types/input_poll_option_union.py @@ -1,7 +1,7 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .input_poll_option import InputPollOption -InputPollOptionUnion = Union[InputPollOption, str] +InputPollOptionUnion: TypeAlias = InputPollOption | str diff --git a/aiogram/types/input_profile_photo_animated.py b/aiogram/types/input_profile_photo_animated.py index a617e223..11d9e8f2 100644 --- a/aiogram/types/input_profile_photo_animated.py +++ b/aiogram/types/input_profile_photo_animated.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from aiogram.enums import InputProfilePhotoType @@ -19,7 +19,7 @@ class InputProfilePhotoAnimated(InputProfilePhoto): """Type of the profile photo, must be *animated*""" animation: InputFileUnion """The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass 'attach://' if the photo was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - main_frame_timestamp: Optional[float] = None + main_frame_timestamp: float | None = None """*Optional*. Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0.""" if TYPE_CHECKING: @@ -31,7 +31,7 @@ class InputProfilePhotoAnimated(InputProfilePhoto): *, type: Literal[InputProfilePhotoType.ANIMATED] = InputProfilePhotoType.ANIMATED, animation: InputFileUnion, - main_frame_timestamp: Optional[float] = None, + main_frame_timestamp: float | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_profile_photo_union.py b/aiogram/types/input_profile_photo_union.py index cd272919..c0e4b89a 100644 --- a/aiogram/types/input_profile_photo_union.py +++ b/aiogram/types/input_profile_photo_union.py @@ -1,6 +1,6 @@ -from typing import Union +from typing import TypeAlias from .input_profile_photo_animated import InputProfilePhotoAnimated from .input_profile_photo_static import InputProfilePhotoStatic -InputProfilePhotoUnion = Union[InputProfilePhotoStatic, InputProfilePhotoAnimated] +InputProfilePhotoUnion: TypeAlias = InputProfilePhotoStatic | InputProfilePhotoAnimated diff --git a/aiogram/types/input_sticker.py b/aiogram/types/input_sticker.py index 83a2b496..73af02e7 100644 --- a/aiogram/types/input_sticker.py +++ b/aiogram/types/input_sticker.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -22,9 +22,9 @@ class InputSticker(TelegramObject): """Format of the added sticker, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, 'video' for a **.WEBM** video""" emoji_list: list[str] """List of 1-20 emoji associated with the sticker""" - mask_position: Optional[MaskPosition] = None + mask_position: MaskPosition | None = None """*Optional*. Position where the mask should be placed on faces. For 'mask' stickers only.""" - keywords: Optional[list[str]] = None + keywords: list[str] | None = None """*Optional*. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For 'regular' and 'custom_emoji' stickers only.""" if TYPE_CHECKING: @@ -37,8 +37,8 @@ class InputSticker(TelegramObject): sticker: InputFileUnion, format: str, emoji_list: list[str], - mask_position: Optional[MaskPosition] = None, - keywords: Optional[list[str]] = None, + mask_position: MaskPosition | None = None, + keywords: list[str] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_story_content_union.py b/aiogram/types/input_story_content_union.py index fd3b6717..71f9ec88 100644 --- a/aiogram/types/input_story_content_union.py +++ b/aiogram/types/input_story_content_union.py @@ -1,6 +1,6 @@ -from typing import Union +from typing import TypeAlias from .input_story_content_photo import InputStoryContentPhoto from .input_story_content_video import InputStoryContentVideo -InputStoryContentUnion = Union[InputStoryContentPhoto, InputStoryContentVideo] +InputStoryContentUnion: TypeAlias = InputStoryContentPhoto | InputStoryContentVideo diff --git a/aiogram/types/input_story_content_video.py b/aiogram/types/input_story_content_video.py index 443ef787..8ea250e9 100644 --- a/aiogram/types/input_story_content_video.py +++ b/aiogram/types/input_story_content_video.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from aiogram.enums import InputStoryContentType @@ -18,11 +18,11 @@ class InputStoryContentVideo(InputStoryContent): """Type of the content, must be *video*""" video: str """The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass 'attach://' if the video was uploaded using multipart/form-data under . :ref:`More information on Sending Files » `""" - duration: Optional[float] = None + duration: float | None = None """*Optional*. Precise duration of the video in seconds; 0-60""" - cover_frame_timestamp: Optional[float] = None + cover_frame_timestamp: float | None = None """*Optional*. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0.""" - is_animation: Optional[bool] = None + is_animation: bool | None = None """*Optional*. Pass :code:`True` if the video has no sound""" if TYPE_CHECKING: @@ -34,9 +34,9 @@ class InputStoryContentVideo(InputStoryContent): *, type: Literal[InputStoryContentType.VIDEO] = InputStoryContentType.VIDEO, video: str, - duration: Optional[float] = None, - cover_frame_timestamp: Optional[float] = None, - is_animation: Optional[bool] = None, + duration: float | None = None, + cover_frame_timestamp: float | None = None, + is_animation: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_text_message_content.py b/aiogram/types/input_text_message_content.py index f2eb7a80..f7745c28 100644 --- a/aiogram/types/input_text_message_content.py +++ b/aiogram/types/input_text_message_content.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -21,13 +21,13 @@ class InputTextMessageContent(InputMessageContent): message_text: str """Text of the message to be sent, 1-4096 characters""" - parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the message text. See `formatting options `_ for more details.""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """*Optional*. List of special entities that appear in message text, which can be specified instead of *parse_mode*""" - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default("link_preview") + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview") """*Optional*. Link preview generation options for the message""" - disable_web_page_preview: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + disable_web_page_preview: bool | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Disables link previews for links in the sent message .. deprecated:: API:7.0 @@ -41,12 +41,10 @@ class InputTextMessageContent(InputMessageContent): __pydantic__self__, *, message_text: str, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_web_page_preview: Optional[bool] = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_web_page_preview: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/input_venue_message_content.py b/aiogram/types/input_venue_message_content.py index 48dd5c4e..3de81521 100644 --- a/aiogram/types/input_venue_message_content.py +++ b/aiogram/types/input_venue_message_content.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .input_message_content import InputMessageContent @@ -20,13 +20,13 @@ class InputVenueMessageContent(InputMessageContent): """Name of the venue""" address: str """Address of the venue""" - foursquare_id: Optional[str] = None + foursquare_id: str | None = None """*Optional*. Foursquare identifier of the venue, if known""" - foursquare_type: Optional[str] = None + foursquare_type: str | None = None """*Optional*. Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" - google_place_id: Optional[str] = None + google_place_id: str | None = None """*Optional*. Google Places identifier of the venue""" - google_place_type: Optional[str] = None + google_place_type: str | None = None """*Optional*. Google Places type of the venue. (See `supported types `_.)""" if TYPE_CHECKING: @@ -40,10 +40,10 @@ class InputVenueMessageContent(InputMessageContent): longitude: float, title: str, address: str, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/keyboard_button.py b/aiogram/types/keyboard_button.py index 63f08054..0635476e 100644 --- a/aiogram/types/keyboard_button.py +++ b/aiogram/types/keyboard_button.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -24,19 +24,19 @@ class KeyboardButton(MutableTelegramObject): text: str """Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed""" - request_users: Optional[KeyboardButtonRequestUsers] = None + request_users: KeyboardButtonRequestUsers | None = None """*Optional*. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a 'users_shared' service message. Available in private chats only.""" - request_chat: Optional[KeyboardButtonRequestChat] = None + request_chat: KeyboardButtonRequestChat | None = None """*Optional*. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a 'chat_shared' service message. Available in private chats only.""" - request_contact: Optional[bool] = None + request_contact: bool | None = None """*Optional*. If :code:`True`, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.""" - request_location: Optional[bool] = None + request_location: bool | None = None """*Optional*. If :code:`True`, the user's current location will be sent when the button is pressed. Available in private chats only.""" - request_poll: Optional[KeyboardButtonPollType] = None + request_poll: KeyboardButtonPollType | None = None """*Optional*. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.""" - web_app: Optional[WebAppInfo] = None + web_app: WebAppInfo | None = None """*Optional*. If specified, the described `Web App `_ will be launched when the button is pressed. The Web App will be able to send a 'web_app_data' service message. Available in private chats only.""" - request_user: Optional[KeyboardButtonRequestUser] = Field( + request_user: KeyboardButtonRequestUser | None = Field( None, json_schema_extra={"deprecated": True} ) """*Optional.* If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a 'user_shared' service message. Available in private chats only. @@ -52,13 +52,13 @@ class KeyboardButton(MutableTelegramObject): __pydantic__self__, *, text: str, - request_users: Optional[KeyboardButtonRequestUsers] = None, - request_chat: Optional[KeyboardButtonRequestChat] = None, - request_contact: Optional[bool] = None, - request_location: Optional[bool] = None, - request_poll: Optional[KeyboardButtonPollType] = None, - web_app: Optional[WebAppInfo] = None, - request_user: Optional[KeyboardButtonRequestUser] = None, + request_users: KeyboardButtonRequestUsers | None = None, + request_chat: KeyboardButtonRequestChat | None = None, + request_contact: bool | None = None, + request_location: bool | None = None, + request_poll: KeyboardButtonPollType | None = None, + web_app: WebAppInfo | None = None, + request_user: KeyboardButtonRequestUser | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/keyboard_button_poll_type.py b/aiogram/types/keyboard_button_poll_type.py index 07eadb7b..4bc93b10 100644 --- a/aiogram/types/keyboard_button_poll_type.py +++ b/aiogram/types/keyboard_button_poll_type.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import MutableTelegramObject @@ -12,7 +12,7 @@ class KeyboardButtonPollType(MutableTelegramObject): Source: https://core.telegram.org/bots/api#keyboardbuttonpolltype """ - type: Optional[str] = None + type: str | None = None """*Optional*. If *quiz* is passed, the user will be allowed to create only polls in the quiz mode. If *regular* is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.""" if TYPE_CHECKING: @@ -20,7 +20,7 @@ class KeyboardButtonPollType(MutableTelegramObject): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, *, type: Optional[str] = None, **__pydantic_kwargs: Any + __pydantic__self__, *, type: str | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/types/keyboard_button_request_chat.py b/aiogram/types/keyboard_button_request_chat.py index 018edcff..33db839c 100644 --- a/aiogram/types/keyboard_button_request_chat.py +++ b/aiogram/types/keyboard_button_request_chat.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from aiogram.types import TelegramObject @@ -19,23 +19,23 @@ class KeyboardButtonRequestChat(TelegramObject): """Signed 32-bit identifier of the request, which will be received back in the :class:`aiogram.types.chat_shared.ChatShared` object. Must be unique within the message""" chat_is_channel: bool """Pass :code:`True` to request a channel chat, pass :code:`False` to request a group or a supergroup chat.""" - chat_is_forum: Optional[bool] = None + chat_is_forum: bool | None = None """*Optional*. Pass :code:`True` to request a forum supergroup, pass :code:`False` to request a non-forum chat. If not specified, no additional restrictions are applied.""" - chat_has_username: Optional[bool] = None + chat_has_username: bool | None = None """*Optional*. Pass :code:`True` to request a supergroup or a channel with a username, pass :code:`False` to request a chat without a username. If not specified, no additional restrictions are applied.""" - chat_is_created: Optional[bool] = None + chat_is_created: bool | None = None """*Optional*. Pass :code:`True` to request a chat owned by the user. Otherwise, no additional restrictions are applied.""" - user_administrator_rights: Optional[ChatAdministratorRights] = None + user_administrator_rights: ChatAdministratorRights | None = None """*Optional*. A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of *bot_administrator_rights*. If not specified, no additional restrictions are applied.""" - bot_administrator_rights: Optional[ChatAdministratorRights] = None + bot_administrator_rights: ChatAdministratorRights | None = None """*Optional*. A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of *user_administrator_rights*. If not specified, no additional restrictions are applied.""" - bot_is_member: Optional[bool] = None + bot_is_member: bool | None = None """*Optional*. Pass :code:`True` to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.""" - request_title: Optional[bool] = None + request_title: bool | None = None """*Optional*. Pass :code:`True` to request the chat's title""" - request_username: Optional[bool] = None + request_username: bool | None = None """*Optional*. Pass :code:`True` to request the chat's username""" - request_photo: Optional[bool] = None + request_photo: bool | None = None """*Optional*. Pass :code:`True` to request the chat's photo""" if TYPE_CHECKING: @@ -47,15 +47,15 @@ class KeyboardButtonRequestChat(TelegramObject): *, request_id: int, chat_is_channel: bool, - chat_is_forum: Optional[bool] = None, - chat_has_username: Optional[bool] = None, - chat_is_created: Optional[bool] = None, - user_administrator_rights: Optional[ChatAdministratorRights] = None, - bot_administrator_rights: Optional[ChatAdministratorRights] = None, - bot_is_member: Optional[bool] = None, - request_title: Optional[bool] = None, - request_username: Optional[bool] = None, - request_photo: Optional[bool] = None, + chat_is_forum: bool | None = None, + chat_has_username: bool | None = None, + chat_is_created: bool | None = None, + user_administrator_rights: ChatAdministratorRights | None = None, + bot_administrator_rights: ChatAdministratorRights | None = None, + bot_is_member: bool | None = None, + request_title: bool | None = None, + request_username: bool | None = None, + request_photo: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/keyboard_button_request_user.py b/aiogram/types/keyboard_button_request_user.py index ab44ab20..07863d2a 100644 --- a/aiogram/types/keyboard_button_request_user.py +++ b/aiogram/types/keyboard_button_request_user.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from aiogram.types import TelegramObject @@ -15,9 +15,9 @@ class KeyboardButtonRequestUser(TelegramObject): request_id: int """Signed 32-bit identifier of the request, which will be received back in the :class:`aiogram.types.user_shared.UserShared` object. Must be unique within the message""" - user_is_bot: Optional[bool] = None + user_is_bot: bool | None = None """*Optional*. Pass :code:`True` to request a bot, pass :code:`False` to request a regular user. If not specified, no additional restrictions are applied.""" - user_is_premium: Optional[bool] = None + user_is_premium: bool | None = None """*Optional*. Pass :code:`True` to request a premium user, pass :code:`False` to request a non-premium user. If not specified, no additional restrictions are applied.""" if TYPE_CHECKING: @@ -28,8 +28,8 @@ class KeyboardButtonRequestUser(TelegramObject): __pydantic__self__, *, request_id: int, - user_is_bot: Optional[bool] = None, - user_is_premium: Optional[bool] = None, + user_is_bot: bool | None = None, + user_is_premium: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/keyboard_button_request_users.py b/aiogram/types/keyboard_button_request_users.py index 631f04b4..cac20de9 100644 --- a/aiogram/types/keyboard_button_request_users.py +++ b/aiogram/types/keyboard_button_request_users.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from aiogram.types import TelegramObject @@ -12,17 +12,17 @@ class KeyboardButtonRequestUsers(TelegramObject): request_id: int """Signed 32-bit identifier of the request that will be received back in the :class:`aiogram.types.users_shared.UsersShared` object. Must be unique within the message""" - user_is_bot: Optional[bool] = None + user_is_bot: bool | None = None """*Optional*. Pass :code:`True` to request bots, pass :code:`False` to request regular users. If not specified, no additional restrictions are applied.""" - user_is_premium: Optional[bool] = None + user_is_premium: bool | None = None """*Optional*. Pass :code:`True` to request premium users, pass :code:`False` to request non-premium users. If not specified, no additional restrictions are applied.""" - max_quantity: Optional[int] = None + max_quantity: int | None = None """*Optional*. The maximum number of users to be selected; 1-10. Defaults to 1.""" - request_name: Optional[bool] = None + request_name: bool | None = None """*Optional*. Pass :code:`True` to request the users' first and last names""" - request_username: Optional[bool] = None + request_username: bool | None = None """*Optional*. Pass :code:`True` to request the users' usernames""" - request_photo: Optional[bool] = None + request_photo: bool | None = None """*Optional*. Pass :code:`True` to request the users' photos""" if TYPE_CHECKING: @@ -33,12 +33,12 @@ class KeyboardButtonRequestUsers(TelegramObject): __pydantic__self__, *, request_id: int, - user_is_bot: Optional[bool] = None, - user_is_premium: Optional[bool] = None, - max_quantity: Optional[int] = None, - request_name: Optional[bool] = None, - request_username: Optional[bool] = None, - request_photo: Optional[bool] = None, + user_is_bot: bool | None = None, + user_is_premium: bool | None = None, + max_quantity: int | None = None, + request_name: bool | None = None, + request_username: bool | None = None, + request_photo: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/link_preview_options.py b/aiogram/types/link_preview_options.py index 8964c5ee..5074f1ea 100644 --- a/aiogram/types/link_preview_options.py +++ b/aiogram/types/link_preview_options.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..client.default import Default from .base import TelegramObject @@ -11,15 +11,15 @@ class LinkPreviewOptions(TelegramObject): Source: https://core.telegram.org/bots/api#linkpreviewoptions """ - is_disabled: Optional[Union[bool, Default]] = Default("link_preview_is_disabled") + is_disabled: bool | Default | None = Default("link_preview_is_disabled") """*Optional*. :code:`True`, if the link preview is disabled""" - url: Optional[str] = None + url: str | None = None """*Optional*. URL to use for the link preview. If empty, then the first URL found in the message text will be used""" - prefer_small_media: Optional[Union[bool, Default]] = Default("link_preview_prefer_small_media") + prefer_small_media: bool | Default | None = Default("link_preview_prefer_small_media") """*Optional*. :code:`True`, if the media in the link preview is supposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview""" - prefer_large_media: Optional[Union[bool, Default]] = Default("link_preview_prefer_large_media") + prefer_large_media: bool | Default | None = Default("link_preview_prefer_large_media") """*Optional*. :code:`True`, if the media in the link preview is supposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview""" - show_above_text: Optional[Union[bool, Default]] = Default("link_preview_show_above_text") + show_above_text: bool | Default | None = Default("link_preview_show_above_text") """*Optional*. :code:`True`, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text""" if TYPE_CHECKING: @@ -29,17 +29,11 @@ class LinkPreviewOptions(TelegramObject): def __init__( __pydantic__self__, *, - is_disabled: Optional[Union[bool, Default]] = Default("link_preview_is_disabled"), - url: Optional[str] = None, - prefer_small_media: Optional[Union[bool, Default]] = Default( - "link_preview_prefer_small_media" - ), - prefer_large_media: Optional[Union[bool, Default]] = Default( - "link_preview_prefer_large_media" - ), - show_above_text: Optional[Union[bool, Default]] = Default( - "link_preview_show_above_text" - ), + is_disabled: bool | Default | None = Default("link_preview_is_disabled"), + url: str | None = None, + prefer_small_media: bool | Default | None = Default("link_preview_prefer_small_media"), + prefer_large_media: bool | Default | None = Default("link_preview_prefer_large_media"), + show_above_text: bool | Default | None = Default("link_preview_show_above_text"), **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/location.py b/aiogram/types/location.py index 32673dae..f6274808 100644 --- a/aiogram/types/location.py +++ b/aiogram/types/location.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -16,13 +16,13 @@ class Location(TelegramObject): """Latitude as defined by the sender""" longitude: float """Longitude as defined by the sender""" - horizontal_accuracy: Optional[float] = None + horizontal_accuracy: float | None = None """*Optional*. The radius of uncertainty for the location, measured in meters; 0-1500""" - live_period: Optional[int] = None + live_period: int | None = None """*Optional*. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.""" - heading: Optional[int] = None + heading: int | None = None """*Optional*. The direction in which user is moving, in degrees; 1-360. For active live locations only.""" - proximity_alert_radius: Optional[int] = None + proximity_alert_radius: int | None = None """*Optional*. The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.""" if TYPE_CHECKING: @@ -34,10 +34,10 @@ class Location(TelegramObject): *, latitude: float, longitude: float, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/location_address.py b/aiogram/types/location_address.py index ad316bfa..dce668bf 100644 --- a/aiogram/types/location_address.py +++ b/aiogram/types/location_address.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -14,11 +14,11 @@ class LocationAddress(TelegramObject): country_code: str """The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located""" - state: Optional[str] = None + state: str | None = None """*Optional*. State of the location""" - city: Optional[str] = None + city: str | None = None """*Optional*. City of the location""" - street: Optional[str] = None + street: str | None = None """*Optional*. Street address of the location""" if TYPE_CHECKING: @@ -29,9 +29,9 @@ class LocationAddress(TelegramObject): __pydantic__self__, *, country_code: str, - state: Optional[str] = None, - city: Optional[str] = None, - street: Optional[str] = None, + state: str | None = None, + city: str | None = None, + street: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/login_url.py b/aiogram/types/login_url.py index 6f6c94af..0f8a64a1 100644 --- a/aiogram/types/login_url.py +++ b/aiogram/types/login_url.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -17,11 +17,11 @@ class LoginUrl(TelegramObject): url: str """An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in `Receiving authorization data `_.""" - forward_text: Optional[str] = None + forward_text: str | None = None """*Optional*. New text of the button in forwarded messages.""" - bot_username: Optional[str] = None + bot_username: str | None = None """*Optional*. Username of a bot, which will be used for user authorization. See `Setting up a bot `_ for more details. If not specified, the current bot's username will be assumed. The *url*'s domain must be the same as the domain linked with the bot. See `Linking your domain to the bot `_ for more details.""" - request_write_access: Optional[bool] = None + request_write_access: bool | None = None """*Optional*. Pass :code:`True` to request the permission for your bot to send messages to the user.""" if TYPE_CHECKING: @@ -32,9 +32,9 @@ class LoginUrl(TelegramObject): __pydantic__self__, *, url: str, - forward_text: Optional[str] = None, - bot_username: Optional[str] = None, - request_write_access: Optional[bool] = None, + forward_text: str | None = None, + bot_username: str | None = None, + request_write_access: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/maybe_inaccessible_message_union.py b/aiogram/types/maybe_inaccessible_message_union.py index dfd6bfac..d5829772 100644 --- a/aiogram/types/maybe_inaccessible_message_union.py +++ b/aiogram/types/maybe_inaccessible_message_union.py @@ -1,8 +1,8 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .inaccessible_message import InaccessibleMessage from .message import Message -MaybeInaccessibleMessageUnion = Union[Message, InaccessibleMessage] +MaybeInaccessibleMessageUnion: TypeAlias = Message | InaccessibleMessage diff --git a/aiogram/types/media_union.py b/aiogram/types/media_union.py index 0e010931..cdc97398 100644 --- a/aiogram/types/media_union.py +++ b/aiogram/types/media_union.py @@ -1,8 +1,8 @@ -from typing import Union +from typing import TypeAlias from .input_media_audio import InputMediaAudio from .input_media_document import InputMediaDocument from .input_media_photo import InputMediaPhoto from .input_media_video import InputMediaVideo -MediaUnion = Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo] +MediaUnion: TypeAlias = InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo diff --git a/aiogram/types/menu_button.py b/aiogram/types/menu_button.py index 4c4fbf3b..e78b0df3 100644 --- a/aiogram/types/menu_button.py +++ b/aiogram/types/menu_button.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import MutableTelegramObject @@ -23,9 +23,9 @@ class MenuButton(MutableTelegramObject): type: str """Type of the button""" - text: Optional[str] = None + text: str | None = None """*Optional*. Text on the button""" - web_app: Optional[WebAppInfo] = None + web_app: WebAppInfo | None = None """*Optional*. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :class:`aiogram.methods.answer_web_app_query.AnswerWebAppQuery`. Alternatively, a :code:`t.me` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.""" if TYPE_CHECKING: @@ -36,8 +36,8 @@ class MenuButton(MutableTelegramObject): __pydantic__self__, *, type: str, - text: Optional[str] = None, - web_app: Optional[WebAppInfo] = None, + text: str | None = None, + web_app: WebAppInfo | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/menu_button_union.py b/aiogram/types/menu_button_union.py index f880cdc3..9178de3d 100644 --- a/aiogram/types/menu_button_union.py +++ b/aiogram/types/menu_button_union.py @@ -1,9 +1,9 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .menu_button_commands import MenuButtonCommands from .menu_button_default import MenuButtonDefault from .menu_button_web_app import MenuButtonWebApp -MenuButtonUnion = Union[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault] +MenuButtonUnion: TypeAlias = MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault diff --git a/aiogram/types/message.py b/aiogram/types/message.py index 53032360..f740e224 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -143,237 +143,237 @@ class Message(MaybeInaccessibleMessage): """Date the message was sent in Unix time. It is always a positive number, representing a valid date.""" chat: Chat """Chat the message belongs to""" - message_thread_id: Optional[int] = None + message_thread_id: int | None = None """*Optional*. Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only""" - direct_messages_topic: Optional[DirectMessagesTopic] = None + direct_messages_topic: DirectMessagesTopic | None = None """*Optional*. Information about the direct messages chat topic that contains the message""" - from_user: Optional[User] = Field(None, alias="from") + from_user: User | None = Field(None, alias="from") """*Optional*. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats""" - sender_chat: Optional[Chat] = None + sender_chat: Chat | None = None """*Optional*. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field *from* contains a fake sender user in non-channel chats.""" - sender_boost_count: Optional[int] = None + sender_boost_count: int | None = None """*Optional*. If the sender of the message boosted the chat, the number of boosts added by the user""" - sender_business_bot: Optional[User] = None + sender_business_bot: User | None = None """*Optional*. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.""" - business_connection_id: Optional[str] = None + business_connection_id: str | None = None """*Optional*. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.""" - forward_origin: Optional[MessageOriginUnion] = None + forward_origin: MessageOriginUnion | None = None """*Optional*. Information about the original message for forwarded messages""" - is_topic_message: Optional[bool] = None + is_topic_message: bool | None = None """*Optional*. :code:`True`, if the message is sent to a topic in a forum supergroup or a private chat with the bot""" - is_automatic_forward: Optional[bool] = None + is_automatic_forward: bool | None = None """*Optional*. :code:`True`, if the message is a channel post that was automatically forwarded to the connected discussion group""" - reply_to_message: Optional[Message] = None + reply_to_message: Message | None = None """*Optional*. For replies in the same chat and message thread, the original message. Note that the :class:`aiogram.types.message.Message` object in this field will not contain further *reply_to_message* fields even if it itself is a reply.""" - external_reply: Optional[ExternalReplyInfo] = None + external_reply: ExternalReplyInfo | None = None """*Optional*. Information about the message that is being replied to, which may come from another chat or forum topic""" - quote: Optional[TextQuote] = None + quote: TextQuote | None = None """*Optional*. For replies that quote part of the original message, the quoted part of the message""" - reply_to_story: Optional[Story] = None + reply_to_story: Story | None = None """*Optional*. For replies to a story, the original story""" - reply_to_checklist_task_id: Optional[int] = None + reply_to_checklist_task_id: int | None = None """*Optional*. Identifier of the specific checklist task that is being replied to""" - via_bot: Optional[User] = None + via_bot: User | None = None """*Optional*. Bot through which the message was sent""" - edit_date: Optional[int] = None + edit_date: int | None = None """*Optional*. Date the message was last edited in Unix time""" - has_protected_content: Optional[bool] = None + has_protected_content: bool | None = None """*Optional*. :code:`True`, if the message can't be forwarded""" - is_from_offline: Optional[bool] = None + is_from_offline: bool | None = None """*Optional*. :code:`True`, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message""" - is_paid_post: Optional[bool] = None + is_paid_post: bool | None = None """*Optional*. :code:`True`, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited.""" - media_group_id: Optional[str] = None + media_group_id: str | None = None """*Optional*. The unique identifier of a media message group this message belongs to""" - author_signature: Optional[str] = None + author_signature: str | None = None """*Optional*. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator""" - paid_star_count: Optional[int] = None + paid_star_count: int | None = None """*Optional*. The number of Telegram Stars that were paid by the sender of the message to send it""" - text: Optional[str] = None + text: str | None = None """*Optional*. For text messages, the actual UTF-8 text of the message""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """*Optional*. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text""" - link_preview_options: Optional[LinkPreviewOptions] = None + link_preview_options: LinkPreviewOptions | None = None """*Optional*. Options used for link preview generation for the message, if it is a text message and link preview options were changed""" - suggested_post_info: Optional[SuggestedPostInfo] = None + suggested_post_info: SuggestedPostInfo | None = None """*Optional*. Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited.""" - effect_id: Optional[str] = None + effect_id: str | None = None """*Optional*. Unique identifier of the message effect added to the message""" - animation: Optional[Animation] = None + animation: Animation | None = None """*Optional*. Message is an animation, information about the animation. For backward compatibility, when this field is set, the *document* field will also be set""" - audio: Optional[Audio] = None + audio: Audio | None = None """*Optional*. Message is an audio file, information about the file""" - document: Optional[Document] = None + document: Document | None = None """*Optional*. Message is a general file, information about the file""" - paid_media: Optional[PaidMediaInfo] = None + paid_media: PaidMediaInfo | None = None """*Optional*. Message contains paid media; information about the paid media""" - photo: Optional[list[PhotoSize]] = None + photo: list[PhotoSize] | None = None """*Optional*. Message is a photo, available sizes of the photo""" - sticker: Optional[Sticker] = None + sticker: Sticker | None = None """*Optional*. Message is a sticker, information about the sticker""" - story: Optional[Story] = None + story: Story | None = None """*Optional*. Message is a forwarded story""" - video: Optional[Video] = None + video: Video | None = None """*Optional*. Message is a video, information about the video""" - video_note: Optional[VideoNote] = None + video_note: VideoNote | None = None """*Optional*. Message is a `video note `_, information about the video message""" - voice: Optional[Voice] = None + voice: Voice | None = None """*Optional*. Message is a voice message, information about the file""" - caption: Optional[str] = None + caption: str | None = None """*Optional*. Caption for the animation, audio, document, paid media, photo, video or voice""" - caption_entities: Optional[list[MessageEntity]] = None + caption_entities: list[MessageEntity] | None = None """*Optional*. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption""" - show_caption_above_media: Optional[bool] = None + show_caption_above_media: bool | None = None """*Optional*. :code:`True`, if the caption must be shown above the message media""" - has_media_spoiler: Optional[bool] = None + has_media_spoiler: bool | None = None """*Optional*. :code:`True`, if the message media is covered by a spoiler animation""" - checklist: Optional[Checklist] = None + checklist: Checklist | None = None """*Optional*. Message is a checklist""" - contact: Optional[Contact] = None + contact: Contact | None = None """*Optional*. Message is a shared contact, information about the contact""" - dice: Optional[Dice] = None + dice: Dice | None = None """*Optional*. Message is a dice with random value""" - game: Optional[Game] = None + game: Game | None = None """*Optional*. Message is a game, information about the game. `More about games » `_""" - poll: Optional[Poll] = None + poll: Poll | None = None """*Optional*. Message is a native poll, information about the poll""" - venue: Optional[Venue] = None + venue: Venue | None = None """*Optional*. Message is a venue, information about the venue. For backward compatibility, when this field is set, the *location* field will also be set""" - location: Optional[Location] = None + location: Location | None = None """*Optional*. Message is a shared location, information about the location""" - new_chat_members: Optional[list[User]] = None + new_chat_members: list[User] | None = None """*Optional*. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)""" - left_chat_member: Optional[User] = None + left_chat_member: User | None = None """*Optional*. A member was removed from the group, information about them (this member may be the bot itself)""" - new_chat_title: Optional[str] = None + new_chat_title: str | None = None """*Optional*. A chat title was changed to this value""" - new_chat_photo: Optional[list[PhotoSize]] = None + new_chat_photo: list[PhotoSize] | None = None """*Optional*. A chat photo was change to this value""" - delete_chat_photo: Optional[bool] = None + delete_chat_photo: bool | None = None """*Optional*. Service message: the chat photo was deleted""" - group_chat_created: Optional[bool] = None + group_chat_created: bool | None = None """*Optional*. Service message: the group has been created""" - supergroup_chat_created: Optional[bool] = None + supergroup_chat_created: bool | None = None """*Optional*. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.""" - channel_chat_created: Optional[bool] = None + channel_chat_created: bool | None = None """*Optional*. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.""" - message_auto_delete_timer_changed: Optional[MessageAutoDeleteTimerChanged] = None + message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged | None = None """*Optional*. Service message: auto-delete timer settings changed in the chat""" - migrate_to_chat_id: Optional[int] = None + migrate_to_chat_id: int | None = None """*Optional*. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.""" - migrate_from_chat_id: Optional[int] = None + migrate_from_chat_id: int | None = None """*Optional*. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.""" - pinned_message: Optional[MaybeInaccessibleMessageUnion] = None + pinned_message: MaybeInaccessibleMessageUnion | None = None """*Optional*. Specified message was pinned. Note that the :class:`aiogram.types.message.Message` object in this field will not contain further *reply_to_message* fields even if it itself is a reply.""" - invoice: Optional[Invoice] = None + invoice: Invoice | None = None """*Optional*. Message is an invoice for a `payment `_, information about the invoice. `More about payments » `_""" - successful_payment: Optional[SuccessfulPayment] = None + successful_payment: SuccessfulPayment | None = None """*Optional*. Message is a service message about a successful payment, information about the payment. `More about payments » `_""" - refunded_payment: Optional[RefundedPayment] = None + refunded_payment: RefundedPayment | None = None """*Optional*. Message is a service message about a refunded payment, information about the payment. `More about payments » `_""" - users_shared: Optional[UsersShared] = None + users_shared: UsersShared | None = None """*Optional*. Service message: users were shared with the bot""" - chat_shared: Optional[ChatShared] = None + chat_shared: ChatShared | None = None """*Optional*. Service message: a chat was shared with the bot""" - gift: Optional[GiftInfo] = None + gift: GiftInfo | None = None """*Optional*. Service message: a regular gift was sent or received""" - unique_gift: Optional[UniqueGiftInfo] = None + unique_gift: UniqueGiftInfo | None = None """*Optional*. Service message: a unique gift was sent or received""" - gift_upgrade_sent: Optional[GiftInfo] = None + gift_upgrade_sent: GiftInfo | None = None """*Optional*. Service message: upgrade of a gift was purchased after the gift was sent""" - connected_website: Optional[str] = None + connected_website: str | None = None """*Optional*. The domain name of the website on which the user has logged in. `More about Telegram Login » `_""" - write_access_allowed: Optional[WriteAccessAllowed] = None + write_access_allowed: WriteAccessAllowed | None = None """*Optional*. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method `requestWriteAccess `_""" - passport_data: Optional[PassportData] = None + passport_data: PassportData | None = None """*Optional*. Telegram Passport data""" - proximity_alert_triggered: Optional[ProximityAlertTriggered] = None + proximity_alert_triggered: ProximityAlertTriggered | None = None """*Optional*. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.""" - boost_added: Optional[ChatBoostAdded] = None + boost_added: ChatBoostAdded | None = None """*Optional*. Service message: user boosted the chat""" - chat_background_set: Optional[ChatBackground] = None + chat_background_set: ChatBackground | None = None """*Optional*. Service message: chat background set""" - checklist_tasks_done: Optional[ChecklistTasksDone] = None + checklist_tasks_done: ChecklistTasksDone | None = None """*Optional*. Service message: some tasks in a checklist were marked as done or not done""" - checklist_tasks_added: Optional[ChecklistTasksAdded] = None + checklist_tasks_added: ChecklistTasksAdded | None = None """*Optional*. Service message: tasks were added to a checklist""" - direct_message_price_changed: Optional[DirectMessagePriceChanged] = None + direct_message_price_changed: DirectMessagePriceChanged | None = None """*Optional*. Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed""" - forum_topic_created: Optional[ForumTopicCreated] = None + forum_topic_created: ForumTopicCreated | None = None """*Optional*. Service message: forum topic created""" - forum_topic_edited: Optional[ForumTopicEdited] = None + forum_topic_edited: ForumTopicEdited | None = None """*Optional*. Service message: forum topic edited""" - forum_topic_closed: Optional[ForumTopicClosed] = None + forum_topic_closed: ForumTopicClosed | None = None """*Optional*. Service message: forum topic closed""" - forum_topic_reopened: Optional[ForumTopicReopened] = None + forum_topic_reopened: ForumTopicReopened | None = None """*Optional*. Service message: forum topic reopened""" - general_forum_topic_hidden: Optional[GeneralForumTopicHidden] = None + general_forum_topic_hidden: GeneralForumTopicHidden | None = None """*Optional*. Service message: the 'General' forum topic hidden""" - general_forum_topic_unhidden: Optional[GeneralForumTopicUnhidden] = None + general_forum_topic_unhidden: GeneralForumTopicUnhidden | None = None """*Optional*. Service message: the 'General' forum topic unhidden""" - giveaway_created: Optional[GiveawayCreated] = None + giveaway_created: GiveawayCreated | None = None """*Optional*. Service message: a scheduled giveaway was created""" - giveaway: Optional[Giveaway] = None + giveaway: Giveaway | None = None """*Optional*. The message is a scheduled giveaway message""" - giveaway_winners: Optional[GiveawayWinners] = None + giveaway_winners: GiveawayWinners | None = None """*Optional*. A giveaway with public winners was completed""" - giveaway_completed: Optional[GiveawayCompleted] = None + giveaway_completed: GiveawayCompleted | None = None """*Optional*. Service message: a giveaway without public winners was completed""" - paid_message_price_changed: Optional[PaidMessagePriceChanged] = None + paid_message_price_changed: PaidMessagePriceChanged | None = None """*Optional*. Service message: the price for paid messages has changed in the chat""" - suggested_post_approved: Optional[SuggestedPostApproved] = None + suggested_post_approved: SuggestedPostApproved | None = None """*Optional*. Service message: a suggested post was approved""" - suggested_post_approval_failed: Optional[SuggestedPostApprovalFailed] = None + suggested_post_approval_failed: SuggestedPostApprovalFailed | None = None """*Optional*. Service message: approval of a suggested post has failed""" - suggested_post_declined: Optional[SuggestedPostDeclined] = None + suggested_post_declined: SuggestedPostDeclined | None = None """*Optional*. Service message: a suggested post was declined""" - suggested_post_paid: Optional[SuggestedPostPaid] = None + suggested_post_paid: SuggestedPostPaid | None = None """*Optional*. Service message: payment for a suggested post was received""" - suggested_post_refunded: Optional[SuggestedPostRefunded] = None + suggested_post_refunded: SuggestedPostRefunded | None = None """*Optional*. Service message: payment for a suggested post was refunded""" - video_chat_scheduled: Optional[VideoChatScheduled] = None + video_chat_scheduled: VideoChatScheduled | None = None """*Optional*. Service message: video chat scheduled""" - video_chat_started: Optional[VideoChatStarted] = None + video_chat_started: VideoChatStarted | None = None """*Optional*. Service message: video chat started""" - video_chat_ended: Optional[VideoChatEnded] = None + video_chat_ended: VideoChatEnded | None = None """*Optional*. Service message: video chat ended""" - video_chat_participants_invited: Optional[VideoChatParticipantsInvited] = None + video_chat_participants_invited: VideoChatParticipantsInvited | None = None """*Optional*. Service message: new participants invited to a video chat""" - web_app_data: Optional[WebAppData] = None + web_app_data: WebAppData | None = None """*Optional*. Service message: data sent by a Web App""" - reply_markup: Optional[InlineKeyboardMarkup] = None + reply_markup: InlineKeyboardMarkup | None = None """*Optional*. Inline keyboard attached to the message. :code:`login_url` buttons are represented as ordinary :code:`url` buttons.""" - forward_date: Optional[DateTime] = Field(None, json_schema_extra={"deprecated": True}) + forward_date: DateTime | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For forwarded messages, date the original message was sent in Unix time .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - forward_from: Optional[User] = Field(None, json_schema_extra={"deprecated": True}) + forward_from: User | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For forwarded messages, sender of the original message .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - forward_from_chat: Optional[Chat] = Field(None, json_schema_extra={"deprecated": True}) + forward_from_chat: Chat | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For messages forwarded from channels or from anonymous administrators, information about the original sender chat .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - forward_from_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + forward_from_message_id: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For messages forwarded from channels, identifier of the original message in the channel .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - forward_sender_name: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + forward_sender_name: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - forward_signature: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) + forward_signature: str | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present .. deprecated:: API:7.0 https://core.telegram.org/bots/api-changelog#december-29-2023""" - user_shared: Optional[UserShared] = Field(None, json_schema_extra={"deprecated": True}) + user_shared: UserShared | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. Service message: a user was shared with the bot .. deprecated:: API:7.0 @@ -389,113 +389,113 @@ class Message(MaybeInaccessibleMessage): message_id: int, date: DateTime, chat: Chat, - message_thread_id: Optional[int] = None, - direct_messages_topic: Optional[DirectMessagesTopic] = None, - from_user: Optional[User] = None, - sender_chat: Optional[Chat] = None, - sender_boost_count: Optional[int] = None, - sender_business_bot: Optional[User] = None, - business_connection_id: Optional[str] = None, - forward_origin: Optional[MessageOriginUnion] = None, - is_topic_message: Optional[bool] = None, - is_automatic_forward: Optional[bool] = None, - reply_to_message: Optional[Message] = None, - external_reply: Optional[ExternalReplyInfo] = None, - quote: Optional[TextQuote] = None, - reply_to_story: Optional[Story] = None, - reply_to_checklist_task_id: Optional[int] = None, - via_bot: Optional[User] = None, - edit_date: Optional[int] = None, - has_protected_content: Optional[bool] = None, - is_from_offline: Optional[bool] = None, - is_paid_post: Optional[bool] = None, - media_group_id: Optional[str] = None, - author_signature: Optional[str] = None, - paid_star_count: Optional[int] = None, - text: Optional[str] = None, - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[LinkPreviewOptions] = None, - suggested_post_info: Optional[SuggestedPostInfo] = None, - effect_id: Optional[str] = None, - animation: Optional[Animation] = None, - audio: Optional[Audio] = None, - document: Optional[Document] = None, - paid_media: Optional[PaidMediaInfo] = None, - photo: Optional[list[PhotoSize]] = None, - sticker: Optional[Sticker] = None, - story: Optional[Story] = None, - video: Optional[Video] = None, - video_note: Optional[VideoNote] = None, - voice: Optional[Voice] = None, - caption: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[bool] = None, - has_media_spoiler: Optional[bool] = None, - checklist: Optional[Checklist] = None, - contact: Optional[Contact] = None, - dice: Optional[Dice] = None, - game: Optional[Game] = None, - poll: Optional[Poll] = None, - venue: Optional[Venue] = None, - location: Optional[Location] = None, - new_chat_members: Optional[list[User]] = None, - left_chat_member: Optional[User] = None, - new_chat_title: Optional[str] = None, - new_chat_photo: Optional[list[PhotoSize]] = None, - delete_chat_photo: Optional[bool] = None, - group_chat_created: Optional[bool] = None, - supergroup_chat_created: Optional[bool] = None, - channel_chat_created: Optional[bool] = None, - message_auto_delete_timer_changed: Optional[MessageAutoDeleteTimerChanged] = None, - migrate_to_chat_id: Optional[int] = None, - migrate_from_chat_id: Optional[int] = None, - pinned_message: Optional[MaybeInaccessibleMessageUnion] = None, - invoice: Optional[Invoice] = None, - successful_payment: Optional[SuccessfulPayment] = None, - refunded_payment: Optional[RefundedPayment] = None, - users_shared: Optional[UsersShared] = None, - chat_shared: Optional[ChatShared] = None, - gift: Optional[GiftInfo] = None, - unique_gift: Optional[UniqueGiftInfo] = None, - gift_upgrade_sent: Optional[GiftInfo] = None, - connected_website: Optional[str] = None, - write_access_allowed: Optional[WriteAccessAllowed] = None, - passport_data: Optional[PassportData] = None, - proximity_alert_triggered: Optional[ProximityAlertTriggered] = None, - boost_added: Optional[ChatBoostAdded] = None, - chat_background_set: Optional[ChatBackground] = None, - checklist_tasks_done: Optional[ChecklistTasksDone] = None, - checklist_tasks_added: Optional[ChecklistTasksAdded] = None, - direct_message_price_changed: Optional[DirectMessagePriceChanged] = None, - forum_topic_created: Optional[ForumTopicCreated] = None, - forum_topic_edited: Optional[ForumTopicEdited] = None, - forum_topic_closed: Optional[ForumTopicClosed] = None, - forum_topic_reopened: Optional[ForumTopicReopened] = None, - general_forum_topic_hidden: Optional[GeneralForumTopicHidden] = None, - general_forum_topic_unhidden: Optional[GeneralForumTopicUnhidden] = None, - giveaway_created: Optional[GiveawayCreated] = None, - giveaway: Optional[Giveaway] = None, - giveaway_winners: Optional[GiveawayWinners] = None, - giveaway_completed: Optional[GiveawayCompleted] = None, - paid_message_price_changed: Optional[PaidMessagePriceChanged] = None, - suggested_post_approved: Optional[SuggestedPostApproved] = None, - suggested_post_approval_failed: Optional[SuggestedPostApprovalFailed] = None, - suggested_post_declined: Optional[SuggestedPostDeclined] = None, - suggested_post_paid: Optional[SuggestedPostPaid] = None, - suggested_post_refunded: Optional[SuggestedPostRefunded] = None, - video_chat_scheduled: Optional[VideoChatScheduled] = None, - video_chat_started: Optional[VideoChatStarted] = None, - video_chat_ended: Optional[VideoChatEnded] = None, - video_chat_participants_invited: Optional[VideoChatParticipantsInvited] = None, - web_app_data: Optional[WebAppData] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - forward_date: Optional[DateTime] = None, - forward_from: Optional[User] = None, - forward_from_chat: Optional[Chat] = None, - forward_from_message_id: Optional[int] = None, - forward_sender_name: Optional[str] = None, - forward_signature: Optional[str] = None, - user_shared: Optional[UserShared] = None, + message_thread_id: int | None = None, + direct_messages_topic: DirectMessagesTopic | None = None, + from_user: User | None = None, + sender_chat: Chat | None = None, + sender_boost_count: int | None = None, + sender_business_bot: User | None = None, + business_connection_id: str | None = None, + forward_origin: MessageOriginUnion | None = None, + is_topic_message: bool | None = None, + is_automatic_forward: bool | None = None, + reply_to_message: Message | None = None, + external_reply: ExternalReplyInfo | None = None, + quote: TextQuote | None = None, + reply_to_story: Story | None = None, + reply_to_checklist_task_id: int | None = None, + via_bot: User | None = None, + edit_date: int | None = None, + has_protected_content: bool | None = None, + is_from_offline: bool | None = None, + is_paid_post: bool | None = None, + media_group_id: str | None = None, + author_signature: str | None = None, + paid_star_count: int | None = None, + text: str | None = None, + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | None = None, + suggested_post_info: SuggestedPostInfo | None = None, + effect_id: str | None = None, + animation: Animation | None = None, + audio: Audio | None = None, + document: Document | None = None, + paid_media: PaidMediaInfo | None = None, + photo: list[PhotoSize] | None = None, + sticker: Sticker | None = None, + story: Story | None = None, + video: Video | None = None, + video_note: VideoNote | None = None, + voice: Voice | None = None, + caption: str | None = None, + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | None = None, + has_media_spoiler: bool | None = None, + checklist: Checklist | None = None, + contact: Contact | None = None, + dice: Dice | None = None, + game: Game | None = None, + poll: Poll | None = None, + venue: Venue | None = None, + location: Location | None = None, + new_chat_members: list[User] | None = None, + left_chat_member: User | None = None, + new_chat_title: str | None = None, + new_chat_photo: list[PhotoSize] | None = None, + delete_chat_photo: bool | None = None, + group_chat_created: bool | None = None, + supergroup_chat_created: bool | None = None, + channel_chat_created: bool | None = None, + message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged | None = None, + migrate_to_chat_id: int | None = None, + migrate_from_chat_id: int | None = None, + pinned_message: MaybeInaccessibleMessageUnion | None = None, + invoice: Invoice | None = None, + successful_payment: SuccessfulPayment | None = None, + refunded_payment: RefundedPayment | None = None, + users_shared: UsersShared | None = None, + chat_shared: ChatShared | None = None, + gift: GiftInfo | None = None, + unique_gift: UniqueGiftInfo | None = None, + gift_upgrade_sent: GiftInfo | None = None, + connected_website: str | None = None, + write_access_allowed: WriteAccessAllowed | None = None, + passport_data: PassportData | None = None, + proximity_alert_triggered: ProximityAlertTriggered | None = None, + boost_added: ChatBoostAdded | None = None, + chat_background_set: ChatBackground | None = None, + checklist_tasks_done: ChecklistTasksDone | None = None, + checklist_tasks_added: ChecklistTasksAdded | None = None, + direct_message_price_changed: DirectMessagePriceChanged | None = None, + forum_topic_created: ForumTopicCreated | None = None, + forum_topic_edited: ForumTopicEdited | None = None, + forum_topic_closed: ForumTopicClosed | None = None, + forum_topic_reopened: ForumTopicReopened | None = None, + general_forum_topic_hidden: GeneralForumTopicHidden | None = None, + general_forum_topic_unhidden: GeneralForumTopicUnhidden | None = None, + giveaway_created: GiveawayCreated | None = None, + giveaway: Giveaway | None = None, + giveaway_winners: GiveawayWinners | None = None, + giveaway_completed: GiveawayCompleted | None = None, + paid_message_price_changed: PaidMessagePriceChanged | None = None, + suggested_post_approved: SuggestedPostApproved | None = None, + suggested_post_approval_failed: SuggestedPostApprovalFailed | None = None, + suggested_post_declined: SuggestedPostDeclined | None = None, + suggested_post_paid: SuggestedPostPaid | None = None, + suggested_post_refunded: SuggestedPostRefunded | None = None, + video_chat_scheduled: VideoChatScheduled | None = None, + video_chat_started: VideoChatStarted | None = None, + video_chat_ended: VideoChatEnded | None = None, + video_chat_participants_invited: VideoChatParticipantsInvited | None = None, + web_app_data: WebAppData | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + forward_date: DateTime | None = None, + forward_from: User | None = None, + forward_from_chat: Chat | None = None, + forward_from_message_id: int | None = None, + forward_sender_name: str | None = None, + forward_signature: str | None = None, + user_shared: UserShared | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -773,13 +773,13 @@ class Message(MaybeInaccessibleMessage): def as_reply_parameters( self, - allow_sending_without_reply: Optional[Union[bool, Default]] = Default( + allow_sending_without_reply: bool | Default | None = Default( "allow_sending_without_reply" ), - quote: Optional[str] = None, - quote_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - quote_entities: Optional[List[MessageEntity]] = None, - quote_position: Optional[int] = None, + quote: str | None = None, + quote_parse_mode: str | Default | None = Default("parse_mode"), + quote_entities: list[MessageEntity] | None = None, + quote_position: int | None = None, ) -> ReplyParameters: return ReplyParameters( message_id=self.message_id, @@ -794,25 +794,23 @@ class Message(MaybeInaccessibleMessage): def reply_animation( self, animation: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendAnimation: """ @@ -886,27 +884,25 @@ class Message(MaybeInaccessibleMessage): def answer_animation( self, animation: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAnimation: """ @@ -982,21 +978,21 @@ class Message(MaybeInaccessibleMessage): def reply_audio( self, audio: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendAudio: """ @@ -1067,23 +1063,23 @@ class Message(MaybeInaccessibleMessage): def answer_audio( self, audio: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - performer: Optional[str] = None, - title: Optional[str] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + performer: str | None = None, + title: str | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendAudio: """ @@ -1157,16 +1153,16 @@ class Message(MaybeInaccessibleMessage): self, phone_number: str, first_name: str, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendContact: """ @@ -1229,18 +1225,18 @@ class Message(MaybeInaccessibleMessage): self, phone_number: str, first_name: str, - direct_messages_topic_id: Optional[int] = None, - last_name: Optional[str] = None, - vcard: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + last_name: str | None = None, + vcard: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendContact: """ @@ -1304,19 +1300,19 @@ class Message(MaybeInaccessibleMessage): def reply_document( self, document: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendDocument: """ @@ -1382,21 +1378,21 @@ class Message(MaybeInaccessibleMessage): def answer_document( self, document: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - disable_content_type_detection: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + thumbnail: InputFile | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + disable_content_type_detection: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDocument: """ @@ -1464,12 +1460,12 @@ class Message(MaybeInaccessibleMessage): def reply_game( self, game_short_name: str, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendGame: """ @@ -1521,14 +1517,14 @@ class Message(MaybeInaccessibleMessage): def answer_game( self, game_short_name: str, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendGame: """ @@ -1586,30 +1582,30 @@ class Message(MaybeInaccessibleMessage): payload: str, currency: str, prices: list[LabeledPrice], - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendInvoice: """ @@ -1709,32 +1705,32 @@ class Message(MaybeInaccessibleMessage): payload: str, currency: str, prices: list[LabeledPrice], - direct_messages_topic_id: Optional[int] = None, - provider_token: Optional[str] = None, - max_tip_amount: Optional[int] = None, - suggested_tip_amounts: Optional[list[int]] = None, - start_parameter: Optional[str] = None, - provider_data: Optional[str] = None, - photo_url: Optional[str] = None, - photo_size: Optional[int] = None, - photo_width: Optional[int] = None, - photo_height: Optional[int] = None, - need_name: Optional[bool] = None, - need_phone_number: Optional[bool] = None, - need_email: Optional[bool] = None, - need_shipping_address: Optional[bool] = None, - send_phone_number_to_provider: Optional[bool] = None, - send_email_to_provider: Optional[bool] = None, - is_flexible: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + provider_token: str | None = None, + max_tip_amount: int | None = None, + suggested_tip_amounts: list[int] | None = None, + start_parameter: str | None = None, + provider_data: str | None = None, + photo_url: str | None = None, + photo_size: int | None = None, + photo_width: int | None = None, + photo_height: int | None = None, + need_name: bool | None = None, + need_phone_number: bool | None = None, + need_email: bool | None = None, + need_shipping_address: bool | None = None, + send_phone_number_to_provider: bool | None = None, + send_email_to_provider: bool | None = None, + is_flexible: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendInvoice: """ @@ -1833,18 +1829,18 @@ class Message(MaybeInaccessibleMessage): self, latitude: float, longitude: float, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendLocation: """ @@ -1911,20 +1907,20 @@ class Message(MaybeInaccessibleMessage): self, latitude: float, longitude: float, - direct_messages_topic_id: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - live_period: Optional[int] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + horizontal_accuracy: float | None = None, + live_period: int | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendLocation: """ @@ -1992,12 +1988,12 @@ class Message(MaybeInaccessibleMessage): def reply_media_group( self, media: list[MediaUnion], - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendMediaGroup: """ @@ -2049,14 +2045,14 @@ class Message(MaybeInaccessibleMessage): def answer_media_group( self, media: list[MediaUnion], - direct_messages_topic_id: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMediaGroup: """ @@ -2110,22 +2106,18 @@ class Message(MaybeInaccessibleMessage): def reply( self, text: str, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), **kwargs: Any, ) -> SendMessage: """ @@ -2189,24 +2181,20 @@ class Message(MaybeInaccessibleMessage): def answer( self, text: str, - direct_messages_topic_id: Optional[int] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendMessage: """ @@ -2272,21 +2260,19 @@ class Message(MaybeInaccessibleMessage): def reply_photo( self, photo: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendPhoto: """ @@ -2352,23 +2338,21 @@ class Message(MaybeInaccessibleMessage): def answer_photo( self, photo: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPhoto: """ @@ -2437,24 +2421,24 @@ class Message(MaybeInaccessibleMessage): self, question: str, options: list[InputPollOptionUnion], - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendPoll: """ @@ -2533,26 +2517,26 @@ class Message(MaybeInaccessibleMessage): self, question: str, options: list[InputPollOptionUnion], - question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - question_entities: Optional[list[MessageEntity]] = None, - is_anonymous: Optional[bool] = None, - type: Optional[str] = None, - allows_multiple_answers: Optional[bool] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTimeUnion] = None, - is_closed: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + question_parse_mode: str | Default | None = Default("parse_mode"), + question_entities: list[MessageEntity] | None = None, + is_anonymous: bool | None = None, + type: str | None = None, + allows_multiple_answers: bool | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_parse_mode: str | Default | None = Default("parse_mode"), + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTimeUnion | None = None, + is_closed: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendPoll: """ @@ -2631,15 +2615,15 @@ class Message(MaybeInaccessibleMessage): def reply_dice( self, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendDice: """ @@ -2694,17 +2678,17 @@ class Message(MaybeInaccessibleMessage): def answer_dice( self, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendDice: """ @@ -2762,15 +2746,15 @@ class Message(MaybeInaccessibleMessage): def reply_sticker( self, sticker: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendSticker: """ @@ -2828,17 +2812,17 @@ class Message(MaybeInaccessibleMessage): def answer_sticker( self, sticker: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - emoji: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + emoji: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendSticker: """ @@ -2901,18 +2885,18 @@ class Message(MaybeInaccessibleMessage): longitude: float, title: str, address: str, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVenue: """ @@ -2985,20 +2969,20 @@ class Message(MaybeInaccessibleMessage): longitude: float, title: str, address: str, - direct_messages_topic_id: Optional[int] = None, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVenue: """ @@ -3070,28 +3054,26 @@ class Message(MaybeInaccessibleMessage): def reply_video( self, video: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVideo: """ @@ -3171,30 +3153,28 @@ class Message(MaybeInaccessibleMessage): def answer_video( self, video: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - cover: Optional[InputFileUnion] = None, - start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - has_spoiler: Optional[bool] = None, - supports_streaming: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + width: int | None = None, + height: int | None = None, + thumbnail: InputFile | None = None, + cover: InputFileUnion | None = None, + start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + has_spoiler: bool | None = None, + supports_streaming: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideo: """ @@ -3276,17 +3256,17 @@ class Message(MaybeInaccessibleMessage): def reply_video_note( self, video_note: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVideoNote: """ @@ -3348,19 +3328,19 @@ class Message(MaybeInaccessibleMessage): def answer_video_note( self, video_note: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - duration: Optional[int] = None, - length: Optional[int] = None, - thumbnail: Optional[InputFile] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + duration: int | None = None, + length: int | None = None, + thumbnail: InputFile | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVideoNote: """ @@ -3424,18 +3404,18 @@ class Message(MaybeInaccessibleMessage): def reply_voice( self, voice: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, **kwargs: Any, ) -> SendVoice: """ @@ -3499,20 +3479,20 @@ class Message(MaybeInaccessibleMessage): def answer_voice( self, voice: InputFileUnion, - direct_messages_topic_id: Optional[int] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - duration: Optional[int] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + direct_messages_topic_id: int | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + duration: int | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> SendVoice: """ @@ -3577,33 +3557,33 @@ class Message(MaybeInaccessibleMessage): def send_copy( # noqa: C901 self: Message, - chat_id: Union[str, int], - disable_notification: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, None] = None, - allow_sending_without_reply: Optional[bool] = None, - message_thread_id: Optional[int] = None, - business_connection_id: Optional[str] = None, - parse_mode: Optional[str] = None, - message_effect_id: Optional[str] = None, - ) -> Union[ - ForwardMessage, - SendAnimation, - SendAudio, - SendContact, - SendDocument, - SendLocation, - SendMessage, - SendPhoto, - SendPoll, - SendDice, - SendSticker, - SendVenue, - SendVideo, - SendVideoNote, - SendVoice, - ]: + chat_id: ChatIdUnion, + disable_notification: bool | None = None, + reply_to_message_id: int | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | None = None, + allow_sending_without_reply: bool | None = None, + message_thread_id: int | None = None, + business_connection_id: str | None = None, + parse_mode: str | None = None, + message_effect_id: str | None = None, + ) -> ( + ForwardMessage + | SendAnimation + | SendAudio + | SendContact + | SendDocument + | SendLocation + | SendMessage + | SendPhoto + | SendPoll + | SendDice + | SendSticker + | SendVenue + | SendVideo + | SendVideoNote + | SendVoice + ): """ Send copy of a message. @@ -3645,7 +3625,7 @@ class Message(MaybeInaccessibleMessage): SendVoice, ) - kwargs: Dict[str, Any] = { + kwargs: dict[str, Any] = { "chat_id": chat_id, "reply_markup": reply_markup or self.reply_markup, "disable_notification": disable_notification, @@ -3775,24 +3755,22 @@ class Message(MaybeInaccessibleMessage): def copy_to( self, chat_id: ChatIdUnion, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - video_start_timestamp: Optional[DateTimeUnion] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - allow_paid_broadcast: Optional[bool] = None, - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, - allow_sending_without_reply: Optional[bool] = None, - reply_to_message_id: Optional[int] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + video_start_timestamp: DateTimeUnion | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + allow_paid_broadcast: bool | None = None, + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, + allow_sending_without_reply: bool | None = None, + reply_to_message_id: int | None = None, **kwargs: Any, ) -> CopyMessage: """ @@ -3860,16 +3838,12 @@ class Message(MaybeInaccessibleMessage): def edit_text( self, text: str, - inline_message_id: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - entities: Optional[list[MessageEntity]] = None, - link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( - "link_preview" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, - disable_web_page_preview: Optional[Union[bool, Default]] = Default( - "link_preview_is_disabled" - ), + inline_message_id: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + entities: list[MessageEntity] | None = None, + link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"), + reply_markup: InlineKeyboardMarkup | None = None, + disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"), **kwargs: Any, ) -> EditMessageText: """ @@ -3919,13 +3893,13 @@ class Message(MaybeInaccessibleMessage): def forward( self, chat_id: ChatIdUnion, - message_thread_id: Optional[int] = None, - direct_messages_topic_id: Optional[int] = None, - video_start_timestamp: Optional[DateTimeUnion] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[Union[bool, Default]] = Default("protect_content"), - message_effect_id: Optional[str] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, + message_thread_id: int | None = None, + direct_messages_topic_id: int | None = None, + video_start_timestamp: DateTimeUnion | None = None, + disable_notification: bool | None = None, + protect_content: bool | Default | None = Default("protect_content"), + message_effect_id: str | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, **kwargs: Any, ) -> ForwardMessage: """ @@ -3975,8 +3949,8 @@ class Message(MaybeInaccessibleMessage): def edit_media( self, media: InputMediaUnion, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **kwargs: Any, ) -> EditMessageMedia: """ @@ -4017,8 +3991,8 @@ class Message(MaybeInaccessibleMessage): def edit_reply_markup( self, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **kwargs: Any, ) -> EditMessageReplyMarkup: """ @@ -4057,7 +4031,7 @@ class Message(MaybeInaccessibleMessage): def delete_reply_markup( self, - inline_message_id: Optional[str] = None, + inline_message_id: str | None = None, **kwargs: Any, ) -> EditMessageReplyMarkup: """ @@ -4098,12 +4072,12 @@ class Message(MaybeInaccessibleMessage): self, latitude: float, longitude: float, - inline_message_id: Optional[str] = None, - live_period: Optional[int] = None, - horizontal_accuracy: Optional[float] = None, - heading: Optional[int] = None, - proximity_alert_radius: Optional[int] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + inline_message_id: str | None = None, + live_period: int | None = None, + horizontal_accuracy: float | None = None, + heading: int | None = None, + proximity_alert_radius: int | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **kwargs: Any, ) -> EditMessageLiveLocation: """ @@ -4154,8 +4128,8 @@ class Message(MaybeInaccessibleMessage): def stop_live_location( self, - inline_message_id: Optional[str] = None, - reply_markup: Optional[InlineKeyboardMarkup] = None, + inline_message_id: str | None = None, + reply_markup: InlineKeyboardMarkup | None = None, **kwargs: Any, ) -> StopMessageLiveLocation: """ @@ -4194,14 +4168,12 @@ class Message(MaybeInaccessibleMessage): def edit_caption( self, - inline_message_id: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[Union[bool, Default]] = Default( - "show_caption_above_media" - ), - reply_markup: Optional[InlineKeyboardMarkup] = None, + inline_message_id: str | None = None, + caption: str | None = None, + parse_mode: str | Default | None = Default("parse_mode"), + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | Default | None = Default("show_caption_above_media"), + reply_markup: InlineKeyboardMarkup | None = None, **kwargs: Any, ) -> EditMessageCaption: """ @@ -4302,7 +4274,7 @@ class Message(MaybeInaccessibleMessage): def pin( self, - disable_notification: Optional[bool] = None, + disable_notification: bool | None = None, **kwargs: Any, ) -> PinChatMessage: """ @@ -4371,9 +4343,7 @@ class Message(MaybeInaccessibleMessage): **kwargs, ).as_(self._bot) - def get_url( - self, force_private: bool = False, include_thread_id: bool = False - ) -> Optional[str]: + def get_url(self, force_private: bool = False, include_thread_id: bool = False) -> str | None: """ Returns message URL. Cannot be used in private (one-to-one) chats. If chat has a username, returns URL like https://t.me/username/message_id @@ -4402,8 +4372,8 @@ class Message(MaybeInaccessibleMessage): def react( self, - reaction: Optional[list[ReactionTypeUnion]] = None, - is_big: Optional[bool] = None, + reaction: list[ReactionTypeUnion] | None = None, + is_big: bool | None = None, **kwargs: Any, ) -> SetMessageReaction: """ @@ -4444,18 +4414,18 @@ class Message(MaybeInaccessibleMessage): self, star_count: int, media: list[InputPaidMediaUnion], - direct_messages_topic_id: Optional[int] = None, - payload: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - allow_paid_broadcast: Optional[bool] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_parameters: Optional[ReplyParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, + direct_messages_topic_id: int | None = None, + payload: str | None = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + allow_paid_broadcast: bool | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_parameters: ReplyParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, **kwargs: Any, ) -> SendPaidMedia: """ @@ -4520,17 +4490,17 @@ class Message(MaybeInaccessibleMessage): self, star_count: int, media: list[InputPaidMediaUnion], - direct_messages_topic_id: Optional[int] = None, - payload: Optional[str] = None, - caption: Optional[str] = None, - parse_mode: Optional[str] = None, - caption_entities: Optional[list[MessageEntity]] = None, - show_caption_above_media: Optional[bool] = None, - disable_notification: Optional[bool] = None, - protect_content: Optional[bool] = None, - allow_paid_broadcast: Optional[bool] = None, - suggested_post_parameters: Optional[SuggestedPostParameters] = None, - reply_markup: Optional[ReplyMarkupUnion] = None, + direct_messages_topic_id: int | None = None, + payload: str | None = None, + caption: str | None = None, + parse_mode: str | None = None, + caption_entities: list[MessageEntity] | None = None, + show_caption_above_media: bool | None = None, + disable_notification: bool | None = None, + protect_content: bool | None = None, + allow_paid_broadcast: bool | None = None, + suggested_post_parameters: SuggestedPostParameters | None = None, + reply_markup: ReplyMarkupUnion | None = None, **kwargs: Any, ) -> SendPaidMedia: """ diff --git a/aiogram/types/message_entity.py b/aiogram/types/message_entity.py index 5019fef3..608b8435 100644 --- a/aiogram/types/message_entity.py +++ b/aiogram/types/message_entity.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..utils.text_decorations import add_surrogates, remove_surrogates from .base import MutableTelegramObject @@ -22,13 +22,13 @@ class MessageEntity(MutableTelegramObject): """Offset in `UTF-16 code units `_ to the start of the entity""" length: int """Length of the entity in `UTF-16 code units `_""" - url: Optional[str] = None + url: str | None = None """*Optional*. For 'text_link' only, URL that will be opened after user taps on the text""" - user: Optional[User] = None + user: User | None = None """*Optional*. For 'text_mention' only, the mentioned user""" - language: Optional[str] = None + language: str | None = None """*Optional*. For 'pre' only, the programming language of the entity text""" - custom_emoji_id: Optional[str] = None + custom_emoji_id: str | None = None """*Optional*. For 'custom_emoji' only, unique identifier of the custom emoji. Use :class:`aiogram.methods.get_custom_emoji_stickers.GetCustomEmojiStickers` to get full information about the sticker""" if TYPE_CHECKING: @@ -41,10 +41,10 @@ class MessageEntity(MutableTelegramObject): type: str, offset: int, length: int, - url: Optional[str] = None, - user: Optional[User] = None, - language: Optional[str] = None, - custom_emoji_id: Optional[str] = None, + url: str | None = None, + user: User | None = None, + language: str | None = None, + custom_emoji_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/message_origin_channel.py b/aiogram/types/message_origin_channel.py index 9decfafe..4d745c6e 100644 --- a/aiogram/types/message_origin_channel.py +++ b/aiogram/types/message_origin_channel.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import MessageOriginType from .custom import DateTime @@ -25,7 +25,7 @@ class MessageOriginChannel(MessageOrigin): """Channel chat to which the message was originally sent""" message_id: int """Unique message identifier inside the chat""" - author_signature: Optional[str] = None + author_signature: str | None = None """*Optional*. Signature of the original post author""" if TYPE_CHECKING: @@ -39,7 +39,7 @@ class MessageOriginChannel(MessageOrigin): date: DateTime, chat: Chat, message_id: int, - author_signature: Optional[str] = None, + author_signature: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/message_origin_chat.py b/aiogram/types/message_origin_chat.py index b1e5fb9f..2d6d17fc 100644 --- a/aiogram/types/message_origin_chat.py +++ b/aiogram/types/message_origin_chat.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import MessageOriginType from .custom import DateTime @@ -23,7 +23,7 @@ class MessageOriginChat(MessageOrigin): """Date the message was sent originally in Unix time""" sender_chat: Chat """Chat that sent the message originally""" - author_signature: Optional[str] = None + author_signature: str | None = None """*Optional*. For messages originally sent by an anonymous chat administrator, original message author signature""" if TYPE_CHECKING: @@ -36,7 +36,7 @@ class MessageOriginChat(MessageOrigin): type: Literal[MessageOriginType.CHAT] = MessageOriginType.CHAT, date: DateTime, sender_chat: Chat, - author_signature: Optional[str] = None, + author_signature: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/message_origin_union.py b/aiogram/types/message_origin_union.py index d34f1f74..1a285c8b 100644 --- a/aiogram/types/message_origin_union.py +++ b/aiogram/types/message_origin_union.py @@ -1,12 +1,12 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .message_origin_channel import MessageOriginChannel from .message_origin_chat import MessageOriginChat from .message_origin_hidden_user import MessageOriginHiddenUser from .message_origin_user import MessageOriginUser -MessageOriginUnion = Union[ - MessageOriginUser, MessageOriginHiddenUser, MessageOriginChat, MessageOriginChannel -] +MessageOriginUnion: TypeAlias = ( + MessageOriginUser | MessageOriginHiddenUser | MessageOriginChat | MessageOriginChannel +) diff --git a/aiogram/types/message_reaction_updated.py b/aiogram/types/message_reaction_updated.py index c40ed6c9..1d83c594 100644 --- a/aiogram/types/message_reaction_updated.py +++ b/aiogram/types/message_reaction_updated.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -28,9 +28,9 @@ class MessageReactionUpdated(TelegramObject): """Previous list of reaction types that were set by the user""" new_reaction: list[ReactionTypeUnion] """New list of reaction types that have been set by the user""" - user: Optional[User] = None + user: User | None = None """*Optional*. The user that changed the reaction, if the user isn't anonymous""" - actor_chat: Optional[Chat] = None + actor_chat: Chat | None = None """*Optional*. The chat on behalf of which the reaction was changed, if the user is anonymous""" if TYPE_CHECKING: @@ -45,8 +45,8 @@ class MessageReactionUpdated(TelegramObject): date: DateTime, old_reaction: list[ReactionTypeUnion], new_reaction: list[ReactionTypeUnion], - user: Optional[User] = None, - actor_chat: Optional[Chat] = None, + user: User | None = None, + actor_chat: Chat | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/order_info.py b/aiogram/types/order_info.py index 5d71f657..a5b46c0f 100644 --- a/aiogram/types/order_info.py +++ b/aiogram/types/order_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -15,13 +15,13 @@ class OrderInfo(TelegramObject): Source: https://core.telegram.org/bots/api#orderinfo """ - name: Optional[str] = None + name: str | None = None """*Optional*. User name""" - phone_number: Optional[str] = None + phone_number: str | None = None """*Optional*. User's phone number""" - email: Optional[str] = None + email: str | None = None """*Optional*. User email""" - shipping_address: Optional[ShippingAddress] = None + shipping_address: ShippingAddress | None = None """*Optional*. User shipping address""" if TYPE_CHECKING: @@ -31,10 +31,10 @@ class OrderInfo(TelegramObject): def __init__( __pydantic__self__, *, - name: Optional[str] = None, - phone_number: Optional[str] = None, - email: Optional[str] = None, - shipping_address: Optional[ShippingAddress] = None, + name: str | None = None, + phone_number: str | None = None, + email: str | None = None, + shipping_address: ShippingAddress | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/owned_gift_regular.py b/aiogram/types/owned_gift_regular.py index 1f0ebbf2..329989b8 100644 --- a/aiogram/types/owned_gift_regular.py +++ b/aiogram/types/owned_gift_regular.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from aiogram.enums import OwnedGiftType @@ -25,29 +25,29 @@ class OwnedGiftRegular(OwnedGift): """Information about the regular gift""" send_date: int """Date the gift was sent in Unix time""" - owned_gift_id: Optional[str] = None + owned_gift_id: str | None = None """*Optional*. Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only""" - sender_user: Optional[User] = None + sender_user: User | None = None """*Optional*. Sender of the gift if it is a known user""" - text: Optional[str] = None + text: str | None = None """*Optional*. Text of the message that was added to the gift""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in the text""" - is_private: Optional[bool] = None + is_private: bool | None = None """*Optional*. :code:`True`, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them""" - is_saved: Optional[bool] = None + is_saved: bool | None = None """*Optional*. :code:`True`, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only""" - can_be_upgraded: Optional[bool] = None + can_be_upgraded: bool | None = None """*Optional*. :code:`True`, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only""" - was_refunded: Optional[bool] = None + was_refunded: bool | None = None """*Optional*. :code:`True`, if the gift was refunded and isn't available anymore""" - convert_star_count: Optional[int] = None + convert_star_count: int | None = None """*Optional*. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars; for gifts received on behalf of business accounts only""" - prepaid_upgrade_star_count: Optional[int] = None + prepaid_upgrade_star_count: int | None = None """*Optional*. Number of Telegram Stars that were paid for the ability to upgrade the gift""" - is_upgrade_separate: Optional[bool] = None + is_upgrade_separate: bool | None = None """*Optional*. :code:`True`, if the gift's upgrade was purchased after the gift was sent; for gifts received on behalf of business accounts only""" - unique_gift_number: Optional[int] = None + unique_gift_number: int | None = None """*Optional*. Unique number reserved for this gift when upgraded. See the *number* field in :class:`aiogram.types.unique_gift.UniqueGift`""" if TYPE_CHECKING: @@ -60,18 +60,18 @@ class OwnedGiftRegular(OwnedGift): type: Literal[OwnedGiftType.REGULAR] = OwnedGiftType.REGULAR, gift: Gift, send_date: int, - owned_gift_id: Optional[str] = None, - sender_user: Optional[User] = None, - text: Optional[str] = None, - entities: Optional[list[MessageEntity]] = None, - is_private: Optional[bool] = None, - is_saved: Optional[bool] = None, - can_be_upgraded: Optional[bool] = None, - was_refunded: Optional[bool] = None, - convert_star_count: Optional[int] = None, - prepaid_upgrade_star_count: Optional[int] = None, - is_upgrade_separate: Optional[bool] = None, - unique_gift_number: Optional[int] = None, + owned_gift_id: str | None = None, + sender_user: User | None = None, + text: str | None = None, + entities: list[MessageEntity] | None = None, + is_private: bool | None = None, + is_saved: bool | None = None, + can_be_upgraded: bool | None = None, + was_refunded: bool | None = None, + convert_star_count: int | None = None, + prepaid_upgrade_star_count: int | None = None, + is_upgrade_separate: bool | None = None, + unique_gift_number: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/owned_gift_union.py b/aiogram/types/owned_gift_union.py index 5b4b6dab..7c0eeed7 100644 --- a/aiogram/types/owned_gift_union.py +++ b/aiogram/types/owned_gift_union.py @@ -1,6 +1,6 @@ -from typing import Union +from typing import TypeAlias from .owned_gift_regular import OwnedGiftRegular from .owned_gift_unique import OwnedGiftUnique -OwnedGiftUnion = Union[OwnedGiftRegular, OwnedGiftUnique] +OwnedGiftUnion: TypeAlias = OwnedGiftRegular | OwnedGiftUnique diff --git a/aiogram/types/owned_gift_unique.py b/aiogram/types/owned_gift_unique.py index a3a9bcb2..3b310624 100644 --- a/aiogram/types/owned_gift_unique.py +++ b/aiogram/types/owned_gift_unique.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from aiogram.enums import OwnedGiftType @@ -25,17 +25,17 @@ class OwnedGiftUnique(OwnedGift): """Information about the unique gift""" send_date: int """Date the gift was sent in Unix time""" - owned_gift_id: Optional[str] = None + owned_gift_id: str | None = None """*Optional*. Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only""" - sender_user: Optional[User] = None + sender_user: User | None = None """*Optional*. Sender of the gift if it is a known user""" - is_saved: Optional[bool] = None + is_saved: bool | None = None """*Optional*. :code:`True`, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only""" - can_be_transferred: Optional[bool] = None + can_be_transferred: bool | None = None """*Optional*. :code:`True`, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only""" - transfer_star_count: Optional[int] = None + transfer_star_count: int | None = None """*Optional*. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift""" - next_transfer_date: Optional[DateTime] = None + next_transfer_date: DateTime | None = None """*Optional*. Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now""" if TYPE_CHECKING: @@ -48,12 +48,12 @@ class OwnedGiftUnique(OwnedGift): type: Literal[OwnedGiftType.UNIQUE] = OwnedGiftType.UNIQUE, gift: UniqueGift, send_date: int, - owned_gift_id: Optional[str] = None, - sender_user: Optional[User] = None, - is_saved: Optional[bool] = None, - can_be_transferred: Optional[bool] = None, - transfer_star_count: Optional[int] = None, - next_transfer_date: Optional[DateTime] = None, + owned_gift_id: str | None = None, + sender_user: User | None = None, + is_saved: bool | None = None, + can_be_transferred: bool | None = None, + transfer_star_count: int | None = None, + next_transfer_date: DateTime | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/owned_gifts.py b/aiogram/types/owned_gifts.py index 1fc1bbb4..8153d258 100644 --- a/aiogram/types/owned_gifts.py +++ b/aiogram/types/owned_gifts.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -19,7 +19,7 @@ class OwnedGifts(TelegramObject): """The total number of gifts owned by the user or the chat""" gifts: list[OwnedGiftUnion] """The list of gifts""" - next_offset: Optional[str] = None + next_offset: str | None = None """*Optional*. Offset for the next request. If empty, then there are no more results""" if TYPE_CHECKING: @@ -31,7 +31,7 @@ class OwnedGifts(TelegramObject): *, total_count: int, gifts: list[OwnedGiftUnion], - next_offset: Optional[str] = None, + next_offset: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/paid_media_preview.py b/aiogram/types/paid_media_preview.py index 5054de23..ab6b3775 100644 --- a/aiogram/types/paid_media_preview.py +++ b/aiogram/types/paid_media_preview.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import PaidMediaType from .paid_media import PaidMedia @@ -15,11 +15,11 @@ class PaidMediaPreview(PaidMedia): type: Literal[PaidMediaType.PREVIEW] = PaidMediaType.PREVIEW """Type of the paid media, always 'preview'""" - width: Optional[int] = None + width: int | None = None """*Optional*. Media width as defined by the sender""" - height: Optional[int] = None + height: int | None = None """*Optional*. Media height as defined by the sender""" - duration: Optional[int] = None + duration: int | None = None """*Optional*. Duration of the media in seconds as defined by the sender""" if TYPE_CHECKING: @@ -30,9 +30,9 @@ class PaidMediaPreview(PaidMedia): __pydantic__self__, *, type: Literal[PaidMediaType.PREVIEW] = PaidMediaType.PREVIEW, - width: Optional[int] = None, - height: Optional[int] = None, - duration: Optional[int] = None, + width: int | None = None, + height: int | None = None, + duration: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/paid_media_union.py b/aiogram/types/paid_media_union.py index 85eae573..75f0d563 100644 --- a/aiogram/types/paid_media_union.py +++ b/aiogram/types/paid_media_union.py @@ -1,9 +1,9 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .paid_media_photo import PaidMediaPhoto from .paid_media_preview import PaidMediaPreview from .paid_media_video import PaidMediaVideo -PaidMediaUnion = Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo] +PaidMediaUnion: TypeAlias = PaidMediaPreview | PaidMediaPhoto | PaidMediaVideo diff --git a/aiogram/types/passport_element_error_union.py b/aiogram/types/passport_element_error_union.py index e14fdf17..6bed5c4e 100644 --- a/aiogram/types/passport_element_error_union.py +++ b/aiogram/types/passport_element_error_union.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .passport_element_error_data_field import PassportElementErrorDataField from .passport_element_error_file import PassportElementErrorFile @@ -14,14 +14,14 @@ from .passport_element_error_translation_files import ( ) from .passport_element_error_unspecified import PassportElementErrorUnspecified -PassportElementErrorUnion = Union[ - PassportElementErrorDataField, - PassportElementErrorFrontSide, - PassportElementErrorReverseSide, - PassportElementErrorSelfie, - PassportElementErrorFile, - PassportElementErrorFiles, - PassportElementErrorTranslationFile, - PassportElementErrorTranslationFiles, - PassportElementErrorUnspecified, -] +PassportElementErrorUnion: TypeAlias = ( + PassportElementErrorDataField + | PassportElementErrorFrontSide + | PassportElementErrorReverseSide + | PassportElementErrorSelfie + | PassportElementErrorFile + | PassportElementErrorFiles + | PassportElementErrorTranslationFile + | PassportElementErrorTranslationFiles + | PassportElementErrorUnspecified +) diff --git a/aiogram/types/photo_size.py b/aiogram/types/photo_size.py index 9a2ccbe1..7c9c7cf8 100644 --- a/aiogram/types/photo_size.py +++ b/aiogram/types/photo_size.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -20,7 +20,7 @@ class PhotoSize(TelegramObject): """Photo width""" height: int """Photo height""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes""" if TYPE_CHECKING: @@ -34,7 +34,7 @@ class PhotoSize(TelegramObject): file_unique_id: str, width: int, height: int, - file_size: Optional[int] = None, + file_size: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/poll.py b/aiogram/types/poll.py index 12b245e3..d9eff35a 100644 --- a/aiogram/types/poll.py +++ b/aiogram/types/poll.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject from .custom import DateTime @@ -33,17 +33,17 @@ class Poll(TelegramObject): """Poll type, currently can be 'regular' or 'quiz'""" allows_multiple_answers: bool """:code:`True`, if the poll allows multiple answers""" - question_entities: Optional[list[MessageEntity]] = None + question_entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in the *question*. Currently, only custom emoji entities are allowed in poll questions""" - correct_option_id: Optional[int] = None + correct_option_id: int | None = None """*Optional*. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.""" - explanation: Optional[str] = None + explanation: str | None = None """*Optional*. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters""" - explanation_entities: Optional[list[MessageEntity]] = None + explanation_entities: list[MessageEntity] | None = None """*Optional*. Special entities like usernames, URLs, bot commands, etc. that appear in the *explanation*""" - open_period: Optional[int] = None + open_period: int | None = None """*Optional*. Amount of time in seconds the poll will be active after creation""" - close_date: Optional[DateTime] = None + close_date: DateTime | None = None """*Optional*. Point in time (Unix timestamp) when the poll will be automatically closed""" if TYPE_CHECKING: @@ -61,12 +61,12 @@ class Poll(TelegramObject): is_anonymous: bool, type: str, allows_multiple_answers: bool, - question_entities: Optional[list[MessageEntity]] = None, - correct_option_id: Optional[int] = None, - explanation: Optional[str] = None, - explanation_entities: Optional[list[MessageEntity]] = None, - open_period: Optional[int] = None, - close_date: Optional[DateTime] = None, + question_entities: list[MessageEntity] | None = None, + correct_option_id: int | None = None, + explanation: str | None = None, + explanation_entities: list[MessageEntity] | None = None, + open_period: int | None = None, + close_date: DateTime | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/poll_answer.py b/aiogram/types/poll_answer.py index d855566a..030b2379 100644 --- a/aiogram/types/poll_answer.py +++ b/aiogram/types/poll_answer.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -20,9 +20,9 @@ class PollAnswer(TelegramObject): """Unique poll identifier""" option_ids: list[int] """0-based identifiers of chosen answer options. May be empty if the vote was retracted.""" - voter_chat: Optional[Chat] = None + voter_chat: Chat | None = None """*Optional*. The chat that changed the answer to the poll, if the voter is anonymous""" - user: Optional[User] = None + user: User | None = None """*Optional*. The user that changed the answer to the poll, if the voter isn't anonymous""" if TYPE_CHECKING: @@ -34,8 +34,8 @@ class PollAnswer(TelegramObject): *, poll_id: str, option_ids: list[int], - voter_chat: Optional[Chat] = None, - user: Optional[User] = None, + voter_chat: Chat | None = None, + user: User | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/poll_option.py b/aiogram/types/poll_option.py index e76f9f40..5a91ab3d 100644 --- a/aiogram/types/poll_option.py +++ b/aiogram/types/poll_option.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -19,7 +19,7 @@ class PollOption(TelegramObject): """Option text, 1-100 characters""" voter_count: int """Number of users that voted for this option""" - text_entities: Optional[list[MessageEntity]] = None + text_entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in the option *text*. Currently, only custom emoji entities are allowed in poll option texts""" if TYPE_CHECKING: @@ -31,7 +31,7 @@ class PollOption(TelegramObject): *, text: str, voter_count: int, - text_entities: Optional[list[MessageEntity]] = None, + text_entities: list[MessageEntity] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/pre_checkout_query.py b/aiogram/types/pre_checkout_query.py index 41bda8ca..305315dc 100644 --- a/aiogram/types/pre_checkout_query.py +++ b/aiogram/types/pre_checkout_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -29,9 +29,9 @@ class PreCheckoutQuery(TelegramObject): """Total price in the *smallest units* of the currency (integer, **not** float/double). For example, for a price of :code:`US$ 1.45` pass :code:`amount = 145`. See the *exp* parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).""" invoice_payload: str """Bot-specified invoice payload""" - shipping_option_id: Optional[str] = None + shipping_option_id: str | None = None """*Optional*. Identifier of the shipping option chosen by the user""" - order_info: Optional[OrderInfo] = None + order_info: OrderInfo | None = None """*Optional*. Order information provided by the user""" if TYPE_CHECKING: @@ -46,8 +46,8 @@ class PreCheckoutQuery(TelegramObject): currency: str, total_amount: int, invoice_payload: str, - shipping_option_id: Optional[str] = None, - order_info: Optional[OrderInfo] = None, + shipping_option_id: str | None = None, + order_info: OrderInfo | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -68,7 +68,7 @@ class PreCheckoutQuery(TelegramObject): def answer( self, ok: bool, - error_message: Optional[str] = None, + error_message: str | None = None, **kwargs: Any, ) -> AnswerPreCheckoutQuery: """ diff --git a/aiogram/types/reaction_type_union.py b/aiogram/types/reaction_type_union.py index 783370a1..4694af75 100644 --- a/aiogram/types/reaction_type_union.py +++ b/aiogram/types/reaction_type_union.py @@ -1,9 +1,9 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .reaction_type_custom_emoji import ReactionTypeCustomEmoji from .reaction_type_emoji import ReactionTypeEmoji from .reaction_type_paid import ReactionTypePaid -ReactionTypeUnion = Union[ReactionTypeEmoji, ReactionTypeCustomEmoji, ReactionTypePaid] +ReactionTypeUnion: TypeAlias = ReactionTypeEmoji | ReactionTypeCustomEmoji | ReactionTypePaid diff --git a/aiogram/types/refunded_payment.py b/aiogram/types/refunded_payment.py index 8b889dce..c2561ea1 100644 --- a/aiogram/types/refunded_payment.py +++ b/aiogram/types/refunded_payment.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from .base import TelegramObject @@ -18,7 +18,7 @@ class RefundedPayment(TelegramObject): """Bot-specified invoice payload""" telegram_payment_charge_id: str """Telegram payment identifier""" - provider_payment_charge_id: Optional[str] = None + provider_payment_charge_id: str | None = None """*Optional*. Provider payment identifier""" if TYPE_CHECKING: @@ -32,7 +32,7 @@ class RefundedPayment(TelegramObject): total_amount: int, invoice_payload: str, telegram_payment_charge_id: str, - provider_payment_charge_id: Optional[str] = None, + provider_payment_charge_id: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/reply_keyboard_markup.py b/aiogram/types/reply_keyboard_markup.py index 0340823d..1f4ae86e 100644 --- a/aiogram/types/reply_keyboard_markup.py +++ b/aiogram/types/reply_keyboard_markup.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import MutableTelegramObject @@ -17,15 +17,15 @@ class ReplyKeyboardMarkup(MutableTelegramObject): keyboard: list[list[KeyboardButton]] """Array of button rows, each represented by an Array of :class:`aiogram.types.keyboard_button.KeyboardButton` objects""" - is_persistent: Optional[bool] = None + is_persistent: bool | None = None """*Optional*. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to *false*, in which case the custom keyboard can be hidden and opened with a keyboard icon.""" - resize_keyboard: Optional[bool] = None + resize_keyboard: bool | None = None """*Optional*. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to *false*, in which case the custom keyboard is always of the same height as the app's standard keyboard.""" - one_time_keyboard: Optional[bool] = None + one_time_keyboard: bool | None = None """*Optional*. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to *false*.""" - input_field_placeholder: Optional[str] = None + input_field_placeholder: str | None = None """*Optional*. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters""" - selective: Optional[bool] = None + selective: bool | None = None """*Optional*. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the *text* of the :class:`aiogram.types.message.Message` object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.""" if TYPE_CHECKING: @@ -36,11 +36,11 @@ class ReplyKeyboardMarkup(MutableTelegramObject): __pydantic__self__, *, keyboard: list[list[KeyboardButton]], - is_persistent: Optional[bool] = None, - resize_keyboard: Optional[bool] = None, - one_time_keyboard: Optional[bool] = None, - input_field_placeholder: Optional[str] = None, - selective: Optional[bool] = None, + is_persistent: bool | None = None, + resize_keyboard: bool | None = None, + one_time_keyboard: bool | None = None, + input_field_placeholder: str | None = None, + selective: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/reply_keyboard_remove.py b/aiogram/types/reply_keyboard_remove.py index 9c135a10..51d83ad4 100644 --- a/aiogram/types/reply_keyboard_remove.py +++ b/aiogram/types/reply_keyboard_remove.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from .base import MutableTelegramObject @@ -14,7 +14,7 @@ class ReplyKeyboardRemove(MutableTelegramObject): remove_keyboard: Literal[True] = True """Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use *one_time_keyboard* in :class:`aiogram.types.reply_keyboard_markup.ReplyKeyboardMarkup`)""" - selective: Optional[bool] = None + selective: bool | None = None """*Optional*. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the *text* of the :class:`aiogram.types.message.Message` object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.""" if TYPE_CHECKING: @@ -25,7 +25,7 @@ class ReplyKeyboardRemove(MutableTelegramObject): __pydantic__self__, *, remove_keyboard: Literal[True] = True, - selective: Optional[bool] = None, + selective: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/reply_markup_union.py b/aiogram/types/reply_markup_union.py index 13516995..65f40250 100644 --- a/aiogram/types/reply_markup_union.py +++ b/aiogram/types/reply_markup_union.py @@ -1,12 +1,12 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .force_reply import ForceReply from .inline_keyboard_markup import InlineKeyboardMarkup from .reply_keyboard_markup import ReplyKeyboardMarkup from .reply_keyboard_remove import ReplyKeyboardRemove -ReplyMarkupUnion = Union[ - InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply -] +ReplyMarkupUnion: TypeAlias = ( + InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply +) diff --git a/aiogram/types/reply_parameters.py b/aiogram/types/reply_parameters.py index 807a6d89..3ad9131d 100644 --- a/aiogram/types/reply_parameters.py +++ b/aiogram/types/reply_parameters.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, Union +from typing import TYPE_CHECKING, Any from ..client.default import Default from .base import TelegramObject @@ -19,21 +19,19 @@ class ReplyParameters(TelegramObject): message_id: int """Identifier of the message that will be replied to in the current chat, or in the chat *chat_id* if it is specified""" - chat_id: Optional[ChatIdUnion] = None + chat_id: ChatIdUnion | None = None """*Optional*. If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format :code:`@channelusername`). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats.""" - allow_sending_without_reply: Optional[Union[bool, Default]] = Default( - "allow_sending_without_reply" - ) + allow_sending_without_reply: bool | Default | None = Default("allow_sending_without_reply") """*Optional*. Pass :code:`True` if the message should be sent even if the specified message to be replied to is not found. Always :code:`False` for replies in another chat or forum topic. Always :code:`True` for messages sent on behalf of a business account.""" - quote: Optional[str] = None + quote: str | None = None """*Optional*. Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including *bold*, *italic*, *underline*, *strikethrough*, *spoiler*, and *custom_emoji* entities. The message will fail to send if the quote isn't found in the original message.""" - quote_parse_mode: Optional[Union[str, Default]] = Default("parse_mode") + quote_parse_mode: str | Default | None = Default("parse_mode") """*Optional*. Mode for parsing entities in the quote. See `formatting options `_ for more details.""" - quote_entities: Optional[list[MessageEntity]] = None + quote_entities: list[MessageEntity] | None = None """*Optional*. A JSON-serialized list of special entities that appear in the quote. It can be specified instead of *quote_parse_mode*.""" - quote_position: Optional[int] = None + quote_position: int | None = None """*Optional*. Position of the quote in the original message in UTF-16 code units""" - checklist_task_id: Optional[int] = None + checklist_task_id: int | None = None """*Optional*. Identifier of the specific checklist task to be replied to""" if TYPE_CHECKING: @@ -44,15 +42,15 @@ class ReplyParameters(TelegramObject): __pydantic__self__, *, message_id: int, - chat_id: Optional[ChatIdUnion] = None, - allow_sending_without_reply: Optional[Union[bool, Default]] = Default( + chat_id: ChatIdUnion | None = None, + allow_sending_without_reply: bool | Default | None = Default( "allow_sending_without_reply" ), - quote: Optional[str] = None, - quote_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), - quote_entities: Optional[list[MessageEntity]] = None, - quote_position: Optional[int] = None, - checklist_task_id: Optional[int] = None, + quote: str | None = None, + quote_parse_mode: str | Default | None = Default("parse_mode"), + quote_entities: list[MessageEntity] | None = None, + quote_position: int | None = None, + checklist_task_id: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/response_parameters.py b/aiogram/types/response_parameters.py index 19fc54fb..514b2d32 100644 --- a/aiogram/types/response_parameters.py +++ b/aiogram/types/response_parameters.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -12,9 +12,9 @@ class ResponseParameters(TelegramObject): Source: https://core.telegram.org/bots/api#responseparameters """ - migrate_to_chat_id: Optional[int] = None + migrate_to_chat_id: int | None = None """*Optional*. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.""" - retry_after: Optional[int] = None + retry_after: int | None = None """*Optional*. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated""" if TYPE_CHECKING: @@ -24,8 +24,8 @@ class ResponseParameters(TelegramObject): def __init__( __pydantic__self__, *, - migrate_to_chat_id: Optional[int] = None, - retry_after: Optional[int] = None, + migrate_to_chat_id: int | None = None, + retry_after: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/result_chat_member_union.py b/aiogram/types/result_chat_member_union.py index f4dc741d..67c8083c 100644 --- a/aiogram/types/result_chat_member_union.py +++ b/aiogram/types/result_chat_member_union.py @@ -1,4 +1,4 @@ -from typing import Union +from typing import TypeAlias from .chat_member_administrator import ChatMemberAdministrator from .chat_member_banned import ChatMemberBanned @@ -7,11 +7,11 @@ from .chat_member_member import ChatMemberMember from .chat_member_owner import ChatMemberOwner from .chat_member_restricted import ChatMemberRestricted -ResultChatMemberUnion = Union[ - ChatMemberOwner, - ChatMemberAdministrator, - ChatMemberMember, - ChatMemberRestricted, - ChatMemberLeft, - ChatMemberBanned, -] +ResultChatMemberUnion: TypeAlias = ( + ChatMemberOwner + | ChatMemberAdministrator + | ChatMemberMember + | ChatMemberRestricted + | ChatMemberLeft + | ChatMemberBanned +) diff --git a/aiogram/types/result_menu_button_union.py b/aiogram/types/result_menu_button_union.py index 74c47b2c..d88ffc12 100644 --- a/aiogram/types/result_menu_button_union.py +++ b/aiogram/types/result_menu_button_union.py @@ -1,7 +1,7 @@ -from typing import Union +from typing import TypeAlias from .menu_button_commands import MenuButtonCommands from .menu_button_default import MenuButtonDefault from .menu_button_web_app import MenuButtonWebApp -ResultMenuButtonUnion = Union[MenuButtonDefault, MenuButtonWebApp, MenuButtonCommands] +ResultMenuButtonUnion: TypeAlias = MenuButtonDefault | MenuButtonWebApp | MenuButtonCommands diff --git a/aiogram/types/revenue_withdrawal_state_union.py b/aiogram/types/revenue_withdrawal_state_union.py index be913c26..a15e77bb 100644 --- a/aiogram/types/revenue_withdrawal_state_union.py +++ b/aiogram/types/revenue_withdrawal_state_union.py @@ -1,11 +1,11 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .revenue_withdrawal_state_failed import RevenueWithdrawalStateFailed from .revenue_withdrawal_state_pending import RevenueWithdrawalStatePending from .revenue_withdrawal_state_succeeded import RevenueWithdrawalStateSucceeded -RevenueWithdrawalStateUnion = Union[ - RevenueWithdrawalStatePending, RevenueWithdrawalStateSucceeded, RevenueWithdrawalStateFailed -] +RevenueWithdrawalStateUnion: TypeAlias = ( + RevenueWithdrawalStatePending | RevenueWithdrawalStateSucceeded | RevenueWithdrawalStateFailed +) diff --git a/aiogram/types/sent_web_app_message.py b/aiogram/types/sent_web_app_message.py index e8241a5f..0beb96e1 100644 --- a/aiogram/types/sent_web_app_message.py +++ b/aiogram/types/sent_web_app_message.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -12,7 +12,7 @@ class SentWebAppMessage(TelegramObject): Source: https://core.telegram.org/bots/api#sentwebappmessage """ - inline_message_id: Optional[str] = None + inline_message_id: str | None = None """*Optional*. Identifier of the sent inline message. Available only if there is an `inline keyboard `_ attached to the message.""" if TYPE_CHECKING: @@ -20,10 +20,7 @@ class SentWebAppMessage(TelegramObject): # This section was auto-generated via `butcher` def __init__( - __pydantic__self__, - *, - inline_message_id: Optional[str] = None, - **__pydantic_kwargs: Any, + __pydantic__self__, *, inline_message_id: str | None = None, **__pydantic_kwargs: Any ) -> None: # DO NOT EDIT MANUALLY!!! # This method was auto-generated via `butcher` diff --git a/aiogram/types/shared_user.py b/aiogram/types/shared_user.py index d6a54ebb..e38e0ac8 100644 --- a/aiogram/types/shared_user.py +++ b/aiogram/types/shared_user.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -17,13 +17,13 @@ class SharedUser(TelegramObject): user_id: int """Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.""" - first_name: Optional[str] = None + first_name: str | None = None """*Optional*. First name of the user, if the name was requested by the bot""" - last_name: Optional[str] = None + last_name: str | None = None """*Optional*. Last name of the user, if the name was requested by the bot""" - username: Optional[str] = None + username: str | None = None """*Optional*. Username of the user, if the username was requested by the bot""" - photo: Optional[list[PhotoSize]] = None + photo: list[PhotoSize] | None = None """*Optional*. Available sizes of the chat photo, if the photo was requested by the bot""" if TYPE_CHECKING: @@ -34,10 +34,10 @@ class SharedUser(TelegramObject): __pydantic__self__, *, user_id: int, - first_name: Optional[str] = None, - last_name: Optional[str] = None, - username: Optional[str] = None, - photo: Optional[list[PhotoSize]] = None, + first_name: str | None = None, + last_name: str | None = None, + username: str | None = None, + photo: list[PhotoSize] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/shipping_query.py b/aiogram/types/shipping_query.py index f98be47f..8ecae45e 100644 --- a/aiogram/types/shipping_query.py +++ b/aiogram/types/shipping_query.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -57,8 +57,8 @@ class ShippingQuery(TelegramObject): def answer( self, ok: bool, - shipping_options: Optional[list[ShippingOption]] = None, - error_message: Optional[str] = None, + shipping_options: list[ShippingOption] | None = None, + error_message: str | None = None, **kwargs: Any, ) -> AnswerShippingQuery: """ diff --git a/aiogram/types/star_amount.py b/aiogram/types/star_amount.py index 98481198..4e3936ae 100644 --- a/aiogram/types/star_amount.py +++ b/aiogram/types/star_amount.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -14,7 +14,7 @@ class StarAmount(TelegramObject): amount: int """Integer amount of Telegram Stars, rounded to 0; can be negative""" - nanostar_amount: Optional[int] = None + nanostar_amount: int | None = None """*Optional*. The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if *amount* is non-positive""" if TYPE_CHECKING: @@ -25,7 +25,7 @@ class StarAmount(TelegramObject): __pydantic__self__, *, amount: int, - nanostar_amount: Optional[int] = None, + nanostar_amount: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/star_transaction.py b/aiogram/types/star_transaction.py index c6c645fa..181ed786 100644 --- a/aiogram/types/star_transaction.py +++ b/aiogram/types/star_transaction.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject from .custom import DateTime @@ -22,11 +22,11 @@ class StarTransaction(TelegramObject): """Integer amount of Telegram Stars transferred by the transaction""" date: DateTime """Date the transaction was created in Unix time""" - nanostar_amount: Optional[int] = None + nanostar_amount: int | None = None """*Optional*. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999""" - source: Optional[TransactionPartnerUnion] = None + source: TransactionPartnerUnion | None = None """*Optional*. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions""" - receiver: Optional[TransactionPartnerUnion] = None + receiver: TransactionPartnerUnion | None = None """*Optional*. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions""" if TYPE_CHECKING: @@ -39,9 +39,9 @@ class StarTransaction(TelegramObject): id: str, amount: int, date: DateTime, - nanostar_amount: Optional[int] = None, - source: Optional[TransactionPartnerUnion] = None, - receiver: Optional[TransactionPartnerUnion] = None, + nanostar_amount: int | None = None, + source: TransactionPartnerUnion | None = None, + receiver: TransactionPartnerUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/sticker.py b/aiogram/types/sticker.py index 4c1b8646..d0fb8d59 100644 --- a/aiogram/types/sticker.py +++ b/aiogram/types/sticker.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -32,21 +32,21 @@ class Sticker(TelegramObject): """:code:`True`, if the sticker is `animated `_""" is_video: bool """:code:`True`, if the sticker is a `video sticker `_""" - thumbnail: Optional[PhotoSize] = None + thumbnail: PhotoSize | None = None """*Optional*. Sticker thumbnail in the .WEBP or .JPG format""" - emoji: Optional[str] = None + emoji: str | None = None """*Optional*. Emoji associated with the sticker""" - set_name: Optional[str] = None + set_name: str | None = None """*Optional*. Name of the sticker set to which the sticker belongs""" - premium_animation: Optional[File] = None + premium_animation: File | None = None """*Optional*. For premium regular stickers, premium animation for the sticker""" - mask_position: Optional[MaskPosition] = None + mask_position: MaskPosition | None = None """*Optional*. For mask stickers, the position where the mask should be placed""" - custom_emoji_id: Optional[str] = None + custom_emoji_id: str | None = None """*Optional*. For custom emoji stickers, unique identifier of the custom emoji""" - needs_repainting: Optional[bool] = None + needs_repainting: bool | None = None """*Optional*. :code:`True`, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes""" if TYPE_CHECKING: @@ -63,14 +63,14 @@ class Sticker(TelegramObject): height: int, is_animated: bool, is_video: bool, - thumbnail: Optional[PhotoSize] = None, - emoji: Optional[str] = None, - set_name: Optional[str] = None, - premium_animation: Optional[File] = None, - mask_position: Optional[MaskPosition] = None, - custom_emoji_id: Optional[str] = None, - needs_repainting: Optional[bool] = None, - file_size: Optional[int] = None, + thumbnail: PhotoSize | None = None, + emoji: str | None = None, + set_name: str | None = None, + premium_animation: File | None = None, + mask_position: MaskPosition | None = None, + custom_emoji_id: str | None = None, + needs_repainting: bool | None = None, + file_size: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/sticker_set.py b/aiogram/types/sticker_set.py index 7da68eaf..b9b10bf5 100644 --- a/aiogram/types/sticker_set.py +++ b/aiogram/types/sticker_set.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -26,14 +26,14 @@ class StickerSet(TelegramObject): """Type of stickers in the set, currently one of 'regular', 'mask', 'custom_emoji'""" stickers: list[Sticker] """List of all set stickers""" - thumbnail: Optional[PhotoSize] = None + thumbnail: PhotoSize | None = None """*Optional*. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format""" - is_animated: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + is_animated: bool | None = Field(None, json_schema_extra={"deprecated": True}) """:code:`True`, if the sticker set contains `animated stickers `_ .. deprecated:: API:7.2 https://core.telegram.org/bots/api-changelog#march-31-2024""" - is_video: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) + is_video: bool | None = Field(None, json_schema_extra={"deprecated": True}) """:code:`True`, if the sticker set contains `video stickers `_ .. deprecated:: API:7.2 @@ -50,9 +50,9 @@ class StickerSet(TelegramObject): title: str, sticker_type: str, stickers: list[Sticker], - thumbnail: Optional[PhotoSize] = None, - is_animated: Optional[bool] = None, - is_video: Optional[bool] = None, + thumbnail: PhotoSize | None = None, + is_animated: bool | None = None, + is_video: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/story_area_type_location.py b/aiogram/types/story_area_type_location.py index c40a0e19..bda9cde3 100644 --- a/aiogram/types/story_area_type_location.py +++ b/aiogram/types/story_area_type_location.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from aiogram.enums import StoryAreaTypeType @@ -23,7 +23,7 @@ class StoryAreaTypeLocation(StoryAreaType): """Location latitude in degrees""" longitude: float """Location longitude in degrees""" - address: Optional[LocationAddress] = None + address: LocationAddress | None = None """*Optional*. Address of the location""" if TYPE_CHECKING: @@ -36,7 +36,7 @@ class StoryAreaTypeLocation(StoryAreaType): type: Literal[StoryAreaTypeType.LOCATION] = StoryAreaTypeType.LOCATION, latitude: float, longitude: float, - address: Optional[LocationAddress] = None, + address: LocationAddress | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/story_area_type_suggested_reaction.py b/aiogram/types/story_area_type_suggested_reaction.py index 199b2331..4d9a121a 100644 --- a/aiogram/types/story_area_type_suggested_reaction.py +++ b/aiogram/types/story_area_type_suggested_reaction.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from aiogram.enums import StoryAreaTypeType @@ -21,9 +21,9 @@ class StoryAreaTypeSuggestedReaction(StoryAreaType): """Type of the area, always 'suggested_reaction'""" reaction_type: ReactionTypeUnion """Type of the reaction""" - is_dark: Optional[bool] = None + is_dark: bool | None = None """*Optional*. Pass :code:`True` if the reaction area has a dark background""" - is_flipped: Optional[bool] = None + is_flipped: bool | None = None """*Optional*. Pass :code:`True` if reaction area corner is flipped""" if TYPE_CHECKING: @@ -37,8 +37,8 @@ class StoryAreaTypeSuggestedReaction(StoryAreaType): StoryAreaTypeType.SUGGESTED_REACTION ] = StoryAreaTypeType.SUGGESTED_REACTION, reaction_type: ReactionTypeUnion, - is_dark: Optional[bool] = None, - is_flipped: Optional[bool] = None, + is_dark: bool | None = None, + is_flipped: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/story_area_type_union.py b/aiogram/types/story_area_type_union.py index eae1ac25..0d63425e 100644 --- a/aiogram/types/story_area_type_union.py +++ b/aiogram/types/story_area_type_union.py @@ -1,4 +1,4 @@ -from typing import Union +from typing import TypeAlias from .story_area_type_link import StoryAreaTypeLink from .story_area_type_location import StoryAreaTypeLocation @@ -6,10 +6,10 @@ from .story_area_type_suggested_reaction import StoryAreaTypeSuggestedReaction from .story_area_type_unique_gift import StoryAreaTypeUniqueGift from .story_area_type_weather import StoryAreaTypeWeather -StoryAreaTypeUnion = Union[ - StoryAreaTypeLocation, - StoryAreaTypeSuggestedReaction, - StoryAreaTypeLink, - StoryAreaTypeWeather, - StoryAreaTypeUniqueGift, -] +StoryAreaTypeUnion: TypeAlias = ( + StoryAreaTypeLocation + | StoryAreaTypeSuggestedReaction + | StoryAreaTypeLink + | StoryAreaTypeWeather + | StoryAreaTypeUniqueGift +) diff --git a/aiogram/types/successful_payment.py b/aiogram/types/successful_payment.py index d8a8e03e..a0f728d4 100644 --- a/aiogram/types/successful_payment.py +++ b/aiogram/types/successful_payment.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -25,15 +25,15 @@ class SuccessfulPayment(TelegramObject): """Telegram payment identifier""" provider_payment_charge_id: str """Provider payment identifier""" - subscription_expiration_date: Optional[int] = None + subscription_expiration_date: int | None = None """*Optional*. Expiration date of the subscription, in Unix time; for recurring payments only""" - is_recurring: Optional[bool] = None + is_recurring: bool | None = None """*Optional*. :code:`True`, if the payment is a recurring payment for a subscription""" - is_first_recurring: Optional[bool] = None + is_first_recurring: bool | None = None """*Optional*. :code:`True`, if the payment is the first payment for a subscription""" - shipping_option_id: Optional[str] = None + shipping_option_id: str | None = None """*Optional*. Identifier of the shipping option chosen by the user""" - order_info: Optional[OrderInfo] = None + order_info: OrderInfo | None = None """*Optional*. Order information provided by the user""" if TYPE_CHECKING: @@ -48,11 +48,11 @@ class SuccessfulPayment(TelegramObject): invoice_payload: str, telegram_payment_charge_id: str, provider_payment_charge_id: str, - subscription_expiration_date: Optional[int] = None, - is_recurring: Optional[bool] = None, - is_first_recurring: Optional[bool] = None, - shipping_option_id: Optional[str] = None, - order_info: Optional[OrderInfo] = None, + subscription_expiration_date: int | None = None, + is_recurring: bool | None = None, + is_first_recurring: bool | None = None, + shipping_option_id: str | None = None, + order_info: OrderInfo | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/suggested_post_approval_failed.py b/aiogram/types/suggested_post_approval_failed.py index 97d5a166..c36756f3 100644 --- a/aiogram/types/suggested_post_approval_failed.py +++ b/aiogram/types/suggested_post_approval_failed.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,7 +18,7 @@ class SuggestedPostApprovalFailed(TelegramObject): price: SuggestedPostPrice """Expected price of the post""" - suggested_post_message: Optional[Message] = None + suggested_post_message: Message | None = None """*Optional*. Message containing the suggested post whose approval has failed. Note that the :class:`aiogram.types.message.Message` object in this field will not contain the *reply_to_message* field even if it itself is a reply.""" if TYPE_CHECKING: @@ -29,7 +29,7 @@ class SuggestedPostApprovalFailed(TelegramObject): __pydantic__self__, *, price: SuggestedPostPrice, - suggested_post_message: Optional[Message] = None, + suggested_post_message: Message | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/suggested_post_approved.py b/aiogram/types/suggested_post_approved.py index 8d582f60..d2969b5e 100644 --- a/aiogram/types/suggested_post_approved.py +++ b/aiogram/types/suggested_post_approved.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject from .custom import DateTime @@ -19,9 +19,9 @@ class SuggestedPostApproved(TelegramObject): send_date: DateTime """Date when the post will be published""" - suggested_post_message: Optional[Message] = None + suggested_post_message: Message | None = None """*Optional*. Message containing the suggested post. Note that the :class:`aiogram.types.message.Message` object in this field will not contain the *reply_to_message* field even if it itself is a reply.""" - price: Optional[SuggestedPostPrice] = None + price: SuggestedPostPrice | None = None """*Optional*. Amount paid for the post""" if TYPE_CHECKING: @@ -32,8 +32,8 @@ class SuggestedPostApproved(TelegramObject): __pydantic__self__, *, send_date: DateTime, - suggested_post_message: Optional[Message] = None, - price: Optional[SuggestedPostPrice] = None, + suggested_post_message: Message | None = None, + price: SuggestedPostPrice | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/suggested_post_declined.py b/aiogram/types/suggested_post_declined.py index 1fb0cd3b..01699d3f 100644 --- a/aiogram/types/suggested_post_declined.py +++ b/aiogram/types/suggested_post_declined.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -15,9 +15,9 @@ class SuggestedPostDeclined(TelegramObject): Source: https://core.telegram.org/bots/api#suggestedpostdeclined """ - suggested_post_message: Optional[Message] = None + suggested_post_message: Message | None = None """*Optional*. Message containing the suggested post. Note that the :class:`aiogram.types.message.Message` object in this field will not contain the *reply_to_message* field even if it itself is a reply.""" - comment: Optional[str] = None + comment: str | None = None """*Optional*. Comment with which the post was declined""" if TYPE_CHECKING: @@ -27,8 +27,8 @@ class SuggestedPostDeclined(TelegramObject): def __init__( __pydantic__self__, *, - suggested_post_message: Optional[Message] = None, - comment: Optional[str] = None, + suggested_post_message: Message | None = None, + comment: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/suggested_post_info.py b/aiogram/types/suggested_post_info.py index 79d51bff..37d34ba4 100644 --- a/aiogram/types/suggested_post_info.py +++ b/aiogram/types/suggested_post_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject from .custom import DateTime @@ -18,9 +18,9 @@ class SuggestedPostInfo(TelegramObject): state: str """State of the suggested post. Currently, it can be one of 'pending', 'approved', 'declined'.""" - price: Optional[SuggestedPostPrice] = None + price: SuggestedPostPrice | None = None """*Optional*. Proposed price of the post. If the field is omitted, then the post is unpaid.""" - send_date: Optional[DateTime] = None + send_date: DateTime | None = None """*Optional*. Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it.""" if TYPE_CHECKING: @@ -31,8 +31,8 @@ class SuggestedPostInfo(TelegramObject): __pydantic__self__, *, state: str, - price: Optional[SuggestedPostPrice] = None, - send_date: Optional[DateTime] = None, + price: SuggestedPostPrice | None = None, + send_date: DateTime | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/suggested_post_paid.py b/aiogram/types/suggested_post_paid.py index 0bfacaca..941d8b17 100644 --- a/aiogram/types/suggested_post_paid.py +++ b/aiogram/types/suggested_post_paid.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,11 +18,11 @@ class SuggestedPostPaid(TelegramObject): currency: str """Currency in which the payment was made. Currently, one of 'XTR' for Telegram Stars or 'TON' for toncoins""" - suggested_post_message: Optional[Message] = None + suggested_post_message: Message | None = None """*Optional*. Message containing the suggested post. Note that the :class:`aiogram.types.message.Message` object in this field will not contain the *reply_to_message* field even if it itself is a reply.""" - amount: Optional[int] = None + amount: int | None = None """*Optional*. The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only""" - star_amount: Optional[StarAmount] = None + star_amount: StarAmount | None = None """*Optional*. The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only""" if TYPE_CHECKING: @@ -33,9 +33,9 @@ class SuggestedPostPaid(TelegramObject): __pydantic__self__, *, currency: str, - suggested_post_message: Optional[Message] = None, - amount: Optional[int] = None, - star_amount: Optional[StarAmount] = None, + suggested_post_message: Message | None = None, + amount: int | None = None, + star_amount: StarAmount | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/suggested_post_parameters.py b/aiogram/types/suggested_post_parameters.py index b48dbb98..8faa5825 100644 --- a/aiogram/types/suggested_post_parameters.py +++ b/aiogram/types/suggested_post_parameters.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject from .custom import DateTime @@ -16,9 +16,9 @@ class SuggestedPostParameters(TelegramObject): Source: https://core.telegram.org/bots/api#suggestedpostparameters """ - price: Optional[SuggestedPostPrice] = None + price: SuggestedPostPrice | None = None """*Optional*. Proposed price for the post. If the field is omitted, then the post is unpaid.""" - send_date: Optional[DateTime] = None + send_date: DateTime | None = None """*Optional*. Proposed send date of the post. If specified, then the date must be between 300 second and 2678400 seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user who approves it.""" if TYPE_CHECKING: @@ -28,8 +28,8 @@ class SuggestedPostParameters(TelegramObject): def __init__( __pydantic__self__, *, - price: Optional[SuggestedPostPrice] = None, - send_date: Optional[DateTime] = None, + price: SuggestedPostPrice | None = None, + send_date: DateTime | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/suggested_post_refunded.py b/aiogram/types/suggested_post_refunded.py index 7fd57a57..02b4cfa6 100644 --- a/aiogram/types/suggested_post_refunded.py +++ b/aiogram/types/suggested_post_refunded.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -17,7 +17,7 @@ class SuggestedPostRefunded(TelegramObject): reason: str """Reason for the refund. Currently, one of 'post_deleted' if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or 'payment_refunded' if the payer refunded their payment.""" - suggested_post_message: Optional[Message] = None + suggested_post_message: Message | None = None """*Optional*. Message containing the suggested post. Note that the :class:`aiogram.types.message.Message` object in this field will not contain the *reply_to_message* field even if it itself is a reply.""" if TYPE_CHECKING: @@ -28,7 +28,7 @@ class SuggestedPostRefunded(TelegramObject): __pydantic__self__, *, reason: str, - suggested_post_message: Optional[Message] = None, + suggested_post_message: Message | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/switch_inline_query_chosen_chat.py b/aiogram/types/switch_inline_query_chosen_chat.py index 0ff9b598..70721d79 100644 --- a/aiogram/types/switch_inline_query_chosen_chat.py +++ b/aiogram/types/switch_inline_query_chosen_chat.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -10,15 +10,15 @@ class SwitchInlineQueryChosenChat(TelegramObject): Source: https://core.telegram.org/bots/api#switchinlinequerychosenchat """ - query: Optional[str] = None + query: str | None = None """*Optional*. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted""" - allow_user_chats: Optional[bool] = None + allow_user_chats: bool | None = None """*Optional*. :code:`True`, if private chats with users can be chosen""" - allow_bot_chats: Optional[bool] = None + allow_bot_chats: bool | None = None """*Optional*. :code:`True`, if private chats with bots can be chosen""" - allow_group_chats: Optional[bool] = None + allow_group_chats: bool | None = None """*Optional*. :code:`True`, if group and supergroup chats can be chosen""" - allow_channel_chats: Optional[bool] = None + allow_channel_chats: bool | None = None """*Optional*. :code:`True`, if channel chats can be chosen""" if TYPE_CHECKING: @@ -28,11 +28,11 @@ class SwitchInlineQueryChosenChat(TelegramObject): def __init__( __pydantic__self__, *, - query: Optional[str] = None, - allow_user_chats: Optional[bool] = None, - allow_bot_chats: Optional[bool] = None, - allow_group_chats: Optional[bool] = None, - allow_channel_chats: Optional[bool] = None, + query: str | None = None, + allow_user_chats: bool | None = None, + allow_bot_chats: bool | None = None, + allow_group_chats: bool | None = None, + allow_channel_chats: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/text_quote.py b/aiogram/types/text_quote.py index e7c7c1bd..b0f610e3 100644 --- a/aiogram/types/text_quote.py +++ b/aiogram/types/text_quote.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -19,9 +19,9 @@ class TextQuote(TelegramObject): """Text of the quoted part of a message that is replied to by the given message""" position: int """Approximate quote position in the original message in UTF-16 code units as specified by the sender""" - entities: Optional[list[MessageEntity]] = None + entities: list[MessageEntity] | None = None """*Optional*. Special entities that appear in the quote. Currently, only *bold*, *italic*, *underline*, *strikethrough*, *spoiler*, and *custom_emoji* entities are kept in quotes.""" - is_manual: Optional[bool] = None + is_manual: bool | None = None """*Optional*. :code:`True`, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server.""" if TYPE_CHECKING: @@ -33,8 +33,8 @@ class TextQuote(TelegramObject): *, text: str, position: int, - entities: Optional[list[MessageEntity]] = None, - is_manual: Optional[bool] = None, + entities: list[MessageEntity] | None = None, + is_manual: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/transaction_partner_affiliate_program.py b/aiogram/types/transaction_partner_affiliate_program.py index d78ecef1..9b33ea34 100644 --- a/aiogram/types/transaction_partner_affiliate_program.py +++ b/aiogram/types/transaction_partner_affiliate_program.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import TransactionPartnerType from .transaction_partner import TransactionPartner @@ -22,7 +22,7 @@ class TransactionPartnerAffiliateProgram(TransactionPartner): """Type of the transaction partner, always 'affiliate_program'""" commission_per_mille: int """The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users""" - sponsor_user: Optional[User] = None + sponsor_user: User | None = None """*Optional*. Information about the bot that sponsored the affiliate program""" if TYPE_CHECKING: @@ -36,7 +36,7 @@ class TransactionPartnerAffiliateProgram(TransactionPartner): TransactionPartnerType.AFFILIATE_PROGRAM ] = TransactionPartnerType.AFFILIATE_PROGRAM, commission_per_mille: int, - sponsor_user: Optional[User] = None, + sponsor_user: User | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/transaction_partner_chat.py b/aiogram/types/transaction_partner_chat.py index 0bac5d37..e3a36e7a 100644 --- a/aiogram/types/transaction_partner_chat.py +++ b/aiogram/types/transaction_partner_chat.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import TransactionPartnerType from .transaction_partner import TransactionPartner @@ -21,7 +21,7 @@ class TransactionPartnerChat(TransactionPartner): """Type of the transaction partner, always 'chat'""" chat: Chat """Information about the chat""" - gift: Optional[Gift] = None + gift: Gift | None = None """*Optional*. The gift sent to the chat by the bot""" if TYPE_CHECKING: @@ -33,7 +33,7 @@ class TransactionPartnerChat(TransactionPartner): *, type: Literal[TransactionPartnerType.CHAT] = TransactionPartnerType.CHAT, chat: Chat, - gift: Optional[Gift] = None, + gift: Gift | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/transaction_partner_fragment.py b/aiogram/types/transaction_partner_fragment.py index 000e2281..25383908 100644 --- a/aiogram/types/transaction_partner_fragment.py +++ b/aiogram/types/transaction_partner_fragment.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import TransactionPartnerType from .transaction_partner import TransactionPartner @@ -18,7 +18,7 @@ class TransactionPartnerFragment(TransactionPartner): type: Literal[TransactionPartnerType.FRAGMENT] = TransactionPartnerType.FRAGMENT """Type of the transaction partner, always 'fragment'""" - withdrawal_state: Optional[RevenueWithdrawalStateUnion] = None + withdrawal_state: RevenueWithdrawalStateUnion | None = None """*Optional*. State of the transaction if the transaction is outgoing""" if TYPE_CHECKING: @@ -29,7 +29,7 @@ class TransactionPartnerFragment(TransactionPartner): __pydantic__self__, *, type: Literal[TransactionPartnerType.FRAGMENT] = TransactionPartnerType.FRAGMENT, - withdrawal_state: Optional[RevenueWithdrawalStateUnion] = None, + withdrawal_state: RevenueWithdrawalStateUnion | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/transaction_partner_union.py b/aiogram/types/transaction_partner_union.py index efe4489a..49bb3336 100644 --- a/aiogram/types/transaction_partner_union.py +++ b/aiogram/types/transaction_partner_union.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Union +from typing import TypeAlias from .transaction_partner_affiliate_program import TransactionPartnerAffiliateProgram from .transaction_partner_chat import TransactionPartnerChat @@ -10,12 +10,12 @@ from .transaction_partner_telegram_ads import TransactionPartnerTelegramAds from .transaction_partner_telegram_api import TransactionPartnerTelegramApi from .transaction_partner_user import TransactionPartnerUser -TransactionPartnerUnion = Union[ - TransactionPartnerUser, - TransactionPartnerChat, - TransactionPartnerAffiliateProgram, - TransactionPartnerFragment, - TransactionPartnerTelegramAds, - TransactionPartnerTelegramApi, - TransactionPartnerOther, -] +TransactionPartnerUnion: TypeAlias = ( + TransactionPartnerUser + | TransactionPartnerChat + | TransactionPartnerAffiliateProgram + | TransactionPartnerFragment + | TransactionPartnerTelegramAds + | TransactionPartnerTelegramApi + | TransactionPartnerOther +) diff --git a/aiogram/types/transaction_partner_user.py b/aiogram/types/transaction_partner_user.py index b6ef45f5..482cf481 100644 --- a/aiogram/types/transaction_partner_user.py +++ b/aiogram/types/transaction_partner_user.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal from ..enums import TransactionPartnerType from .transaction_partner import TransactionPartner @@ -25,19 +25,19 @@ class TransactionPartnerUser(TransactionPartner): """Type of the transaction, currently one of 'invoice_payment' for payments via invoices, 'paid_media_payment' for payments for paid media, 'gift_purchase' for gifts sent by the bot, 'premium_purchase' for Telegram Premium subscriptions gifted by the bot, 'business_account_transfer' for direct transfers from managed business accounts""" user: User """Information about the user""" - affiliate: Optional[AffiliateInfo] = None + affiliate: AffiliateInfo | None = None """*Optional*. Information about the affiliate that received a commission via this transaction. Can be available only for 'invoice_payment' and 'paid_media_payment' transactions.""" - invoice_payload: Optional[str] = None + invoice_payload: str | None = None """*Optional*. Bot-specified invoice payload. Can be available only for 'invoice_payment' transactions.""" - subscription_period: Optional[int] = None + subscription_period: int | None = None """*Optional*. The duration of the paid subscription. Can be available only for 'invoice_payment' transactions.""" - paid_media: Optional[list[PaidMediaUnion]] = None + paid_media: list[PaidMediaUnion] | None = None """*Optional*. Information about the paid media bought by the user; for 'paid_media_payment' transactions only""" - paid_media_payload: Optional[str] = None + paid_media_payload: str | None = None """*Optional*. Bot-specified paid media payload. Can be available only for 'paid_media_payment' transactions.""" - gift: Optional[Gift] = None + gift: Gift | None = None """*Optional*. The gift sent to the user by the bot; for 'gift_purchase' transactions only""" - premium_subscription_duration: Optional[int] = None + premium_subscription_duration: int | None = None """*Optional*. Number of months the gifted Telegram Premium subscription will be active for; for 'premium_purchase' transactions only""" if TYPE_CHECKING: @@ -50,13 +50,13 @@ class TransactionPartnerUser(TransactionPartner): type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER, transaction_type: str, user: User, - affiliate: Optional[AffiliateInfo] = None, - invoice_payload: Optional[str] = None, - subscription_period: Optional[int] = None, - paid_media: Optional[list[PaidMediaUnion]] = None, - paid_media_payload: Optional[str] = None, - gift: Optional[Gift] = None, - premium_subscription_duration: Optional[int] = None, + affiliate: AffiliateInfo | None = None, + invoice_payload: str | None = None, + subscription_period: int | None = None, + paid_media: list[PaidMediaUnion] | None = None, + paid_media_payload: str | None = None, + gift: Gift | None = None, + premium_subscription_duration: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/unique_gift.py b/aiogram/types/unique_gift.py index c8de0b77..586e79a6 100644 --- a/aiogram/types/unique_gift.py +++ b/aiogram/types/unique_gift.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -33,13 +33,13 @@ class UniqueGift(TelegramObject): """Symbol of the gift""" backdrop: UniqueGiftBackdrop """Backdrop of the gift""" - is_premium: Optional[bool] = None + is_premium: bool | None = None """*Optional*. :code:`True`, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers""" - is_from_blockchain: Optional[bool] = None + is_from_blockchain: bool | None = None """*Optional*. :code:`True`, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram""" - colors: Optional[UniqueGiftColors] = None + colors: UniqueGiftColors | None = None """*Optional*. The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only""" - publisher_chat: Optional[Chat] = None + publisher_chat: Chat | None = None """*Optional*. Information about the chat that published the gift""" if TYPE_CHECKING: @@ -56,10 +56,10 @@ class UniqueGift(TelegramObject): model: UniqueGiftModel, symbol: UniqueGiftSymbol, backdrop: UniqueGiftBackdrop, - is_premium: Optional[bool] = None, - is_from_blockchain: Optional[bool] = None, - colors: Optional[UniqueGiftColors] = None, - publisher_chat: Optional[Chat] = None, + is_premium: bool | None = None, + is_from_blockchain: bool | None = None, + colors: UniqueGiftColors | None = None, + publisher_chat: Chat | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/unique_gift_info.py b/aiogram/types/unique_gift_info.py index 4fd3a0c2..0897c1be 100644 --- a/aiogram/types/unique_gift_info.py +++ b/aiogram/types/unique_gift_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -22,17 +22,17 @@ class UniqueGiftInfo(TelegramObject): """Information about the gift""" origin: str """Origin of the gift. Currently, either 'upgrade' for gifts upgraded from regular gifts, 'transfer' for gifts transferred from other users or channels, 'resale' for gifts bought from other users, 'gifted_upgrade' for upgrades purchased after the gift was sent, or 'offer' for gifts bought or sold through gift purchase offers""" - last_resale_currency: Optional[str] = None + last_resale_currency: str | None = None """*Optional*. For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of 'XTR' for Telegram Stars or 'TON' for toncoins.""" - last_resale_amount: Optional[int] = None + last_resale_amount: int | None = None """*Optional*. For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanotoncoins""" - owned_gift_id: Optional[str] = None + owned_gift_id: str | None = None """*Optional*. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts""" - transfer_star_count: Optional[int] = None + transfer_star_count: int | None = None """*Optional*. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift""" - next_transfer_date: Optional[DateTime] = None + next_transfer_date: DateTime | None = None """*Optional*. Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now""" - last_resale_star_count: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) + last_resale_star_count: int | None = Field(None, json_schema_extra={"deprecated": True}) """*Optional*. For gifts bought from other users, the price paid for the gift .. deprecated:: API:9.3 @@ -47,12 +47,12 @@ class UniqueGiftInfo(TelegramObject): *, gift: UniqueGift, origin: str, - last_resale_currency: Optional[str] = None, - last_resale_amount: Optional[int] = None, - owned_gift_id: Optional[str] = None, - transfer_star_count: Optional[int] = None, - next_transfer_date: Optional[DateTime] = None, - last_resale_star_count: Optional[int] = None, + last_resale_currency: str | None = None, + last_resale_amount: int | None = None, + owned_gift_id: str | None = None, + transfer_star_count: int | None = None, + next_transfer_date: DateTime | None = None, + last_resale_star_count: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/update.py b/aiogram/types/update.py index 9b38bc48..aab31339 100644 --- a/aiogram/types/update.py +++ b/aiogram/types/update.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional, cast +from typing import TYPE_CHECKING, Any, cast from ..utils.mypy_hacks import lru_cache from .base import TelegramObject @@ -36,51 +36,51 @@ class Update(TelegramObject): update_id: int """The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using `webhooks `_, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.""" - message: Optional[Message] = None + message: Message | None = None """*Optional*. New incoming message of any kind - text, photo, sticker, etc.""" - edited_message: Optional[Message] = None + edited_message: Message | None = None """*Optional*. New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.""" - channel_post: Optional[Message] = None + channel_post: Message | None = None """*Optional*. New incoming channel post of any kind - text, photo, sticker, etc.""" - edited_channel_post: Optional[Message] = None + edited_channel_post: Message | None = None """*Optional*. New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.""" - business_connection: Optional[BusinessConnection] = None + business_connection: BusinessConnection | None = None """*Optional*. The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot""" - business_message: Optional[Message] = None + business_message: Message | None = None """*Optional*. New message from a connected business account""" - edited_business_message: Optional[Message] = None + edited_business_message: Message | None = None """*Optional*. New version of a message from a connected business account""" - deleted_business_messages: Optional[BusinessMessagesDeleted] = None + deleted_business_messages: BusinessMessagesDeleted | None = None """*Optional*. Messages were deleted from a connected business account""" - message_reaction: Optional[MessageReactionUpdated] = None + message_reaction: MessageReactionUpdated | None = None """*Optional*. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify :code:`"message_reaction"` in the list of *allowed_updates* to receive these updates. The update isn't received for reactions set by bots.""" - message_reaction_count: Optional[MessageReactionCountUpdated] = None + message_reaction_count: MessageReactionCountUpdated | None = None """*Optional*. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify :code:`"message_reaction_count"` in the list of *allowed_updates* to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.""" - inline_query: Optional[InlineQuery] = None + inline_query: InlineQuery | None = None """*Optional*. New incoming `inline `_ query""" - chosen_inline_result: Optional[ChosenInlineResult] = None + chosen_inline_result: ChosenInlineResult | None = None """*Optional*. The result of an `inline `_ query that was chosen by a user and sent to their chat partner. Please see our documentation on the `feedback collecting `_ for details on how to enable these updates for your bot.""" - callback_query: Optional[CallbackQuery] = None + callback_query: CallbackQuery | None = None """*Optional*. New incoming callback query""" - shipping_query: Optional[ShippingQuery] = None + shipping_query: ShippingQuery | None = None """*Optional*. New incoming shipping query. Only for invoices with flexible price""" - pre_checkout_query: Optional[PreCheckoutQuery] = None + pre_checkout_query: PreCheckoutQuery | None = None """*Optional*. New incoming pre-checkout query. Contains full information about checkout""" - purchased_paid_media: Optional[PaidMediaPurchased] = None + purchased_paid_media: PaidMediaPurchased | None = None """*Optional*. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat""" - poll: Optional[Poll] = None + poll: Poll | None = None """*Optional*. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot""" - poll_answer: Optional[PollAnswer] = None + poll_answer: PollAnswer | None = None """*Optional*. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.""" - my_chat_member: Optional[ChatMemberUpdated] = None + my_chat_member: ChatMemberUpdated | None = None """*Optional*. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.""" - chat_member: Optional[ChatMemberUpdated] = None + chat_member: ChatMemberUpdated | None = None """*Optional*. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify :code:`"chat_member"` in the list of *allowed_updates* to receive these updates.""" - chat_join_request: Optional[ChatJoinRequest] = None + chat_join_request: ChatJoinRequest | None = None """*Optional*. A request to join the chat has been sent. The bot must have the *can_invite_users* administrator right in the chat to receive these updates.""" - chat_boost: Optional[ChatBoostUpdated] = None + chat_boost: ChatBoostUpdated | None = None """*Optional*. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.""" - removed_chat_boost: Optional[ChatBoostRemoved] = None + removed_chat_boost: ChatBoostRemoved | None = None """*Optional*. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.""" if TYPE_CHECKING: @@ -91,29 +91,29 @@ class Update(TelegramObject): __pydantic__self__, *, update_id: int, - message: Optional[Message] = None, - edited_message: Optional[Message] = None, - channel_post: Optional[Message] = None, - edited_channel_post: Optional[Message] = None, - business_connection: Optional[BusinessConnection] = None, - business_message: Optional[Message] = None, - edited_business_message: Optional[Message] = None, - deleted_business_messages: Optional[BusinessMessagesDeleted] = None, - message_reaction: Optional[MessageReactionUpdated] = None, - message_reaction_count: Optional[MessageReactionCountUpdated] = None, - inline_query: Optional[InlineQuery] = None, - chosen_inline_result: Optional[ChosenInlineResult] = None, - callback_query: Optional[CallbackQuery] = None, - shipping_query: Optional[ShippingQuery] = None, - pre_checkout_query: Optional[PreCheckoutQuery] = None, - purchased_paid_media: Optional[PaidMediaPurchased] = None, - poll: Optional[Poll] = None, - poll_answer: Optional[PollAnswer] = None, - my_chat_member: Optional[ChatMemberUpdated] = None, - chat_member: Optional[ChatMemberUpdated] = None, - chat_join_request: Optional[ChatJoinRequest] = None, - chat_boost: Optional[ChatBoostUpdated] = None, - removed_chat_boost: Optional[ChatBoostRemoved] = None, + message: Message | None = None, + edited_message: Message | None = None, + channel_post: Message | None = None, + edited_channel_post: Message | None = None, + business_connection: BusinessConnection | None = None, + business_message: Message | None = None, + edited_business_message: Message | None = None, + deleted_business_messages: BusinessMessagesDeleted | None = None, + message_reaction: MessageReactionUpdated | None = None, + message_reaction_count: MessageReactionCountUpdated | None = None, + inline_query: InlineQuery | None = None, + chosen_inline_result: ChosenInlineResult | None = None, + callback_query: CallbackQuery | None = None, + shipping_query: ShippingQuery | None = None, + pre_checkout_query: PreCheckoutQuery | None = None, + purchased_paid_media: PaidMediaPurchased | None = None, + poll: Poll | None = None, + poll_answer: PollAnswer | None = None, + my_chat_member: ChatMemberUpdated | None = None, + chat_member: ChatMemberUpdated | None = None, + chat_join_request: ChatJoinRequest | None = None, + chat_boost: ChatBoostUpdated | None = None, + removed_chat_boost: ChatBoostRemoved | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/user.py b/aiogram/types/user.py index 21df1a2a..0dfb7ee2 100644 --- a/aiogram/types/user.py +++ b/aiogram/types/user.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from ..utils import markdown from ..utils.link import create_tg_link @@ -23,27 +23,27 @@ class User(TelegramObject): """:code:`True`, if this user is a bot""" first_name: str """User's or bot's first name""" - last_name: Optional[str] = None + last_name: str | None = None """*Optional*. User's or bot's last name""" - username: Optional[str] = None + username: str | None = None """*Optional*. User's or bot's username""" - language_code: Optional[str] = None + language_code: str | None = None """*Optional*. `IETF language tag `_ of the user's language""" - is_premium: Optional[bool] = None + is_premium: bool | None = None """*Optional*. :code:`True`, if this user is a Telegram Premium user""" - added_to_attachment_menu: Optional[bool] = None + added_to_attachment_menu: bool | None = None """*Optional*. :code:`True`, if this user added the bot to the attachment menu""" - can_join_groups: Optional[bool] = None + can_join_groups: bool | None = None """*Optional*. :code:`True`, if the bot can be invited to groups. Returned only in :class:`aiogram.methods.get_me.GetMe`.""" - can_read_all_group_messages: Optional[bool] = None + can_read_all_group_messages: bool | None = None """*Optional*. :code:`True`, if `privacy mode `_ is disabled for the bot. Returned only in :class:`aiogram.methods.get_me.GetMe`.""" - supports_inline_queries: Optional[bool] = None + supports_inline_queries: bool | None = None """*Optional*. :code:`True`, if the bot supports inline queries. Returned only in :class:`aiogram.methods.get_me.GetMe`.""" - can_connect_to_business: Optional[bool] = None + can_connect_to_business: bool | None = None """*Optional*. :code:`True`, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in :class:`aiogram.methods.get_me.GetMe`.""" - has_main_web_app: Optional[bool] = None + has_main_web_app: bool | None = None """*Optional*. :code:`True`, if the bot has a main Web App. Returned only in :class:`aiogram.methods.get_me.GetMe`.""" - has_topics_enabled: Optional[bool] = None + has_topics_enabled: bool | None = None """*Optional*. :code:`True`, if the bot has forum topic mode enabled in private chats. Returned only in :class:`aiogram.methods.get_me.GetMe`.""" if TYPE_CHECKING: @@ -56,17 +56,17 @@ class User(TelegramObject): id: int, is_bot: bool, first_name: str, - last_name: Optional[str] = None, - username: Optional[str] = None, - language_code: Optional[str] = None, - is_premium: Optional[bool] = None, - added_to_attachment_menu: Optional[bool] = None, - can_join_groups: Optional[bool] = None, - can_read_all_group_messages: Optional[bool] = None, - supports_inline_queries: Optional[bool] = None, - can_connect_to_business: Optional[bool] = None, - has_main_web_app: Optional[bool] = None, - has_topics_enabled: Optional[bool] = None, + last_name: str | None = None, + username: str | None = None, + language_code: str | None = None, + is_premium: bool | None = None, + added_to_attachment_menu: bool | None = None, + can_join_groups: bool | None = None, + can_read_all_group_messages: bool | None = None, + supports_inline_queries: bool | None = None, + can_connect_to_business: bool | None = None, + has_main_web_app: bool | None = None, + has_topics_enabled: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! @@ -101,20 +101,20 @@ class User(TelegramObject): def url(self) -> str: return create_tg_link("user", id=self.id) - def mention_markdown(self, name: Optional[str] = None) -> str: + def mention_markdown(self, name: str | None = None) -> str: if name is None: name = self.full_name return markdown.link(name, self.url) - def mention_html(self, name: Optional[str] = None) -> str: + def mention_html(self, name: str | None = None) -> str: if name is None: name = self.full_name return markdown.hlink(name, self.url) def get_profile_photos( self, - offset: Optional[int] = None, - limit: Optional[int] = None, + offset: int | None = None, + limit: int | None = None, **kwargs: Any, ) -> GetUserProfilePhotos: """ diff --git a/aiogram/types/user_rating.py b/aiogram/types/user_rating.py index f00fe788..d16cbc52 100644 --- a/aiogram/types/user_rating.py +++ b/aiogram/types/user_rating.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,7 +18,7 @@ class UserRating(TelegramObject): """Numerical value of the user's rating; the higher the rating, the better""" current_level_rating: int """The rating value required to get the current level""" - next_level_rating: Optional[int] = None + next_level_rating: int | None = None """*Optional*. The rating value required to get to the next level; omitted if the maximum level was reached""" if TYPE_CHECKING: @@ -31,7 +31,7 @@ class UserRating(TelegramObject): level: int, rating: int, current_level_rating: int, - next_level_rating: Optional[int] = None, + next_level_rating: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/users_shared.py b/aiogram/types/users_shared.py index f2835421..8228a9b9 100644 --- a/aiogram/types/users_shared.py +++ b/aiogram/types/users_shared.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from pydantic import Field @@ -21,7 +21,7 @@ class UsersShared(TelegramObject): """Identifier of the request""" users: list[SharedUser] """Information about users shared with the bot.""" - user_ids: Optional[list[int]] = Field(None, json_schema_extra={"deprecated": True}) + user_ids: list[int] | None = Field(None, json_schema_extra={"deprecated": True}) """Identifiers of the shared users. These numbers may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting them. But they have at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the users and could be unable to use these identifiers, unless the users are already known to the bot by some other means. .. deprecated:: API:7.2 @@ -36,7 +36,7 @@ class UsersShared(TelegramObject): *, request_id: int, users: list[SharedUser], - user_ids: Optional[list[int]] = None, + user_ids: list[int] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/venue.py b/aiogram/types/venue.py index e0a3f848..108e80a4 100644 --- a/aiogram/types/venue.py +++ b/aiogram/types/venue.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -21,13 +21,13 @@ class Venue(TelegramObject): """Name of the venue""" address: str """Address of the venue""" - foursquare_id: Optional[str] = None + foursquare_id: str | None = None """*Optional*. Foursquare identifier of the venue""" - foursquare_type: Optional[str] = None + foursquare_type: str | None = None """*Optional*. Foursquare type of the venue. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" - google_place_id: Optional[str] = None + google_place_id: str | None = None """*Optional*. Google Places identifier of the venue""" - google_place_type: Optional[str] = None + google_place_type: str | None = None """*Optional*. Google Places type of the venue. (See `supported types `_.)""" if TYPE_CHECKING: @@ -40,10 +40,10 @@ class Venue(TelegramObject): location: Location, title: str, address: str, - foursquare_id: Optional[str] = None, - foursquare_type: Optional[str] = None, - google_place_id: Optional[str] = None, - google_place_type: Optional[str] = None, + foursquare_id: str | None = None, + foursquare_type: str | None = None, + google_place_id: str | None = None, + google_place_type: str | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/video.py b/aiogram/types/video.py index de97c7fe..a13c9c96 100644 --- a/aiogram/types/video.py +++ b/aiogram/types/video.py @@ -1,7 +1,7 @@ from __future__ import annotations import datetime -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -26,17 +26,17 @@ class Video(TelegramObject): """Video height as defined by the sender""" duration: int """Duration of the video in seconds as defined by the sender""" - thumbnail: Optional[PhotoSize] = None + thumbnail: PhotoSize | None = None """*Optional*. Video thumbnail""" - cover: Optional[list[PhotoSize]] = None + cover: list[PhotoSize] | None = None """*Optional*. Available sizes of the cover of the video in the message""" - start_timestamp: Optional[datetime.datetime] = None + start_timestamp: datetime.datetime | None = None """*Optional*. Timestamp in seconds from which the video will play in the message""" - file_name: Optional[str] = None + file_name: str | None = None """*Optional*. Original filename as defined by the sender""" - mime_type: Optional[str] = None + mime_type: str | None = None """*Optional*. MIME type of the file as defined by the sender""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" if TYPE_CHECKING: @@ -51,12 +51,12 @@ class Video(TelegramObject): width: int, height: int, duration: int, - thumbnail: Optional[PhotoSize] = None, - cover: Optional[list[PhotoSize]] = None, - start_timestamp: Optional[datetime.datetime] = None, - file_name: Optional[str] = None, - mime_type: Optional[str] = None, - file_size: Optional[int] = None, + thumbnail: PhotoSize | None = None, + cover: list[PhotoSize] | None = None, + start_timestamp: datetime.datetime | None = None, + file_name: str | None = None, + mime_type: str | None = None, + file_size: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/video_note.py b/aiogram/types/video_note.py index 5be85028..223458c2 100644 --- a/aiogram/types/video_note.py +++ b/aiogram/types/video_note.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -23,9 +23,9 @@ class VideoNote(TelegramObject): """Video width and height (diameter of the video message) as defined by the sender""" duration: int """Duration of the video in seconds as defined by the sender""" - thumbnail: Optional[PhotoSize] = None + thumbnail: PhotoSize | None = None """*Optional*. Video thumbnail""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes""" if TYPE_CHECKING: @@ -39,8 +39,8 @@ class VideoNote(TelegramObject): file_unique_id: str, length: int, duration: int, - thumbnail: Optional[PhotoSize] = None, - file_size: Optional[int] = None, + thumbnail: PhotoSize | None = None, + file_size: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/voice.py b/aiogram/types/voice.py index d5e0abcd..1fdcf1dc 100644 --- a/aiogram/types/voice.py +++ b/aiogram/types/voice.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject @@ -18,9 +18,9 @@ class Voice(TelegramObject): """Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.""" duration: int """Duration of the audio in seconds as defined by the sender""" - mime_type: Optional[str] = None + mime_type: str | None = None """*Optional*. MIME type of the file as defined by the sender""" - file_size: Optional[int] = None + file_size: int | None = None """*Optional*. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.""" if TYPE_CHECKING: @@ -33,8 +33,8 @@ class Voice(TelegramObject): file_id: str, file_unique_id: str, duration: int, - mime_type: Optional[str] = None, - file_size: Optional[int] = None, + mime_type: str | None = None, + file_size: int | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/webhook_info.py b/aiogram/types/webhook_info.py index 47fa0d03..c0d2c4e1 100644 --- a/aiogram/types/webhook_info.py +++ b/aiogram/types/webhook_info.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from .base import TelegramObject from .custom import DateTime @@ -19,17 +19,17 @@ class WebhookInfo(TelegramObject): """:code:`True`, if a custom certificate was provided for webhook certificate checks""" pending_update_count: int """Number of updates awaiting delivery""" - ip_address: Optional[str] = None + ip_address: str | None = None """*Optional*. Currently used webhook IP address""" - last_error_date: Optional[DateTime] = None + last_error_date: DateTime | None = None """*Optional*. Unix time for the most recent error that happened when trying to deliver an update via webhook""" - last_error_message: Optional[str] = None + last_error_message: str | None = None """*Optional*. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook""" - last_synchronization_error_date: Optional[DateTime] = None + last_synchronization_error_date: DateTime | None = None """*Optional*. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters""" - max_connections: Optional[int] = None + max_connections: int | None = None """*Optional*. The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery""" - allowed_updates: Optional[list[str]] = None + allowed_updates: list[str] | None = None """*Optional*. A list of update types the bot is subscribed to. Defaults to all update types except *chat_member*""" if TYPE_CHECKING: @@ -42,12 +42,12 @@ class WebhookInfo(TelegramObject): url: str, has_custom_certificate: bool, pending_update_count: int, - ip_address: Optional[str] = None, - last_error_date: Optional[DateTime] = None, - last_error_message: Optional[str] = None, - last_synchronization_error_date: Optional[DateTime] = None, - max_connections: Optional[int] = None, - allowed_updates: Optional[list[str]] = None, + ip_address: str | None = None, + last_error_date: DateTime | None = None, + last_error_message: str | None = None, + last_synchronization_error_date: DateTime | None = None, + max_connections: int | None = None, + allowed_updates: list[str] | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/types/write_access_allowed.py b/aiogram/types/write_access_allowed.py index 263a3277..77e933f2 100644 --- a/aiogram/types/write_access_allowed.py +++ b/aiogram/types/write_access_allowed.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any from aiogram.types import TelegramObject @@ -10,11 +10,11 @@ class WriteAccessAllowed(TelegramObject): Source: https://core.telegram.org/bots/api#writeaccessallowed """ - from_request: Optional[bool] = None + from_request: bool | None = None """*Optional*. :code:`True`, if the access was granted after the user accepted an explicit request from a Web App sent by the method `requestWriteAccess `_""" - web_app_name: Optional[str] = None + web_app_name: str | None = None """*Optional*. Name of the Web App, if the access was granted when the Web App was launched from a link""" - from_attachment_menu: Optional[bool] = None + from_attachment_menu: bool | None = None """*Optional*. :code:`True`, if the access was granted when the bot was added to the attachment or side menu""" if TYPE_CHECKING: @@ -24,9 +24,9 @@ class WriteAccessAllowed(TelegramObject): def __init__( __pydantic__self__, *, - from_request: Optional[bool] = None, - web_app_name: Optional[str] = None, - from_attachment_menu: Optional[bool] = None, + from_request: bool | None = None, + web_app_name: str | None = None, + from_attachment_menu: bool | None = None, **__pydantic_kwargs: Any, ) -> None: # DO NOT EDIT MANUALLY!!! diff --git a/aiogram/utils/dataclass.py b/aiogram/utils/dataclass.py index acfab6f7..28ffc68e 100644 --- a/aiogram/utils/dataclass.py +++ b/aiogram/utils/dataclass.py @@ -5,7 +5,7 @@ DO NOT USE THIS MODULE DIRECTLY. IT IS INTENDED FOR INTERNAL USE ONLY. """ import sys -from typing import Any, Union +from typing import Any def dataclass_kwargs( diff --git a/aiogram/utils/deep_linking.py b/aiogram/utils/deep_linking.py index 80a97bec..4892ca5a 100644 --- a/aiogram/utils/deep_linking.py +++ b/aiogram/utils/deep_linking.py @@ -11,7 +11,7 @@ __all__ = [ ] import re -from typing import TYPE_CHECKING, Literal, Optional, cast +from typing import TYPE_CHECKING, Literal, cast from aiogram.utils.link import create_telegram_link from aiogram.utils.payload import decode_payload, encode_payload diff --git a/aiogram/utils/formatting.py b/aiogram/utils/formatting.py index 22b8723b..cbfd9758 100644 --- a/aiogram/utils/formatting.py +++ b/aiogram/utils/formatting.py @@ -2,7 +2,7 @@ from __future__ import annotations import textwrap from collections.abc import Generator, Iterable, Iterator -from typing import TYPE_CHECKING, Any, ClassVar +from typing import Any, ClassVar from typing_extensions import Self diff --git a/aiogram/utils/keyboard.py b/aiogram/utils/keyboard.py index 582c481d..8824edfd 100644 --- a/aiogram/utils/keyboard.py +++ b/aiogram/utils/keyboard.py @@ -96,7 +96,7 @@ class KeyboardBuilder(ABC, Generic[ButtonType]): """ if not isinstance(row, list): msg = ( - f"Row {row!r} should be type 'List[{self._button_type.__name__}]' " + f"Row {row!r} should be type 'list[{self._button_type.__name__}]' " f"not type {type(row).__name__}" ) raise ValueError(msg) @@ -117,7 +117,7 @@ class KeyboardBuilder(ABC, Generic[ButtonType]): count = 0 if not isinstance(markup, list): msg = ( - f"Markup should be type 'List[List[{self._button_type.__name__}]]' " + f"Markup should be type 'list[list[{self._button_type.__name__}]]' " f"not type {type(markup).__name__!r}" ) raise ValueError(msg) diff --git a/aiogram/utils/link.py b/aiogram/utils/link.py index b6ce70e0..e1575303 100644 --- a/aiogram/utils/link.py +++ b/aiogram/utils/link.py @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any from urllib.parse import urlencode, urljoin BASE_DOCS_URL = "https://docs.aiogram.dev/" diff --git a/aiogram/utils/serialization.py b/aiogram/utils/serialization.py index 5f69d6b2..cfa47f4d 100644 --- a/aiogram/utils/serialization.py +++ b/aiogram/utils/serialization.py @@ -24,7 +24,7 @@ class DeserializedTelegramObject: :type data: Any :param files: The dictionary containing the file names as keys and the corresponding `InputFile` objects as values. - :type files: Dict[str, InputFile] + :type files: dict[str, InputFile] """ data: Any diff --git a/aiogram/utils/text_decorations.py b/aiogram/utils/text_decorations.py index 53cb70be..00762c0a 100644 --- a/aiogram/utils/text_decorations.py +++ b/aiogram/utils/text_decorations.py @@ -264,7 +264,7 @@ class MarkdownDecoration(TextDecoration): return re.sub(pattern=self.MARKDOWN_QUOTE_PATTERN, repl=r"\\\1", string=value) def custom_emoji(self, value: str, custom_emoji_id: str) -> str: - return f'!{self.link(value=value, link=f"tg://emoji?id={custom_emoji_id}")}' + return f"!{self.link(value=value, link=f'tg://emoji?id={custom_emoji_id}')}" def blockquote(self, value: str) -> str: return "\n".join(f">{line}" for line in value.splitlines()) diff --git a/docs/api/methods/edit_message_caption.rst b/docs/api/methods/edit_message_caption.rst index a37c17a5..85959fbc 100644 --- a/docs/api/methods/edit_message_caption.rst +++ b/docs/api/methods/edit_message_caption.rst @@ -2,7 +2,7 @@ editMessageCaption ################## -Returns: :obj:`Union[Message, bool]` +Returns: :obj:`Message | bool` .. automodule:: aiogram.methods.edit_message_caption :members: @@ -19,7 +19,7 @@ As bot method .. code-block:: - result: Union[Message, bool] = await bot.edit_message_caption(...) + result: Message | bool = await bot.edit_message_caption(...) Method as object @@ -35,7 +35,7 @@ With specific bot .. code-block:: python - result: Union[Message, bool] = await bot(EditMessageCaption(...)) + result: Message | bool = await bot(EditMessageCaption(...)) As reply into Webhook in handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/methods/edit_message_live_location.rst b/docs/api/methods/edit_message_live_location.rst index f2f0b3df..eb384aa5 100644 --- a/docs/api/methods/edit_message_live_location.rst +++ b/docs/api/methods/edit_message_live_location.rst @@ -2,7 +2,7 @@ editMessageLiveLocation ####################### -Returns: :obj:`Union[Message, bool]` +Returns: :obj:`Message | bool` .. automodule:: aiogram.methods.edit_message_live_location :members: @@ -19,7 +19,7 @@ As bot method .. code-block:: - result: Union[Message, bool] = await bot.edit_message_live_location(...) + result: Message | bool = await bot.edit_message_live_location(...) Method as object @@ -35,7 +35,7 @@ With specific bot .. code-block:: python - result: Union[Message, bool] = await bot(EditMessageLiveLocation(...)) + result: Message | bool = await bot(EditMessageLiveLocation(...)) As reply into Webhook in handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/methods/edit_message_media.rst b/docs/api/methods/edit_message_media.rst index aae7d89b..1cd05a5f 100644 --- a/docs/api/methods/edit_message_media.rst +++ b/docs/api/methods/edit_message_media.rst @@ -2,7 +2,7 @@ editMessageMedia ################ -Returns: :obj:`Union[Message, bool]` +Returns: :obj:`Message | bool` .. automodule:: aiogram.methods.edit_message_media :members: @@ -19,7 +19,7 @@ As bot method .. code-block:: - result: Union[Message, bool] = await bot.edit_message_media(...) + result: Message | bool = await bot.edit_message_media(...) Method as object @@ -35,7 +35,7 @@ With specific bot .. code-block:: python - result: Union[Message, bool] = await bot(EditMessageMedia(...)) + result: Message | bool = await bot(EditMessageMedia(...)) As reply into Webhook in handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/methods/edit_message_reply_markup.rst b/docs/api/methods/edit_message_reply_markup.rst index 6d67bdbe..309ef712 100644 --- a/docs/api/methods/edit_message_reply_markup.rst +++ b/docs/api/methods/edit_message_reply_markup.rst @@ -2,7 +2,7 @@ editMessageReplyMarkup ###################### -Returns: :obj:`Union[Message, bool]` +Returns: :obj:`Message | bool` .. automodule:: aiogram.methods.edit_message_reply_markup :members: @@ -19,7 +19,7 @@ As bot method .. code-block:: - result: Union[Message, bool] = await bot.edit_message_reply_markup(...) + result: Message | bool = await bot.edit_message_reply_markup(...) Method as object @@ -35,7 +35,7 @@ With specific bot .. code-block:: python - result: Union[Message, bool] = await bot(EditMessageReplyMarkup(...)) + result: Message | bool = await bot(EditMessageReplyMarkup(...)) As reply into Webhook in handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/methods/edit_message_text.rst b/docs/api/methods/edit_message_text.rst index b707de73..cab3bb89 100644 --- a/docs/api/methods/edit_message_text.rst +++ b/docs/api/methods/edit_message_text.rst @@ -2,7 +2,7 @@ editMessageText ############### -Returns: :obj:`Union[Message, bool]` +Returns: :obj:`Message | bool` .. automodule:: aiogram.methods.edit_message_text :members: @@ -19,7 +19,7 @@ As bot method .. code-block:: - result: Union[Message, bool] = await bot.edit_message_text(...) + result: Message | bool = await bot.edit_message_text(...) Method as object @@ -35,7 +35,7 @@ With specific bot .. code-block:: python - result: Union[Message, bool] = await bot(EditMessageText(...)) + result: Message | bool = await bot(EditMessageText(...)) As reply into Webhook in handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/methods/set_game_score.rst b/docs/api/methods/set_game_score.rst index 6a227095..73dae21a 100644 --- a/docs/api/methods/set_game_score.rst +++ b/docs/api/methods/set_game_score.rst @@ -2,7 +2,7 @@ setGameScore ############ -Returns: :obj:`Union[Message, bool]` +Returns: :obj:`Message | bool` .. automodule:: aiogram.methods.set_game_score :members: @@ -19,7 +19,7 @@ As bot method .. code-block:: - result: Union[Message, bool] = await bot.set_game_score(...) + result: Message | bool = await bot.set_game_score(...) Method as object @@ -35,7 +35,7 @@ With specific bot .. code-block:: python - result: Union[Message, bool] = await bot(SetGameScore(...)) + result: Message | bool = await bot(SetGameScore(...)) As reply into Webhook in handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/api/methods/stop_message_live_location.rst b/docs/api/methods/stop_message_live_location.rst index 568d41cc..d71c1cb0 100644 --- a/docs/api/methods/stop_message_live_location.rst +++ b/docs/api/methods/stop_message_live_location.rst @@ -2,7 +2,7 @@ stopMessageLiveLocation ####################### -Returns: :obj:`Union[Message, bool]` +Returns: :obj:`Message | bool` .. automodule:: aiogram.methods.stop_message_live_location :members: @@ -19,7 +19,7 @@ As bot method .. code-block:: - result: Union[Message, bool] = await bot.stop_message_live_location(...) + result: Message | bool = await bot.stop_message_live_location(...) Method as object @@ -35,7 +35,7 @@ With specific bot .. code-block:: python - result: Union[Message, bool] = await bot(StopMessageLiveLocation(...)) + result: Message | bool = await bot(StopMessageLiveLocation(...)) As reply into Webhook in handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~