From c556290e3e31307c6d3e01916ddfd40ed079a3a0 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 21 Nov 2022 01:47:40 +0200 Subject: [PATCH] Render shortcuts --- .butcher/types/CallbackQuery/aliases.yml | 4 + .butcher/types/Chat/aliases.yml | 216 +-- .butcher/types/ChatJoinRequest/aliases.yml | 8 + .butcher/types/InlineQuery/aliases.yml | 4 + .butcher/types/Message/aliases.yml | 328 ++-- .butcher/types/Sticker/aliases.yml | 8 + .butcher/types/User/aliases.yml | 4 + CHANGES/952.feature.rst | 1 + aiogram/types/callback_query.py | 30 +- aiogram/types/chat.py | 890 +++++++++- aiogram/types/chat_join_request.py | 48 +- aiogram/types/inline_query.py | 34 +- aiogram/types/message.py | 1785 ++++++++++++++------ aiogram/types/sticker.py | 58 +- aiogram/types/user.py | 37 +- 15 files changed, 2701 insertions(+), 754 deletions(-) create mode 100644 .butcher/types/CallbackQuery/aliases.yml create mode 100644 .butcher/types/ChatJoinRequest/aliases.yml create mode 100644 .butcher/types/InlineQuery/aliases.yml create mode 100644 .butcher/types/Sticker/aliases.yml create mode 100644 .butcher/types/User/aliases.yml create mode 100644 CHANGES/952.feature.rst diff --git a/.butcher/types/CallbackQuery/aliases.yml b/.butcher/types/CallbackQuery/aliases.yml new file mode 100644 index 00000000..d0eadfce --- /dev/null +++ b/.butcher/types/CallbackQuery/aliases.yml @@ -0,0 +1,4 @@ +answer: + method: answerCallbackQuery + fill: + callback_query_id: self.id diff --git a/.butcher/types/Chat/aliases.yml b/.butcher/types/Chat/aliases.yml index 3d3a2da4..4538f7e1 100644 --- a/.butcher/types/Chat/aliases.yml +++ b/.butcher/types/Chat/aliases.yml @@ -1,108 +1,108 @@ -#ban_sender_chat: -# method: banChatSenderChat -# fill: &self -# chat_id: self.id -# -#unban_sender_chat: -# method: unbanChatSenderChat -# fill: *self -# -#get_administrators: -# method: getChatAdministrators -# fill: *self -# -#delete_message: -# method: deleteMessage -# fill: *self -# -#revoke_invite_link: -# method: revokeChatInviteLink -# fill: *self -# -#edit_invite_link: -# method: editChatInviteLink -# fill: *self -# -#create_invite_link: -# method: createChatInviteLink -# fill: *self -# -#export_invite_link: -# method: exportChatInviteLink -# fill: *self -# -#do: -# method: sendChatAction -# fill: *self -# -#delete_sticker_set: -# method: deleteChatStickerSet -# fill: *self -# -#set_sticker_set: -# method: setChatStickerSet -# fill: *self -# -#get_member: -# method: getChatMember -# fill: *self -# -#get_member_count: -# method: getChatMemberCount -# fill: *self -# -#leave: -# method: leaveChat -# fill: *self -# -#unpin_all_messages: -# method: unpinAllChatMessages -# fill: *self -# -#unpin_message: -# method: unpinChatMessage -# fill: *self -# -#pin_message: -# method: pinChatMessage -# fill: *self -# -#set_administrator_custom_title: -# method: setChatAdministratorCustomTitle -# fill: *self -# -#set_permissions: -# method: setChatPermissions -# fill: *self -# -#promote: -# method: promoteChatMember -# fill: *self -# -#restrict: -# method: restrictChatMember -# fill: *self -# -#unban: -# method: unbanChatMember -# fill: *self -# -#ban: -# method: banChatMember -# fill: *self -# -#set_description: -# method: setChatDescription -# fill: *self -# -#set_title: -# method: setChatTitle -# fill: *self -# -#delete_photo: -# method: deleteChatPhoto -# fill: *self -# -#set_photo: -# method: setChatPhoto -# fill: *self +ban_sender_chat: + method: banChatSenderChat + fill: &self + chat_id: self.id + +unban_sender_chat: + method: unbanChatSenderChat + fill: *self + +get_administrators: + method: getChatAdministrators + fill: *self + +delete_message: + method: deleteMessage + fill: *self + +revoke_invite_link: + method: revokeChatInviteLink + fill: *self + +edit_invite_link: + method: editChatInviteLink + fill: *self + +create_invite_link: + method: createChatInviteLink + fill: *self + +export_invite_link: + method: exportChatInviteLink + fill: *self + +do: + method: sendChatAction + fill: *self + +delete_sticker_set: + method: deleteChatStickerSet + fill: *self + +set_sticker_set: + method: setChatStickerSet + fill: *self + +get_member: + method: getChatMember + fill: *self + +get_member_count: + method: getChatMemberCount + fill: *self + +leave: + method: leaveChat + fill: *self + +unpin_all_messages: + method: unpinAllChatMessages + fill: *self + +unpin_message: + method: unpinChatMessage + fill: *self + +pin_message: + method: pinChatMessage + fill: *self + +set_administrator_custom_title: + method: setChatAdministratorCustomTitle + fill: *self + +set_permissions: + method: setChatPermissions + fill: *self + +promote: + method: promoteChatMember + fill: *self + +restrict: + method: restrictChatMember + fill: *self + +unban: + method: unbanChatMember + fill: *self + +ban: + method: banChatMember + fill: *self + +set_description: + method: setChatDescription + fill: *self + +set_title: + method: setChatTitle + fill: *self + +delete_photo: + method: deleteChatPhoto + fill: *self + +set_photo: + method: setChatPhoto + fill: *self diff --git a/.butcher/types/ChatJoinRequest/aliases.yml b/.butcher/types/ChatJoinRequest/aliases.yml new file mode 100644 index 00000000..aa88cebd --- /dev/null +++ b/.butcher/types/ChatJoinRequest/aliases.yml @@ -0,0 +1,8 @@ +approve: + method: approveChatJoinRequest + fill: &request-target + chat_id: self.chat.id + user_id: self.from_user.id +decline: + method: declineChatJoinRequest + fill: *request-target diff --git a/.butcher/types/InlineQuery/aliases.yml b/.butcher/types/InlineQuery/aliases.yml new file mode 100644 index 00000000..5fd86013 --- /dev/null +++ b/.butcher/types/InlineQuery/aliases.yml @@ -0,0 +1,4 @@ +answer: + method: answerInlineQuery + fill: + inline_query_id: self.id diff --git a/.butcher/types/Message/aliases.yml b/.butcher/types/Message/aliases.yml index 7fab6d03..4d731875 100644 --- a/.butcher/types/Message/aliases.yml +++ b/.butcher/types/Message/aliases.yml @@ -1,139 +1,189 @@ -#answer: -# method: sendMessage -# fill: &fill-answer -# chat_id: self.chat.id -# message_thread_id: self.message_thread_id if self.is_topic_message else None -# -#reply: -# method: sendMessage -# fill: &fill-reply -# <<: *fill-answer -# reply_to_message_id: self.message_id -# -#answer_animation: -# method: sendAnimation -# fill: *fill-answer -# -#reply_animation: -# method: sendAnimation -# fill: *fill-reply -# -#answer_audio: -# method: sendAudio -# fill: *fill-answer -# -#reply_audio: -# method: sendAudio -# fill: *fill-reply -# -#answer_contact: -# method: sendContact -# fill: *fill-answer -# -#reply_contact: -# method: sendContact -# fill: *fill-reply -# -#answer_document: -# method: sendDocument -# fill: *fill-answer -# -#reply_document: -# method: sendDocument -# fill: *fill-reply -# -#answer_game: -# method: sendGame -# fill: *fill-answer -# -#reply_game: -# method: sendGame -# fill: *fill-reply -# -#answer_invoice: -# method: sendInvoice -# fill: *fill-answer -# -#reply_invoice: -# method: sendInvoice -# fill: *fill-reply -# -#answer_location: -# method: sendLocation -# fill: *fill-answer -# -#reply_location: -# method: sendLocation -# fill: *fill-reply -# -#answer_media_group: -# method: sendMediaGroup -# fill: *fill-answer -# -#reply_media_group: -# method: sendMediaGroup -# fill: *fill-reply -# -#answer_photo: -# method: sendPhoto -# fill: *fill-answer -# -#reply_photo: -# method: sendPhoto -# fill: *fill-reply -# -#answer_poll: -# method: sendPoll -# fill: *fill-answer -# -#reply_poll: -# method: sendPoll -# fill: *fill-reply -# -#answer_dice: -# method: sendDice -# fill: *fill-answer -# -#reply_dice: -# method: sendDice -# fill: *fill-reply -# -#answer_sticker: -# method: sendSticker -# fill: *fill-answer -# -#reply_sticker: -# method: sendSticker -# fill: *fill-reply -# -#answer_venue: -# method: sendVenue -# fill: *fill-answer -# -#reply_venue: -# method: sendVenue -# fill: *fill-reply -# -#answer_video: -# method: sendVideo -# fill: *fill-answer -# -#reply_video: -# method: sendVideo -# fill: *fill-reply -# -#answer_video_note: -# method: sendVideoNote -# fill: *fill-answer -# -#reply_video_note: -# method: sendVideoNote -# fill: *fill-reply -# -#answer_voice: -# method: sendVoice -# fill: *fill-answer -# -#reply_voice: -# method: sendVoice -# fill: *fill-reply +answer: + method: sendMessage + fill: &fill-answer + chat_id: self.chat.id + message_thread_id: self.message_thread_id if self.is_topic_message else None + +reply: + method: sendMessage + fill: &fill-reply + <<: *fill-answer + reply_to_message_id: self.message_id + +answer_animation: + method: sendAnimation + fill: *fill-answer + +reply_animation: + method: sendAnimation + fill: *fill-reply + +answer_audio: + method: sendAudio + fill: *fill-answer + +reply_audio: + method: sendAudio + fill: *fill-reply + +answer_contact: + method: sendContact + fill: *fill-answer + +reply_contact: + method: sendContact + fill: *fill-reply + +answer_document: + method: sendDocument + fill: *fill-answer + +reply_document: + method: sendDocument + fill: *fill-reply + +answer_game: + method: sendGame + fill: *fill-answer + +reply_game: + method: sendGame + fill: *fill-reply + +answer_invoice: + method: sendInvoice + fill: *fill-answer + +reply_invoice: + method: sendInvoice + fill: *fill-reply + +answer_location: + method: sendLocation + fill: *fill-answer + +reply_location: + method: sendLocation + fill: *fill-reply + +answer_media_group: + method: sendMediaGroup + fill: *fill-answer + +reply_media_group: + method: sendMediaGroup + fill: *fill-reply + +answer_photo: + method: sendPhoto + fill: *fill-answer + +reply_photo: + method: sendPhoto + fill: *fill-reply + +answer_poll: + method: sendPoll + fill: *fill-answer + +reply_poll: + method: sendPoll + fill: *fill-reply + +answer_dice: + method: sendDice + fill: *fill-answer + +reply_dice: + method: sendDice + fill: *fill-reply + +answer_sticker: + method: sendSticker + fill: *fill-answer + +reply_sticker: + method: sendSticker + fill: *fill-reply + +answer_venue: + method: sendVenue + fill: *fill-answer + +reply_venue: + method: sendVenue + fill: *fill-reply + +answer_video: + method: sendVideo + fill: *fill-answer + +reply_video: + method: sendVideo + fill: *fill-reply + +answer_video_note: + method: sendVideoNote + fill: *fill-answer + +reply_video_note: + method: sendVideoNote + fill: *fill-reply + +answer_voice: + method: sendVoice + fill: *fill-answer + +reply_voice: + method: sendVoice + fill: *fill-reply + +copy_to: + method: copyMessage + fill: + from_chat_id: self.chat.id + message_id: self.message_id + +edit_text: + method: editMessageText + fill: &message-target + chat_id: self.chat.id + message_id: self.message_id + +forward: + method: forwardMessage + fill: + from_chat_id: self.chat.id + message_id: self.message_id + +edit_media: + method: editMessageMedia + fill: *message-target + +edit_reply_markup: + method: editMessageReplyMarkup + fill: *message-target + +edit_live_location: + method: editMessageLiveLocation + fill: *message-target + +stop_live_location: + method: stopMessageLiveLocation + fill: *message-target + +edit_caption: + method: editMessageCaption + fill: *message-target + +delete: + method: deleteMessage + fill: *message-target + +pin: + method: pinChatMessage + fill: *message-target + +unpin: + method: unpinChatMessage + fill: *message-target diff --git a/.butcher/types/Sticker/aliases.yml b/.butcher/types/Sticker/aliases.yml new file mode 100644 index 00000000..c02126fe --- /dev/null +++ b/.butcher/types/Sticker/aliases.yml @@ -0,0 +1,8 @@ +set_position_in_set: + method: setStickerPositionInSet + fill: &set-target + sticker: self.file_id + +delete_from_set: + method: deleteStickerFromSet + fill: *set-target diff --git a/.butcher/types/User/aliases.yml b/.butcher/types/User/aliases.yml new file mode 100644 index 00000000..85d2188d --- /dev/null +++ b/.butcher/types/User/aliases.yml @@ -0,0 +1,4 @@ +get_profile_photos: + method: getUserProfilePhotos + fill: + user_id: self.id diff --git a/CHANGES/952.feature.rst b/CHANGES/952.feature.rst new file mode 100644 index 00000000..3a855ccc --- /dev/null +++ b/CHANGES/952.feature.rst @@ -0,0 +1 @@ +Add missing shortcuts, added new enums, reworked old stuff diff --git a/aiogram/types/callback_query.py b/aiogram/types/callback_query.py index 4f96c8a3..5812bb13 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, Optional +from typing import TYPE_CHECKING, Any, Optional from pydantic import Field @@ -42,17 +42,30 @@ class CallbackQuery(TelegramObject): show_alert: Optional[bool] = None, url: Optional[str] = None, cache_time: Optional[int] = None, + **kwargs: Any, ) -> AnswerCallbackQuery: """ - Answer to callback query + Shortcut for method :class:`aiogram.methods.answer_callback_query.AnswerCallbackQuery` + will automatically fill method attributes: - :param text: - :param show_alert: - :param url: - :param cache_time: - :return: + - :code:`callback_query_id` + + 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. + + Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via `@BotFather `_ and accept the terms. Otherwise, you may use links like :code:`t.me/your_bot?start=XXXX` that open your bot with a parameter. + + Source: https://core.telegram.org/bots/api#answercallbackquery + + :param text: Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters + :param show_alert: 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*. + :param url: 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. + :param cache_time: 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. + :return: instance of method :class:`aiogram.methods.answer_callback_query.AnswerCallbackQuery` """ - from ..methods import AnswerCallbackQuery + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import AnswerCallbackQuery return AnswerCallbackQuery( callback_query_id=self.id, @@ -60,4 +73,5 @@ class CallbackQuery(TelegramObject): show_alert=show_alert, url=url, cache_time=cache_time, + **kwargs, ) diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py index 7e276c25..a5b08173 100644 --- a/aiogram/types/chat.py +++ b/aiogram/types/chat.py @@ -1,14 +1,44 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List, Optional +import datetime +from typing import TYPE_CHECKING, Any, List, Optional, Union from .base import TelegramObject if TYPE_CHECKING: - from ..methods import BanChatSenderChat, UnbanChatSenderChat + from ..methods import ( + BanChatMember, + BanChatSenderChat, + CreateChatInviteLink, + DeleteChatPhoto, + DeleteChatStickerSet, + DeleteMessage, + EditChatInviteLink, + ExportChatInviteLink, + GetChatAdministrators, + GetChatMember, + GetChatMemberCount, + LeaveChat, + PinChatMessage, + PromoteChatMember, + RestrictChatMember, + RevokeChatInviteLink, + SendChatAction, + SetChatAdministratorCustomTitle, + SetChatDescription, + SetChatPermissions, + SetChatPhoto, + SetChatStickerSet, + SetChatTitle, + UnbanChatMember, + UnbanChatSenderChat, + UnpinAllChatMessages, + UnpinChatMessage, + ) from .chat_location import ChatLocation from .chat_permissions import ChatPermissions from .chat_photo import ChatPhoto + from .input_file import InputFile from .message import Message @@ -103,18 +133,866 @@ class Chat(TelegramObject): return f"{self.first_name}" - def ban_sender_chat(self, sender_chat_id: int) -> BanChatSenderChat: - from ..methods import BanChatSenderChat + def ban_sender_chat( + self, + sender_chat_id: int, + **kwargs: Any, + ) -> BanChatSenderChat: + """ + Shortcut for method :class:`aiogram.methods.ban_chat_sender_chat.BanChatSenderChat` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#banchatsenderchat + + :param sender_chat_id: Unique identifier of the target sender chat + :return: instance of method :class:`aiogram.methods.ban_chat_sender_chat.BanChatSenderChat` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import BanChatSenderChat return BanChatSenderChat( chat_id=self.id, sender_chat_id=sender_chat_id, + **kwargs, ) - def unban_sender_chat(self, sender_chat_id: int) -> UnbanChatSenderChat: - from ..methods import UnbanChatSenderChat + def unban_sender_chat( + self, + sender_chat_id: int, + **kwargs: Any, + ) -> UnbanChatSenderChat: + """ + Shortcut for method :class:`aiogram.methods.unban_chat_sender_chat.UnbanChatSenderChat` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#unbanchatsenderchat + + :param sender_chat_id: Unique identifier of the target sender chat + :return: instance of method :class:`aiogram.methods.unban_chat_sender_chat.UnbanChatSenderChat` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import UnbanChatSenderChat return UnbanChatSenderChat( chat_id=self.id, sender_chat_id=sender_chat_id, + **kwargs, + ) + + def get_administrators( + self, + **kwargs: Any, + ) -> GetChatAdministrators: + """ + Shortcut for method :class:`aiogram.methods.get_chat_administrators.GetChatAdministrators` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#getchatadministrators + + :return: instance of method :class:`aiogram.methods.get_chat_administrators.GetChatAdministrators` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import GetChatAdministrators + + return GetChatAdministrators( + chat_id=self.id, + **kwargs, + ) + + def delete_message( + self, + message_id: int, + **kwargs: Any, + ) -> DeleteMessage: + """ + Shortcut for method :class:`aiogram.methods.delete_message.DeleteMessage` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method to delete a message, including service messages, with the following limitations: + + - A message can only be deleted if it was sent less than 48 hours ago. + + - Service messages about a supergroup, channel, or forum topic creation can't be deleted. + + - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. + + - Bots can delete outgoing messages in private chats, groups, and supergroups. + + - Bots can delete incoming messages in private chats. + + - Bots granted *can_post_messages* permissions can delete outgoing messages in channels. + + - If the bot is an administrator of a group, it can delete any message there. + + - If the bot has *can_delete_messages* permission in a supergroup or a channel, it can delete any message there. + + Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#deletemessage + + :param message_id: Identifier of the message to delete + :return: instance of method :class:`aiogram.methods.delete_message.DeleteMessage` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import DeleteMessage + + return DeleteMessage( + chat_id=self.id, + message_id=message_id, + **kwargs, + ) + + def revoke_invite_link( + self, + invite_link: str, + **kwargs: Any, + ) -> RevokeChatInviteLink: + """ + Shortcut for method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#revokechatinvitelink + + :param invite_link: The invite link to revoke + :return: instance of method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import RevokeChatInviteLink + + return RevokeChatInviteLink( + chat_id=self.id, + invite_link=invite_link, + **kwargs, + ) + + def edit_invite_link( + self, + invite_link: str, + name: Optional[str] = None, + expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, + member_limit: Optional[int] = None, + creates_join_request: Optional[bool] = None, + **kwargs: Any, + ) -> EditChatInviteLink: + """ + Shortcut for method :class:`aiogram.methods.edit_chat_invite_link.EditChatInviteLink` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#editchatinvitelink + + :param invite_link: The invite link to edit + :param name: Invite link name; 0-32 characters + :param expire_date: Point in time (Unix timestamp) when the link will expire + :param member_limit: The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 + :param creates_join_request: :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 + :return: instance of method :class:`aiogram.methods.edit_chat_invite_link.EditChatInviteLink` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import EditChatInviteLink + + return EditChatInviteLink( + chat_id=self.id, + invite_link=invite_link, + name=name, + expire_date=expire_date, + member_limit=member_limit, + creates_join_request=creates_join_request, + **kwargs, + ) + + def create_invite_link( + self, + name: Optional[str] = None, + expire_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, + member_limit: Optional[int] = None, + creates_join_request: Optional[bool] = None, + **kwargs: Any, + ) -> CreateChatInviteLink: + """ + Shortcut for method :class:`aiogram.methods.create_chat_invite_link.CreateChatInviteLink` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#createchatinvitelink + + :param name: Invite link name; 0-32 characters + :param expire_date: Point in time (Unix timestamp) when the link will expire + :param member_limit: The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 + :param creates_join_request: :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 + :return: instance of method :class:`aiogram.methods.create_chat_invite_link.CreateChatInviteLink` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import CreateChatInviteLink + + return CreateChatInviteLink( + chat_id=self.id, + name=name, + expire_date=expire_date, + member_limit=member_limit, + creates_join_request=creates_join_request, + **kwargs, + ) + + def export_invite_link( + self, + **kwargs: Any, + ) -> ExportChatInviteLink: + """ + Shortcut for method :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` or by calling the :class:`aiogram.methods.get_chat.GetChat` method. If your bot needs to generate a new primary invite link replacing its previous one, use :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` again. + + Source: https://core.telegram.org/bots/api#exportchatinvitelink + + :return: instance of method :class:`aiogram.methods.export_chat_invite_link.ExportChatInviteLink` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import ExportChatInviteLink + + return ExportChatInviteLink( + chat_id=self.id, + **kwargs, + ) + + def do( + self, + action: str, + **kwargs: Any, + ) -> SendChatAction: + """ + Shortcut for method :class:`aiogram.methods.send_chat_action.SendChatAction` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Example: The `ImageBot `_ needs some time to process a request and upload the image. Instead of sending a text message along the lines of 'Retrieving image, please wait…', the bot may use :class:`aiogram.methods.send_chat_action.SendChatAction` with *action* = *upload_photo*. The user will see a 'sending photo' status for the bot. + + We only recommend using this method when a response from the bot will take a **noticeable** amount of time to arrive. + + Source: https://core.telegram.org/bots/api#sendchataction + + :param action: 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 `_. + :return: instance of method :class:`aiogram.methods.send_chat_action.SendChatAction` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendChatAction + + return SendChatAction( + chat_id=self.id, + action=action, + **kwargs, + ) + + def delete_sticker_set( + self, + **kwargs: Any, + ) -> DeleteChatStickerSet: + """ + Shortcut for method :class:`aiogram.methods.delete_chat_sticker_set.DeleteChatStickerSet` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#deletechatstickerset + + :return: instance of method :class:`aiogram.methods.delete_chat_sticker_set.DeleteChatStickerSet` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import DeleteChatStickerSet + + return DeleteChatStickerSet( + chat_id=self.id, + **kwargs, + ) + + def set_sticker_set( + self, + sticker_set_name: str, + **kwargs: Any, + ) -> SetChatStickerSet: + """ + Shortcut for method :class:`aiogram.methods.set_chat_sticker_set.SetChatStickerSet` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#setchatstickerset + + :param sticker_set_name: Name of the sticker set to be set as the group sticker set + :return: instance of method :class:`aiogram.methods.set_chat_sticker_set.SetChatStickerSet` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SetChatStickerSet + + return SetChatStickerSet( + chat_id=self.id, + sticker_set_name=sticker_set_name, + **kwargs, + ) + + def get_member( + self, + user_id: int, + **kwargs: Any, + ) -> GetChatMember: + """ + Shortcut for method :class:`aiogram.methods.get_chat_member.GetChatMember` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method to get information about a member of a chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success. + + Source: https://core.telegram.org/bots/api#getchatmember + + :param user_id: Unique identifier of the target user + :return: instance of method :class:`aiogram.methods.get_chat_member.GetChatMember` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import GetChatMember + + return GetChatMember( + chat_id=self.id, + user_id=user_id, + **kwargs, + ) + + def get_member_count( + self, + **kwargs: Any, + ) -> GetChatMemberCount: + """ + Shortcut for method :class:`aiogram.methods.get_chat_member_count.GetChatMemberCount` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method to get the number of members in a chat. Returns *Int* on success. + + Source: https://core.telegram.org/bots/api#getchatmembercount + + :return: instance of method :class:`aiogram.methods.get_chat_member_count.GetChatMemberCount` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import GetChatMemberCount + + return GetChatMemberCount( + chat_id=self.id, + **kwargs, + ) + + def leave( + self, + **kwargs: Any, + ) -> LeaveChat: + """ + Shortcut for method :class:`aiogram.methods.leave_chat.LeaveChat` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method for your bot to leave a group, supergroup or channel. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#leavechat + + :return: instance of method :class:`aiogram.methods.leave_chat.LeaveChat` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import LeaveChat + + return LeaveChat( + chat_id=self.id, + **kwargs, + ) + + def unpin_all_messages( + self, + **kwargs: Any, + ) -> UnpinAllChatMessages: + """ + Shortcut for method :class:`aiogram.methods.unpin_all_chat_messages.UnpinAllChatMessages` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#unpinallchatmessages + + :return: instance of method :class:`aiogram.methods.unpin_all_chat_messages.UnpinAllChatMessages` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import UnpinAllChatMessages + + return UnpinAllChatMessages( + chat_id=self.id, + **kwargs, + ) + + def unpin_message( + self, + message_id: Optional[int] = None, + **kwargs: Any, + ) -> UnpinChatMessage: + """ + Shortcut for method :class:`aiogram.methods.unpin_chat_message.UnpinChatMessage` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#unpinchatmessage + + :param message_id: Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned. + :return: instance of method :class:`aiogram.methods.unpin_chat_message.UnpinChatMessage` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import UnpinChatMessage + + return UnpinChatMessage( + chat_id=self.id, + message_id=message_id, + **kwargs, + ) + + def pin_message( + self, + message_id: int, + disable_notification: Optional[bool] = None, + **kwargs: Any, + ) -> PinChatMessage: + """ + Shortcut for method :class:`aiogram.methods.pin_chat_message.PinChatMessage` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#pinchatmessage + + :param message_id: Identifier of a message to pin + :param disable_notification: 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. + :return: instance of method :class:`aiogram.methods.pin_chat_message.PinChatMessage` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import PinChatMessage + + return PinChatMessage( + chat_id=self.id, + message_id=message_id, + disable_notification=disable_notification, + **kwargs, + ) + + def set_administrator_custom_title( + self, + user_id: int, + custom_title: str, + **kwargs: Any, + ) -> SetChatAdministratorCustomTitle: + """ + Shortcut for method :class:`aiogram.methods.set_chat_administrator_custom_title.SetChatAdministratorCustomTitle` + will automatically fill method attributes: + + - :code:`chat_id` + + Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle + + :param user_id: Unique identifier of the target user + :param custom_title: New custom title for the administrator; 0-16 characters, emoji are not allowed + :return: instance of method :class:`aiogram.methods.set_chat_administrator_custom_title.SetChatAdministratorCustomTitle` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SetChatAdministratorCustomTitle + + return SetChatAdministratorCustomTitle( + chat_id=self.id, + user_id=user_id, + custom_title=custom_title, + **kwargs, + ) + + def set_permissions( + self, + permissions: ChatPermissions, + **kwargs: Any, + ) -> SetChatPermissions: + """ + Shortcut for method :class:`aiogram.methods.set_chat_permissions.SetChatPermissions` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#setchatpermissions + + :param permissions: A JSON-serialized object for new default chat permissions + :return: instance of method :class:`aiogram.methods.set_chat_permissions.SetChatPermissions` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SetChatPermissions + + return SetChatPermissions( + chat_id=self.id, + permissions=permissions, + **kwargs, + ) + + def promote( + self, + user_id: int, + is_anonymous: Optional[bool] = None, + can_manage_chat: Optional[bool] = None, + can_post_messages: Optional[bool] = None, + can_edit_messages: 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_pin_messages: Optional[bool] = None, + can_manage_topics: Optional[bool] = None, + **kwargs: Any, + ) -> PromoteChatMember: + """ + Shortcut for method :class:`aiogram.methods.promote_chat_member.PromoteChatMember` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#promotechatmember + + :param user_id: Unique identifier of the target user + :param is_anonymous: Pass :code:`True` if the administrator's presence in the chat is hidden + :param can_manage_chat: Pass :code:`True` if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege + :param can_post_messages: Pass :code:`True` if the administrator can create channel posts, channels only + :param can_edit_messages: Pass :code:`True` if the administrator can edit messages of other users and can pin messages, channels only + :param can_delete_messages: Pass :code:`True` if the administrator can delete messages of other users + :param can_manage_video_chats: Pass :code:`True` if the administrator can manage video chats + :param can_restrict_members: Pass :code:`True` if the administrator can restrict, ban or unban chat members + :param can_promote_members: Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) + :param can_change_info: Pass :code:`True` if the administrator can change chat title, photo and other settings + :param can_invite_users: Pass :code:`True` if the administrator can invite new users to the chat + :param can_pin_messages: Pass :code:`True` if the administrator can pin messages, supergroups only + :param can_manage_topics: Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics, supergroups only + :return: instance of method :class:`aiogram.methods.promote_chat_member.PromoteChatMember` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import PromoteChatMember + + return PromoteChatMember( + chat_id=self.id, + user_id=user_id, + is_anonymous=is_anonymous, + can_manage_chat=can_manage_chat, + can_post_messages=can_post_messages, + can_edit_messages=can_edit_messages, + can_delete_messages=can_delete_messages, + can_manage_video_chats=can_manage_video_chats, + can_restrict_members=can_restrict_members, + can_promote_members=can_promote_members, + can_change_info=can_change_info, + can_invite_users=can_invite_users, + can_pin_messages=can_pin_messages, + can_manage_topics=can_manage_topics, + **kwargs, + ) + + def restrict( + self, + user_id: int, + permissions: ChatPermissions, + until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, + **kwargs: Any, + ) -> RestrictChatMember: + """ + Shortcut for method :class:`aiogram.methods.restrict_chat_member.RestrictChatMember` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#restrictchatmember + + :param user_id: Unique identifier of the target user + :param permissions: A JSON-serialized object for new user permissions + :param until_date: 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 + :return: instance of method :class:`aiogram.methods.restrict_chat_member.RestrictChatMember` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import RestrictChatMember + + return RestrictChatMember( + chat_id=self.id, + user_id=user_id, + permissions=permissions, + until_date=until_date, + **kwargs, + ) + + def unban( + self, + user_id: int, + only_if_banned: Optional[bool] = None, + **kwargs: Any, + ) -> UnbanChatMember: + """ + Shortcut for method :class:`aiogram.methods.unban_chat_member.UnbanChatMember` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#unbanchatmember + + :param user_id: Unique identifier of the target user + :param only_if_banned: Do nothing if the user is not banned + :return: instance of method :class:`aiogram.methods.unban_chat_member.UnbanChatMember` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import UnbanChatMember + + return UnbanChatMember( + chat_id=self.id, + user_id=user_id, + only_if_banned=only_if_banned, + **kwargs, + ) + + def ban( + self, + user_id: int, + until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, + revoke_messages: Optional[bool] = None, + **kwargs: Any, + ) -> BanChatMember: + """ + Shortcut for method :class:`aiogram.methods.ban_chat_member.BanChatMember` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#banchatmember + + :param user_id: Unique identifier of the target user + :param until_date: 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. + :param revoke_messages: 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. + :return: instance of method :class:`aiogram.methods.ban_chat_member.BanChatMember` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import BanChatMember + + return BanChatMember( + chat_id=self.id, + user_id=user_id, + until_date=until_date, + revoke_messages=revoke_messages, + **kwargs, + ) + + def set_description( + self, + description: Optional[str] = None, + **kwargs: Any, + ) -> SetChatDescription: + """ + Shortcut for method :class:`aiogram.methods.set_chat_description.SetChatDescription` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#setchatdescription + + :param description: New chat description, 0-255 characters + :return: instance of method :class:`aiogram.methods.set_chat_description.SetChatDescription` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SetChatDescription + + return SetChatDescription( + chat_id=self.id, + description=description, + **kwargs, + ) + + def set_title( + self, + title: str, + **kwargs: Any, + ) -> SetChatTitle: + """ + Shortcut for method :class:`aiogram.methods.set_chat_title.SetChatTitle` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#setchattitle + + :param title: New chat title, 1-128 characters + :return: instance of method :class:`aiogram.methods.set_chat_title.SetChatTitle` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SetChatTitle + + return SetChatTitle( + chat_id=self.id, + title=title, + **kwargs, + ) + + def delete_photo( + self, + **kwargs: Any, + ) -> DeleteChatPhoto: + """ + Shortcut for method :class:`aiogram.methods.delete_chat_photo.DeleteChatPhoto` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#deletechatphoto + + :return: instance of method :class:`aiogram.methods.delete_chat_photo.DeleteChatPhoto` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import DeleteChatPhoto + + return DeleteChatPhoto( + chat_id=self.id, + **kwargs, + ) + + def set_photo( + self, + photo: InputFile, + **kwargs: Any, + ) -> SetChatPhoto: + """ + Shortcut for method :class:`aiogram.methods.set_chat_photo.SetChatPhoto` + will automatically fill method attributes: + + - :code:`chat_id` + + 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. + + Source: https://core.telegram.org/bots/api#setchatphoto + + :param photo: New chat photo, uploaded using multipart/form-data + :return: instance of method :class:`aiogram.methods.set_chat_photo.SetChatPhoto` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SetChatPhoto + + return SetChatPhoto( + chat_id=self.id, + photo=photo, + **kwargs, ) diff --git a/aiogram/types/chat_join_request.py b/aiogram/types/chat_join_request.py index b9c862ee..a8a9f5a8 100644 --- a/aiogram/types/chat_join_request.py +++ b/aiogram/types/chat_join_request.py @@ -1,7 +1,7 @@ from __future__ import annotations import datetime -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Any, Optional from pydantic import Field @@ -34,24 +34,58 @@ class ChatJoinRequest(TelegramObject): invite_link: Optional[ChatInviteLink] = None """*Optional*. Chat invite link that was used by the user to send the join request""" - def approve(self) -> ApproveChatJoinRequest: + def approve( + self, + **kwargs: Any, + ) -> ApproveChatJoinRequest: """ - Use this method to approve a chat join request. + Shortcut for method :class:`aiogram.methods.approve_chat_join_request.ApproveChatJoinRequest` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`user_id` + + 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. + + Source: https://core.telegram.org/bots/api#approvechatjoinrequest + + :return: instance of method :class:`aiogram.methods.approve_chat_join_request.ApproveChatJoinRequest` """ - from ..methods import ApproveChatJoinRequest + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import ApproveChatJoinRequest return ApproveChatJoinRequest( chat_id=self.chat.id, user_id=self.from_user.id, + **kwargs, ) - def decline(self) -> DeclineChatJoinRequest: + def decline( + self, + **kwargs: Any, + ) -> DeclineChatJoinRequest: """ - Use this method to decline a chat join request. + Shortcut for method :class:`aiogram.methods.decline_chat_join_request.DeclineChatJoinRequest` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`user_id` + + 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. + + Source: https://core.telegram.org/bots/api#declinechatjoinrequest + + :return: instance of method :class:`aiogram.methods.decline_chat_join_request.DeclineChatJoinRequest` """ - from ..methods import DeclineChatJoinRequest + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import DeclineChatJoinRequest return DeclineChatJoinRequest( chat_id=self.chat.id, user_id=self.from_user.id, + **kwargs, ) diff --git a/aiogram/types/inline_query.py b/aiogram/types/inline_query.py index d5c674ae..1feb6f7f 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, List, Optional +from typing import TYPE_CHECKING, Any, List, Optional from pydantic import Field @@ -41,17 +41,32 @@ class InlineQuery(TelegramObject): next_offset: Optional[str] = None, switch_pm_text: Optional[str] = None, switch_pm_parameter: Optional[str] = None, + **kwargs: Any, ) -> AnswerInlineQuery: """ - :param results: - :param cache_time: - :param is_personal: - :param next_offset: - :param switch_pm_text: - :param switch_pm_parameter: - :return: + Shortcut for method :class:`aiogram.methods.answer_inline_query.AnswerInlineQuery` + will automatically fill method attributes: + + - :code:`inline_query_id` + + Use this method to send answers to an inline query. On success, :code:`True` is returned. + + No more than **50** results per query are allowed. + + Source: https://core.telegram.org/bots/api#answerinlinequery + + :param results: A JSON-serialized array of results for the inline query + :param cache_time: The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. + :param is_personal: 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 + :param next_offset: 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. + :param switch_pm_text: 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* + :param switch_pm_parameter: `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. + :return: instance of method :class:`aiogram.methods.answer_inline_query.AnswerInlineQuery` """ - from ..methods import AnswerInlineQuery + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import AnswerInlineQuery return AnswerInlineQuery( inline_query_id=self.id, @@ -61,4 +76,5 @@ class InlineQuery(TelegramObject): next_offset=next_offset, switch_pm_text=switch_pm_text, switch_pm_parameter=switch_pm_parameter, + **kwargs, ) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index b25dd279..34a96a63 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -5,9 +5,9 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union from pydantic import Field -from aiogram.utils import helper from aiogram.utils.text_decorations import TextDecoration, html_decoration, markdown_decoration +from ..enums import ContentType from .base import UNSET, TelegramObject if TYPE_CHECKING: @@ -327,7 +327,9 @@ class Message(TelegramObject): thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -335,24 +337,40 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendAnimation: """ - Reply with animation + Shortcut for method :class:`aiogram.methods.send_animation.SendAnimation` + will automatically fill method attributes: - :param animation: - :param duration: - :param width: - :param height: - :param thumb: - :param caption: - :param parse_mode: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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. + + Source: https://core.telegram.org/bots/api#sendanimation + + :param animation: 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 » ` + :param duration: Duration of sent animation in seconds + :param width: Animation width + :param height: Animation height + :param thumb: 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 » ` + :param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the animation caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_animation.SendAnimation` """ - from ..methods import SendAnimation + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendAnimation return SendAnimation( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, animation=animation, duration=duration, width=width, @@ -360,11 +378,11 @@ class Message(TelegramObject): thumb=thumb, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -377,30 +395,50 @@ class Message(TelegramObject): thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendAnimation: """ - Answer with animation + Shortcut for method :class:`aiogram.methods.send_animation.SendAnimation` + will automatically fill method attributes: - :param animation: - :param duration: - :param width: - :param height: - :param thumb: - :param caption: - :param parse_mode: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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. + + Source: https://core.telegram.org/bots/api#sendanimation + + :param animation: 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 » ` + :param duration: Duration of sent animation in seconds + :param width: Animation width + :param height: Animation height + :param thumb: 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 » ` + :param caption: Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the animation caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_animation.SendAnimation` """ - from ..methods import SendAnimation + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendAnimation return SendAnimation( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, animation=animation, duration=duration, width=width, @@ -408,10 +446,12 @@ class Message(TelegramObject): thumb=thumb, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -420,11 +460,13 @@ class Message(TelegramObject): audio: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, duration: Optional[int] = None, performer: Optional[str] = None, title: Optional[str] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -432,36 +474,53 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendAudio: """ - Reply with audio + Shortcut for method :class:`aiogram.methods.send_audio.SendAudio` + will automatically fill method attributes: - :param audio: - :param caption: - :param parse_mode: - :param duration: - :param performer: - :param title: - :param thumb: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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. + For sending voice messages, use the :class:`aiogram.methods.send_voice.SendVoice` method instead. + + Source: https://core.telegram.org/bots/api#sendaudio + + :param audio: 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 » ` + :param caption: Audio caption, 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the audio caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param duration: Duration of the audio in seconds + :param performer: Performer + :param title: Track name + :param thumb: 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 » ` + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_audio.SendAudio` """ - from ..methods import SendAudio + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendAudio return SendAudio( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, audio=audio, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, duration=duration, performer=performer, title=title, thumb=thumb, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -470,45 +529,68 @@ class Message(TelegramObject): audio: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, duration: Optional[int] = None, performer: Optional[str] = None, title: Optional[str] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendAudio: """ - Answer with audio + Shortcut for method :class:`aiogram.methods.send_audio.SendAudio` + will automatically fill method attributes: - :param audio: - :param caption: - :param parse_mode: - :param duration: - :param performer: - :param title: - :param thumb: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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. + For sending voice messages, use the :class:`aiogram.methods.send_voice.SendVoice` method instead. + + Source: https://core.telegram.org/bots/api#sendaudio + + :param audio: 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 » ` + :param caption: Audio caption, 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the audio caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param duration: Duration of the audio in seconds + :param performer: Performer + :param title: Track name + :param thumb: 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 » ` + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_audio.SendAudio` """ - from ..methods import SendAudio + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendAudio return SendAudio( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, audio=audio, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, duration=duration, performer=performer, title=title, thumb=thumb, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -519,6 +601,7 @@ class Message(TelegramObject): last_name: Optional[str] = None, vcard: Optional[str] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -526,30 +609,44 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendContact: """ - Reply with contact + Shortcut for method :class:`aiogram.methods.send_contact.SendContact` + will automatically fill method attributes: - :param phone_number: - :param first_name: - :param last_name: - :param vcard: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendcontact + + :param phone_number: Contact's phone number + :param first_name: Contact's first name + :param last_name: Contact's last name + :param vcard: Additional data about the contact in the form of a `vCard `_, 0-2048 bytes + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_contact.SendContact` """ - from ..methods import SendContact + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendContact return SendContact( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, phone_number=phone_number, first_name=first_name, last_name=last_name, vcard=vcard, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -560,34 +657,53 @@ class Message(TelegramObject): last_name: Optional[str] = None, vcard: Optional[str] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendContact: """ - Answer with contact + Shortcut for method :class:`aiogram.methods.send_contact.SendContact` + will automatically fill method attributes: - :param phone_number: - :param first_name: - :param last_name: - :param vcard: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send phone contacts. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendcontact + + :param phone_number: Contact's phone number + :param first_name: Contact's first name + :param last_name: Contact's last name + :param vcard: Additional data about the contact in the form of a `vCard `_, 0-2048 bytes + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_contact.SendContact` """ - from ..methods import SendContact + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendContact return SendContact( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, phone_number=phone_number, first_name=first_name, last_name=last_name, vcard=vcard, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -597,7 +713,10 @@ class Message(TelegramObject): thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, + disable_content_type_detection: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -605,30 +724,48 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendDocument: """ - Reply with document + Shortcut for method :class:`aiogram.methods.send_document.SendDocument` + will automatically fill method attributes: - :param document: - :param thumb: - :param caption: - :param parse_mode: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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. + + Source: https://core.telegram.org/bots/api#senddocument + + :param document: 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 » ` + :param thumb: 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 » ` + :param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the document caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded using multipart/form-data + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_document.SendDocument` """ - from ..methods import SendDocument + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendDocument return SendDocument( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, document=document, thumb=thumb, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, + disable_content_type_detection=disable_content_type_detection, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -638,35 +775,60 @@ class Message(TelegramObject): thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, + disable_content_type_detection: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendDocument: """ - Answer with document + Shortcut for method :class:`aiogram.methods.send_document.SendDocument` + will automatically fill method attributes: - :param document: - :param thumb: - :param caption: - :param parse_mode: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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. + + Source: https://core.telegram.org/bots/api#senddocument + + :param document: 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 » ` + :param thumb: 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 » ` + :param caption: Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the document caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded using multipart/form-data + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_document.SendDocument` """ - from ..methods import SendDocument + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendDocument return SendDocument( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, document=document, thumb=thumb, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, + disable_content_type_detection=disable_content_type_detection, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -674,29 +836,44 @@ class Message(TelegramObject): self, game_short_name: str, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> SendGame: """ - Reply with game + Shortcut for method :class:`aiogram.methods.send_game.SendGame` + will automatically fill method attributes: - :param game_short_name: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendgame + + :param game_short_name: Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather `_. + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: 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. + :return: instance of method :class:`aiogram.methods.send_game.SendGame` """ - from ..methods import SendGame + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendGame return SendGame( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, game_short_name=game_short_name, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -704,26 +881,45 @@ class Message(TelegramObject): self, game_short_name: str, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> SendGame: """ - Answer with game + Shortcut for method :class:`aiogram.methods.send_game.SendGame` + will automatically fill method attributes: - :param game_short_name: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send a game. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendgame + + :param game_short_name: Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather `_. + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: 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. + :return: instance of method :class:`aiogram.methods.send_game.SendGame` """ - from ..methods import SendGame + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendGame return SendGame( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, game_short_name=game_short_name, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -757,7 +953,16 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendInvoice: """ - Reply with invoice + Shortcut for method :class:`aiogram.methods.send_invoice.SendInvoice` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendinvoice :param title: Product name, 1-32 characters :param description: Product description, 1-255 characters @@ -783,13 +988,18 @@ class Message(TelegramObject): :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. :param protect_content: Protects the contents of the sent message from forwarding and saving :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found - :param reply_markup: 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. - :return: On success, the sent Message is returned. + :param reply_markup: 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. + :return: instance of method :class:`aiogram.methods.send_invoice.SendInvoice` """ - from ..methods import SendInvoice + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendInvoice return SendInvoice( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, title=title, description=description, payload=payload, @@ -813,10 +1023,8 @@ class Message(TelegramObject): is_flexible=is_flexible, disable_notification=disable_notification, protect_content=protect_content, - reply_to_message_id=self.message_id, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -845,11 +1053,21 @@ class Message(TelegramObject): is_flexible: Optional[bool] = None, disable_notification: Optional[bool] = None, protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> SendInvoice: """ - Answer with invoice + Shortcut for method :class:`aiogram.methods.send_invoice.SendInvoice` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send invoices. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendinvoice :param title: Product name, 1-32 characters :param description: Product description, 1-255 characters @@ -874,13 +1092,19 @@ class Message(TelegramObject): :param is_flexible: Pass :code:`True` if the final price depends on the shipping method :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. :param protect_content: Protects the contents of the sent message from forwarding and saving - :param reply_markup: 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. - :return: On success, the sent Message is returned. + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: 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. + :return: instance of method :class:`aiogram.methods.send_invoice.SendInvoice` """ - from ..methods import SendInvoice + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendInvoice return SendInvoice( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, title=title, description=description, payload=payload, @@ -904,9 +1128,9 @@ class Message(TelegramObject): is_flexible=is_flexible, disable_notification=disable_notification, protect_content=protect_content, - reply_to_message_id=None, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -914,8 +1138,12 @@ class Message(TelegramObject): self, latitude: float, longitude: float, + 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[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -923,28 +1151,48 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendLocation: """ - Reply with location + Shortcut for method :class:`aiogram.methods.send_location.SendLocation` + will automatically fill method attributes: - :param latitude: - :param longitude: - :param live_period: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send point on the map. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendlocation + + :param latitude: Latitude of the location + :param longitude: Longitude of the location + :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500 + :param live_period: Period in seconds for which the location will be updated (see `Live Locations `_, should be between 60 and 86400. + :param heading: For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. + :param proximity_alert_radius: For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_location.SendLocation` """ - from ..methods import SendLocation + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendLocation return SendLocation( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, latitude=latitude, longitude=longitude, + horizontal_accuracy=horizontal_accuracy, live_period=live_period, + heading=heading, + proximity_alert_radius=proximity_alert_radius, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -952,34 +1200,62 @@ class Message(TelegramObject): self, latitude: float, longitude: float, + 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[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendLocation: """ - Answer with location + Shortcut for method :class:`aiogram.methods.send_location.SendLocation` + will automatically fill method attributes: - :param latitude: - :param longitude: - :param live_period: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send point on the map. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendlocation + + :param latitude: Latitude of the location + :param longitude: Longitude of the location + :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500 + :param live_period: Period in seconds for which the location will be updated (see `Live Locations `_, should be between 60 and 86400. + :param heading: For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. + :param proximity_alert_radius: For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_location.SendLocation` """ - from ..methods import SendLocation + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendLocation return SendLocation( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, latitude=latitude, longitude=longitude, + horizontal_accuracy=horizontal_accuracy, live_period=live_period, + heading=heading, + proximity_alert_radius=proximity_alert_radius, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -987,26 +1263,41 @@ class Message(TelegramObject): self, media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]], disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, **kwargs: Any, ) -> SendMediaGroup: """ - Reply with media group + Shortcut for method :class:`aiogram.methods.send_media_group.SendMediaGroup` + will automatically fill method attributes: - :param media: - :param disable_notification: - :param allow_sending_without_reply: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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 `Messages `_ that were sent is returned. + + Source: https://core.telegram.org/bots/api#sendmediagroup + + :param media: A JSON-serialized array describing messages to be sent, must include 2-10 items + :param disable_notification: Sends messages `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent messages from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :return: instance of method :class:`aiogram.methods.send_media_group.SendMediaGroup` """ - from ..methods import SendMediaGroup + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendMediaGroup return SendMediaGroup( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, media=media, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1014,23 +1305,42 @@ class Message(TelegramObject): self, media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]], disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, **kwargs: Any, ) -> SendMediaGroup: """ - Answer with media group + Shortcut for method :class:`aiogram.methods.send_media_group.SendMediaGroup` + will automatically fill method attributes: - :param media: - :param disable_notification: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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 `Messages `_ that were sent is returned. + + Source: https://core.telegram.org/bots/api#sendmediagroup + + :param media: A JSON-serialized array describing messages to be sent, must include 2-10 items + :param disable_notification: Sends messages `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent messages from forwarding and saving + :param reply_to_message_id: If the messages are a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :return: instance of method :class:`aiogram.methods.send_media_group.SendMediaGroup` """ - from ..methods import SendMediaGroup + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendMediaGroup return SendMediaGroup( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, media=media, disable_notification=disable_notification, - reply_to_message_id=None, - message_thread_id=self.message_thread_id if self.is_topic_message else None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, **kwargs, ) @@ -1038,8 +1348,10 @@ class Message(TelegramObject): self, text: str, parse_mode: Optional[str] = UNSET, + entities: Optional[List[MessageEntity]] = None, disable_web_page_preview: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1047,28 +1359,44 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendMessage: """ - Reply with text message + Shortcut for method :class:`aiogram.methods.send_message.SendMessage` + will automatically fill method attributes: - :param text: - :param parse_mode: - :param disable_web_page_preview: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send text messages. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendmessage + + :param text: Text of the message to be sent, 1-4096 characters after entities parsing + :param parse_mode: Mode for parsing entities in the message text. See `formatting options `_ for more details. + :param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode* + :param disable_web_page_preview: Disables link previews for links in this message + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_message.SendMessage` """ - from ..methods import SendMessage + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendMessage return SendMessage( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, text=text, parse_mode=parse_mode, + entities=entities, disable_web_page_preview=disable_web_page_preview, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1076,34 +1404,56 @@ class Message(TelegramObject): self, text: str, parse_mode: Optional[str] = UNSET, + entities: Optional[List[MessageEntity]] = None, disable_web_page_preview: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendMessage: """ - Answer with text message + Shortcut for method :class:`aiogram.methods.send_message.SendMessage` + will automatically fill method attributes: - :param text: - :param parse_mode: - :param disable_web_page_preview: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send text messages. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendmessage + + :param text: Text of the message to be sent, 1-4096 characters after entities parsing + :param parse_mode: Mode for parsing entities in the message text. See `formatting options `_ for more details. + :param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode* + :param disable_web_page_preview: Disables link previews for links in this message + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_message.SendMessage` """ - from ..methods import SendMessage + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendMessage return SendMessage( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, text=text, parse_mode=parse_mode, + entities=entities, disable_web_page_preview=disable_web_page_preview, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1112,7 +1462,9 @@ class Message(TelegramObject): photo: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1120,28 +1472,44 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendPhoto: """ - Reply with photo + Shortcut for method :class:`aiogram.methods.send_photo.SendPhoto` + will automatically fill method attributes: - :param photo: - :param caption: - :param parse_mode: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send photos. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendphoto + + :param photo: 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 » ` + :param caption: Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the photo caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_photo.SendPhoto` """ - from ..methods import SendPhoto + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendPhoto return SendPhoto( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, photo=photo, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1150,33 +1518,55 @@ class Message(TelegramObject): photo: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendPhoto: """ - Answer with photo + Shortcut for method :class:`aiogram.methods.send_photo.SendPhoto` + will automatically fill method attributes: - :param photo: - :param caption: - :param parse_mode: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send photos. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendphoto + + :param photo: 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 » ` + :param caption: Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the photo caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_photo.SendPhoto` """ - from ..methods import SendPhoto + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendPhoto return SendPhoto( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, photo=photo, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1190,10 +1580,12 @@ class Message(TelegramObject): correct_option_id: Optional[int] = None, explanation: Optional[str] = None, explanation_parse_mode: Optional[str] = UNSET, + explanation_entities: Optional[List[MessageEntity]] = None, open_period: Optional[int] = None, close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, is_closed: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1201,28 +1593,44 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendPoll: """ - Reply with poll + Shortcut for method :class:`aiogram.methods.send_poll.SendPoll` + will automatically fill method attributes: - :param question: - :param options: - :param is_anonymous: - :param type: - :param allows_multiple_answers: - :param correct_option_id: - :param explanation: - :param explanation_parse_mode: - :param open_period: - :param close_date: - :param is_closed: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send a native poll. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendpoll + + :param question: Poll question, 1-300 characters + :param options: A JSON-serialized list of answer options, 2-10 strings 1-100 characters each + :param is_anonymous: :code:`True`, if the poll needs to be anonymous, defaults to :code:`True` + :param type: Poll type, 'quiz' or 'regular', defaults to 'regular' + :param allows_multiple_answers: :code:`True`, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False` + :param correct_option_id: 0-based identifier of the correct answer option, required for polls in quiz mode + :param explanation: 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 + :param explanation_parse_mode: Mode for parsing entities in the explanation. See `formatting options `_ for more details. + :param explanation_entities: A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead of *parse_mode* + :param open_period: Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with *close_date*. + :param close_date: 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*. + :param is_closed: Pass :code:`True` if the poll needs to be immediately closed. This can be useful for poll preview. + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_poll.SendPoll` """ - from ..methods import SendPoll + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendPoll return SendPoll( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, question=question, options=options, is_anonymous=is_anonymous, @@ -1231,14 +1639,14 @@ class Message(TelegramObject): correct_option_id=correct_option_id, explanation=explanation, explanation_parse_mode=explanation_parse_mode, + explanation_entities=explanation_entities, open_period=open_period, close_date=close_date, is_closed=is_closed, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1252,37 +1660,57 @@ class Message(TelegramObject): correct_option_id: Optional[int] = None, explanation: Optional[str] = None, explanation_parse_mode: Optional[str] = UNSET, + explanation_entities: Optional[List[MessageEntity]] = None, open_period: Optional[int] = None, close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, is_closed: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendPoll: """ - Answer with poll + Shortcut for method :class:`aiogram.methods.send_poll.SendPoll` + will automatically fill method attributes: - :param question: - :param options: - :param is_anonymous: - :param type: - :param allows_multiple_answers: - :param correct_option_id: - :param explanation: - :param explanation_parse_mode: - :param open_period: - :param close_date: - :param is_closed: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send a native poll. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendpoll + + :param question: Poll question, 1-300 characters + :param options: A JSON-serialized list of answer options, 2-10 strings 1-100 characters each + :param is_anonymous: :code:`True`, if the poll needs to be anonymous, defaults to :code:`True` + :param type: Poll type, 'quiz' or 'regular', defaults to 'regular' + :param allows_multiple_answers: :code:`True`, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False` + :param correct_option_id: 0-based identifier of the correct answer option, required for polls in quiz mode + :param explanation: 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 + :param explanation_parse_mode: Mode for parsing entities in the explanation. See `formatting options `_ for more details. + :param explanation_entities: A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead of *parse_mode* + :param open_period: Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with *close_date*. + :param close_date: 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*. + :param is_closed: Pass :code:`True` if the poll needs to be immediately closed. This can be useful for poll preview. + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_poll.SendPoll` """ - from ..methods import SendPoll + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendPoll return SendPoll( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, question=question, options=options, is_anonymous=is_anonymous, @@ -1291,13 +1719,15 @@ class Message(TelegramObject): correct_option_id=correct_option_id, explanation=explanation, explanation_parse_mode=explanation_parse_mode, + explanation_entities=explanation_entities, open_period=open_period, close_date=close_date, is_closed=is_closed, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1305,6 +1735,7 @@ class Message(TelegramObject): self, emoji: Optional[str] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1312,24 +1743,38 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendDice: """ - Reply with dice + Shortcut for method :class:`aiogram.methods.send_dice.SendDice` + will automatically fill method attributes: - :param emoji: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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. + + Source: https://core.telegram.org/bots/api#senddice + + :param emoji: 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 '🎲' + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_dice.SendDice` """ - from ..methods import SendDice + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendDice return SendDice( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, emoji=emoji, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1337,28 +1782,47 @@ class Message(TelegramObject): self, emoji: Optional[str] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendDice: """ - Answer with dice + Shortcut for method :class:`aiogram.methods.send_dice.SendDice` + will automatically fill method attributes: - :param emoji: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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. + + Source: https://core.telegram.org/bots/api#senddice + + :param emoji: 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 '🎲' + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_dice.SendDice` """ - from ..methods import SendDice + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendDice return SendDice( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, emoji=emoji, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1366,6 +1830,7 @@ class Message(TelegramObject): self, sticker: Union[InputFile, str], disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1373,24 +1838,38 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendSticker: """ - Reply with sticker + Shortcut for method :class:`aiogram.methods.send_sticker.SendSticker` + will automatically fill method attributes: - :param sticker: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send static .WEBP, `animated `_ .TGS, or `video `_ .WEBM stickers. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendsticker + + :param sticker: 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 file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » ` + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_sticker.SendSticker` """ - from ..methods import SendSticker + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendSticker return SendSticker( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, sticker=sticker, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1398,28 +1877,47 @@ class Message(TelegramObject): self, sticker: Union[InputFile, str], disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendSticker: """ - Answer with sticker + Shortcut for method :class:`aiogram.methods.send_sticker.SendSticker` + will automatically fill method attributes: - :param sticker: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send static .WEBP, `animated `_ .TGS, or `video `_ .WEBM stickers. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendsticker + + :param sticker: 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 file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » ` + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_sticker.SendSticker` """ - from ..methods import SendSticker + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendSticker return SendSticker( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, sticker=sticker, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1431,7 +1929,10 @@ class Message(TelegramObject): address: str, 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[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1439,34 +1940,52 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendVenue: """ - Reply with venue + Shortcut for method :class:`aiogram.methods.send_venue.SendVenue` + will automatically fill method attributes: - :param latitude: - :param longitude: - :param title: - :param address: - :param foursquare_id: - :param foursquare_type: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + Use this method to send information about a venue. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendvenue + + :param latitude: Latitude of the venue + :param longitude: Longitude of the venue + :param title: Name of the venue + :param address: Address of the venue + :param foursquare_id: Foursquare identifier of the venue + :param foursquare_type: Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.) + :param google_place_id: Google Places identifier of the venue + :param google_place_type: Google Places type of the venue. (See `supported types `_.) + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_venue.SendVenue` """ - from ..methods import SendVenue + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVenue return SendVenue( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, latitude=latitude, longitude=longitude, title=title, address=address, foursquare_id=foursquare_id, foursquare_type=foursquare_type, + google_place_id=google_place_id, + google_place_type=google_place_type, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1478,39 +1997,64 @@ class Message(TelegramObject): address: str, 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[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendVenue: """ - Answer with venue + Shortcut for method :class:`aiogram.methods.send_venue.SendVenue` + will automatically fill method attributes: - :param latitude: - :param longitude: - :param title: - :param address: - :param foursquare_id: - :param foursquare_type: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + Use this method to send information about a venue. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#sendvenue + + :param latitude: Latitude of the venue + :param longitude: Longitude of the venue + :param title: Name of the venue + :param address: Address of the venue + :param foursquare_id: Foursquare identifier of the venue + :param foursquare_type: Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.) + :param google_place_id: Google Places identifier of the venue + :param google_place_type: Google Places type of the venue. (See `supported types `_.) + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_venue.SendVenue` """ - from ..methods import SendVenue + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVenue return SendVenue( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, latitude=latitude, longitude=longitude, title=title, address=address, foursquare_id=foursquare_id, foursquare_type=foursquare_type, + google_place_id=google_place_id, + google_place_type=google_place_type, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1523,8 +2067,10 @@ class Message(TelegramObject): thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, supports_streaming: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1532,25 +2078,41 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendVideo: """ - Reply with video + Shortcut for method :class:`aiogram.methods.send_video.SendVideo` + will automatically fill method attributes: - :param video: - :param duration: - :param width: - :param height: - :param thumb: - :param caption: - :param parse_mode: - :param supports_streaming: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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. + + Source: https://core.telegram.org/bots/api#sendvideo + + :param video: 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 » ` + :param duration: Duration of sent video in seconds + :param width: Video width + :param height: Video height + :param thumb: 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 » ` + :param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the video caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param supports_streaming: Pass :code:`True` if the uploaded video is suitable for streaming + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_video.SendVideo` """ - from ..methods import SendVideo + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVideo return SendVideo( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, video=video, duration=duration, width=width, @@ -1558,12 +2120,12 @@ class Message(TelegramObject): thumb=thumb, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, supports_streaming=supports_streaming, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1576,32 +2138,52 @@ class Message(TelegramObject): thumb: Optional[Union[InputFile, str]] = None, caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, supports_streaming: Optional[bool] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendVideo: """ - Answer with video + Shortcut for method :class:`aiogram.methods.send_video.SendVideo` + will automatically fill method attributes: - :param video: - :param duration: - :param width: - :param height: - :param thumb: - :param caption: - :param parse_mode: - :param supports_streaming: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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. + + Source: https://core.telegram.org/bots/api#sendvideo + + :param video: 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 » ` + :param duration: Duration of sent video in seconds + :param width: Video width + :param height: Video height + :param thumb: 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 » ` + :param caption: Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the video caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param supports_streaming: Pass :code:`True` if the uploaded video is suitable for streaming + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_video.SendVideo` """ - from ..methods import SendVideo + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVideo return SendVideo( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, video=video, duration=duration, width=width, @@ -1609,11 +2191,13 @@ class Message(TelegramObject): thumb=thumb, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, supports_streaming=supports_streaming, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1624,6 +2208,7 @@ class Message(TelegramObject): length: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1631,30 +2216,44 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendVideoNote: """ - Reply wit video note + Shortcut for method :class:`aiogram.methods.send_video_note.SendVideoNote` + will automatically fill method attributes: - :param video_note: - :param duration: - :param length: - :param thumb: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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. + + Source: https://core.telegram.org/bots/api#sendvideonote + + :param video_note: 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 + :param duration: Duration of sent video in seconds + :param length: Video width and height, i.e. diameter of the video message + :param thumb: 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 » ` + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_video_note.SendVideoNote` """ - from ..methods import SendVideoNote + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVideoNote return SendVideoNote( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, video_note=video_note, duration=duration, length=length, thumb=thumb, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1665,34 +2264,53 @@ class Message(TelegramObject): length: Optional[int] = None, thumb: Optional[Union[InputFile, str]] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendVideoNote: """ - Answer wit video note + Shortcut for method :class:`aiogram.methods.send_video_note.SendVideoNote` + will automatically fill method attributes: - :param video_note: - :param duration: - :param length: - :param thumb: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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. + + Source: https://core.telegram.org/bots/api#sendvideonote + + :param video_note: 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 + :param duration: Duration of sent video in seconds + :param length: Video width and height, i.e. diameter of the video message + :param thumb: 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 » ` + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_video_note.SendVideoNote` """ - from ..methods import SendVideoNote + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVideoNote return SendVideoNote( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, video_note=video_note, duration=duration, length=length, thumb=thumb, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1701,8 +2319,10 @@ class Message(TelegramObject): voice: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, duration: Optional[int] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1710,30 +2330,46 @@ class Message(TelegramObject): **kwargs: Any, ) -> SendVoice: """ - Reply with voice + Shortcut for method :class:`aiogram.methods.send_voice.SendVoice` + will automatically fill method attributes: - :param voice: - :param caption: - :param parse_mode: - :param duration: - :param disable_notification: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + - :code:`reply_to_message_id` + + 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 (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. + + Source: https://core.telegram.org/bots/api#sendvoice + + :param voice: 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 » ` + :param caption: Voice message caption, 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the voice message caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param duration: Duration of the voice message in seconds + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_voice.SendVoice` """ - from ..methods import SendVoice + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVoice return SendVoice( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, + reply_to_message_id=self.message_id, voice=voice, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, duration=duration, disable_notification=disable_notification, - reply_to_message_id=self.message_id, + protect_content=protect_content, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1742,36 +2378,58 @@ class Message(TelegramObject): voice: Union[InputFile, str], caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, + caption_entities: Optional[List[MessageEntity]] = None, duration: Optional[int] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, + reply_to_message_id: Optional[int] = None, + allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] ] = None, **kwargs: Any, ) -> SendVoice: """ - Answer with voice + Shortcut for method :class:`aiogram.methods.send_voice.SendVoice` + will automatically fill method attributes: - :param voice: - :param caption: - :param parse_mode: - :param duration: - :param disable_notification: - :param reply_markup: - :return: + - :code:`chat_id` + - :code:`message_thread_id` + + 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 (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. + + Source: https://core.telegram.org/bots/api#sendvoice + + :param voice: 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 » ` + :param caption: Voice message caption, 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the voice message caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param duration: Duration of the voice message in seconds + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.send_voice.SendVoice` """ - from ..methods import SendVoice + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SendVoice return SendVoice( chat_id=self.chat.id, + message_thread_id=self.message_thread_id if self.is_topic_message else None, voice=voice, caption=caption, parse_mode=parse_mode, + caption_entities=caption_entities, duration=duration, disable_notification=disable_notification, - reply_to_message_id=None, + protect_content=protect_content, + reply_to_message_id=reply_to_message_id, + allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1916,11 +2574,12 @@ class Message(TelegramObject): def copy_to( self, chat_id: Union[int, str], + message_thread_id: Optional[int] = None, caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, caption_entities: Optional[List[MessageEntity]] = None, - message_thread_id: Optional[int] = None, disable_notification: Optional[bool] = None, + protect_content: Optional[bool] = None, reply_to_message_id: Optional[int] = None, allow_sending_without_reply: Optional[bool] = None, reply_markup: Optional[ @@ -1929,56 +2588,92 @@ class Message(TelegramObject): **kwargs: Any, ) -> CopyMessage: """ - Copy message + Shortcut for method :class:`aiogram.methods.copy_message.CopyMessage` + will automatically fill method attributes: - :param chat_id: - :param caption: - :param parse_mode: - :param caption_entities: - :param message_thread_id: - :param disable_notification: - :param reply_to_message_id: - :param allow_sending_without_reply: - :param reply_markup: - :return: + - :code:`from_chat_id` + - :code:`message_id` + + Use this method to copy messages of any kind. Service 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. + + Source: https://core.telegram.org/bots/api#copymessage + + :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) + :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + :param caption: New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept + :param parse_mode: Mode for parsing entities in the new caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of *parse_mode* + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the sent message from forwarding and saving + :param reply_to_message_id: If the message is a reply, ID of the original message + :param allow_sending_without_reply: Pass :code:`True` if the message should be sent even if the specified replied-to message is not found + :param reply_markup: Additional interface options. A JSON-serialized object for an `inline keyboard `_, `custom reply keyboard `_, instructions to remove reply keyboard or to force a reply from the user. + :return: instance of method :class:`aiogram.methods.copy_message.CopyMessage` """ - from ..methods import CopyMessage + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import CopyMessage return CopyMessage( - chat_id=chat_id, from_chat_id=self.chat.id, message_id=self.message_id, + chat_id=chat_id, + message_thread_id=message_thread_id, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities, disable_notification=disable_notification, + protect_content=protect_content, reply_to_message_id=reply_to_message_id, allow_sending_without_reply=allow_sending_without_reply, reply_markup=reply_markup, - message_thread_id=message_thread_id, **kwargs, ) def edit_text( self, text: str, + inline_message_id: Optional[str] = None, parse_mode: Optional[str] = UNSET, entities: Optional[List[MessageEntity]] = None, disable_web_page_preview: Optional[bool] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> EditMessageText: - from ..methods import EditMessageText + """ + Shortcut for method :class:`aiogram.methods.edit_message_text.EditMessageText` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + 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. + + Source: https://core.telegram.org/bots/api#editmessagetext + + :param text: New text of the message, 1-4096 characters after entities parsing + :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message + :param parse_mode: Mode for parsing entities in the message text. See `formatting options `_ for more details. + :param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode* + :param disable_web_page_preview: Disables link previews for links in this message + :param reply_markup: A JSON-serialized object for an `inline keyboard `_. + :return: instance of method :class:`aiogram.methods.edit_message_text.EditMessageText` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import EditMessageText return EditMessageText( chat_id=self.chat.id, message_id=self.message_id, text=text, + inline_message_id=inline_message_id, parse_mode=parse_mode, entities=entities, disable_web_page_preview=disable_web_page_preview, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -1990,47 +2685,106 @@ class Message(TelegramObject): protect_content: Optional[bool] = None, **kwargs: Any, ) -> ForwardMessage: - from ..methods import ForwardMessage + """ + Shortcut for method :class:`aiogram.methods.forward_message.ForwardMessage` + will automatically fill method attributes: + + - :code:`from_chat_id` + - :code:`message_id` + + Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent :class:`aiogram.types.message.Message` is returned. + + Source: https://core.telegram.org/bots/api#forwardmessage + + :param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`) + :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only + :param disable_notification: Sends the message `silently `_. Users will receive a notification with no sound. + :param protect_content: Protects the contents of the forwarded message from forwarding and saving + :return: instance of method :class:`aiogram.methods.forward_message.ForwardMessage` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import ForwardMessage return ForwardMessage( - chat_id=chat_id, from_chat_id=self.chat.id, message_id=self.message_id, + chat_id=chat_id, + message_thread_id=message_thread_id, disable_notification=disable_notification, protect_content=protect_content, - message_thread_id=message_thread_id, **kwargs, ) def edit_media( self, media: InputMedia, + inline_message_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> EditMessageMedia: - from ..methods import EditMessageMedia + """ + Shortcut for method :class:`aiogram.methods.edit_message_media.EditMessageMedia` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + Use this method to edit animation, audio, document, photo, or video 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. + + Source: https://core.telegram.org/bots/api#editmessagemedia + + :param media: A JSON-serialized object for a new media content of the message + :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message + :param reply_markup: A JSON-serialized object for a new `inline keyboard `_. + :return: instance of method :class:`aiogram.methods.edit_message_media.EditMessageMedia` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import EditMessageMedia return EditMessageMedia( - media=media, chat_id=self.chat.id, message_id=self.message_id, + media=media, + inline_message_id=inline_message_id, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) def edit_reply_markup( self, + inline_message_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> EditMessageReplyMarkup: - from ..methods import EditMessageReplyMarkup + """ + Shortcut for method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + 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. + + Source: https://core.telegram.org/bots/api#editmessagereplymarkup + + :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message + :param reply_markup: A JSON-serialized object for an `inline keyboard `_. + :return: instance of method :class:`aiogram.methods.edit_message_reply_markup.EditMessageReplyMarkup` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import EditMessageReplyMarkup return EditMessageReplyMarkup( chat_id=self.chat.id, message_id=self.message_id, + inline_message_id=inline_message_id, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -2041,60 +2795,125 @@ class Message(TelegramObject): self, latitude: float, longitude: float, + inline_message_id: Optional[str] = None, horizontal_accuracy: Optional[float] = None, heading: Optional[int] = None, proximity_alert_radius: Optional[int] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> EditMessageLiveLocation: - from ..methods import EditMessageLiveLocation + """ + Shortcut for method :class:`aiogram.methods.edit_message_live_location.EditMessageLiveLocation` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + 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 + + :param latitude: Latitude of new location + :param longitude: Longitude of new location + :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message + :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500 + :param heading: Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. + :param proximity_alert_radius: The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. + :param reply_markup: A JSON-serialized object for a new `inline keyboard `_. + :return: instance of method :class:`aiogram.methods.edit_message_live_location.EditMessageLiveLocation` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import EditMessageLiveLocation return EditMessageLiveLocation( - latitude=latitude, - longitude=longitude, chat_id=self.chat.id, message_id=self.message_id, + latitude=latitude, + longitude=longitude, + inline_message_id=inline_message_id, horizontal_accuracy=horizontal_accuracy, heading=heading, proximity_alert_radius=proximity_alert_radius, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) def stop_live_location( self, + inline_message_id: Optional[str] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> StopMessageLiveLocation: - from ..methods import StopMessageLiveLocation + """ + Shortcut for method :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + 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 + + :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message + :param reply_markup: A JSON-serialized object for a new `inline keyboard `_. + :return: instance of method :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import StopMessageLiveLocation return StopMessageLiveLocation( chat_id=self.chat.id, message_id=self.message_id, + inline_message_id=inline_message_id, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) def edit_caption( self, - caption: str, + inline_message_id: Optional[str] = None, + caption: Optional[str] = None, parse_mode: Optional[str] = UNSET, caption_entities: Optional[List[MessageEntity]] = None, reply_markup: Optional[InlineKeyboardMarkup] = None, **kwargs: Any, ) -> EditMessageCaption: - from ..methods import EditMessageCaption + """ + Shortcut for method :class:`aiogram.methods.edit_message_caption.EditMessageCaption` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + 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. + + Source: https://core.telegram.org/bots/api#editmessagecaption + + :param inline_message_id: Required if *chat_id* and *message_id* are not specified. Identifier of the inline message + :param caption: New caption of the message, 0-1024 characters after entities parsing + :param parse_mode: Mode for parsing entities in the message caption. See `formatting options `_ for more details. + :param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode* + :param reply_markup: A JSON-serialized object for an `inline keyboard `_. + :return: instance of method :class:`aiogram.methods.edit_message_caption.EditMessageCaption` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import EditMessageCaption return EditMessageCaption( chat_id=self.chat.id, message_id=self.message_id, + inline_message_id=inline_message_id, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities, reply_markup=reply_markup, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -2102,12 +2921,45 @@ class Message(TelegramObject): self, **kwargs: Any, ) -> DeleteMessage: - from ..methods import DeleteMessage + """ + Shortcut for method :class:`aiogram.methods.delete_message.DeleteMessage` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + Use this method to delete a message, including service messages, with the following limitations: + + - A message can only be deleted if it was sent less than 48 hours ago. + + - Service messages about a supergroup, channel, or forum topic creation can't be deleted. + + - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. + + - Bots can delete outgoing messages in private chats, groups, and supergroups. + + - Bots can delete incoming messages in private chats. + + - Bots granted *can_post_messages* permissions can delete outgoing messages in channels. + + - If the bot is an administrator of a group, it can delete any message there. + + - If the bot has *can_delete_messages* permission in a supergroup or a channel, it can delete any message there. + + Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#deletemessage + + :return: instance of method :class:`aiogram.methods.delete_message.DeleteMessage` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import DeleteMessage return DeleteMessage( chat_id=self.chat.id, message_id=self.message_id, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -2116,13 +2968,29 @@ class Message(TelegramObject): disable_notification: Optional[bool] = None, **kwargs: Any, ) -> PinChatMessage: - from ..methods import PinChatMessage + """ + Shortcut for method :class:`aiogram.methods.pin_chat_message.PinChatMessage` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#pinchatmessage + + :param disable_notification: 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. + :return: instance of method :class:`aiogram.methods.pin_chat_message.PinChatMessage` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import PinChatMessage return PinChatMessage( chat_id=self.chat.id, message_id=self.message_id, disable_notification=disable_notification, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -2130,12 +2998,27 @@ class Message(TelegramObject): self, **kwargs: Any, ) -> UnpinChatMessage: - from ..methods import UnpinChatMessage + """ + Shortcut for method :class:`aiogram.methods.unpin_chat_message.UnpinChatMessage` + will automatically fill method attributes: + + - :code:`chat_id` + - :code:`message_id` + + Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#unpinchatmessage + + :return: instance of method :class:`aiogram.methods.unpin_chat_message.UnpinChatMessage` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import UnpinChatMessage return UnpinChatMessage( chat_id=self.chat.id, message_id=self.message_id, - message_thread_id=self.message_thread_id if self.is_topic_message else None, **kwargs, ) @@ -2157,51 +3040,3 @@ class Message(TelegramObject): chat_value = self.chat.username return f"https://t.me/{chat_value}/{self.message_id}" - - -class ContentType(helper.Helper): - mode = helper.HelperMode.snake_case - - TEXT = helper.Item() # text - AUDIO = helper.Item() # audio - DOCUMENT = helper.Item() # document - ANIMATION = helper.Item() # animation - GAME = helper.Item() # game - PHOTO = helper.Item() # photo - STICKER = helper.Item() # sticker - VIDEO = helper.Item() # video - VIDEO_NOTE = helper.Item() # video_note - VOICE = helper.Item() # voice - CONTACT = helper.Item() # contact - LOCATION = helper.Item() # location - VENUE = helper.Item() # venue - NEW_CHAT_MEMBERS = helper.Item() # new_chat_member - LEFT_CHAT_MEMBER = helper.Item() # left_chat_member - INVOICE = helper.Item() # invoice - SUCCESSFUL_PAYMENT = helper.Item() # successful_payment - CONNECTED_WEBSITE = helper.Item() # connected_website - MIGRATE_TO_CHAT_ID = helper.Item() # migrate_to_chat_id - MIGRATE_FROM_CHAT_ID = helper.Item() # migrate_from_chat_id - PINNED_MESSAGE = helper.Item() # pinned_message - NEW_CHAT_TITLE = helper.Item() # new_chat_title - NEW_CHAT_PHOTO = helper.Item() # new_chat_photo - DELETE_CHAT_PHOTO = helper.Item() # delete_chat_photo - GROUP_CHAT_CREATED = helper.Item() # group_chat_created - SUPERGROUP_CHAT_CREATED = helper.Item() # supergroup_chat_created - CHANNEL_CHAT_CREATED = helper.Item() # channel_chat_created - PASSPORT_DATA = helper.Item() # passport_data - PROXIMITY_ALERT_TRIGGERED = helper.Item() # proximity_alert_triggered - POLL = helper.Item() # poll - DICE = helper.Item() # dice - MESSAGE_AUTO_DELETE_TIMER_CHANGED = helper.Item() # message_auto_delete_timer_changed - FORUM_TOPIC_CREATED = helper.Item() # forum_topic_created - FORUM_TOPIC_CLOSED = helper.Item() # forum_topic_closed - FORUM_TOPIC_REOPENED = helper.Item() # forum_topic_reopened - VIDEO_CHAT_SCHEDULED = helper.Item() # video_chat_scheduled - VIDEO_CHAT_STARTED = helper.Item() # video_chat_started - VIDEO_CHAT_ENDED = helper.Item() # video_chat_ended - VIDEO_CHAT_PARTICIPANTS_INVITED = helper.Item() # video_chat_participants_invited - WEB_APP_DATA = helper.Item() # web_app_data - - UNKNOWN = helper.Item() # unknown - ANY = helper.Item() # any diff --git a/aiogram/types/sticker.py b/aiogram/types/sticker.py index 19f01a02..770dd204 100644 --- a/aiogram/types/sticker.py +++ b/aiogram/types/sticker.py @@ -1,10 +1,11 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Any, Optional from .base import TelegramObject if TYPE_CHECKING: + from ..methods import DeleteStickerFromSet, SetStickerPositionInSet from .file import File from .mask_position import MaskPosition from .photo_size import PhotoSize @@ -45,3 +46,58 @@ class Sticker(TelegramObject): """*Optional*. For custom emoji stickers, unique identifier of the custom emoji""" file_size: Optional[int] = None """*Optional*. File size in bytes""" + + def set_position_in_set( + self, + position: int, + **kwargs: Any, + ) -> SetStickerPositionInSet: + """ + Shortcut for method :class:`aiogram.methods.set_sticker_position_in_set.SetStickerPositionInSet` + will automatically fill method attributes: + + - :code:`sticker` + + Use this method to move a sticker in a set created by the bot to a specific position. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#setstickerpositioninset + + :param position: New sticker position in the set, zero-based + :return: instance of method :class:`aiogram.methods.set_sticker_position_in_set.SetStickerPositionInSet` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import SetStickerPositionInSet + + return SetStickerPositionInSet( + sticker=self.file_id, + position=position, + **kwargs, + ) + + def delete_from_set( + self, + **kwargs: Any, + ) -> DeleteStickerFromSet: + """ + Shortcut for method :class:`aiogram.methods.delete_sticker_from_set.DeleteStickerFromSet` + will automatically fill method attributes: + + - :code:`sticker` + + Use this method to delete a sticker from a set created by the bot. Returns :code:`True` on success. + + Source: https://core.telegram.org/bots/api#deletestickerfromset + + :return: instance of method :class:`aiogram.methods.delete_sticker_from_set.DeleteStickerFromSet` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import DeleteStickerFromSet + + return DeleteStickerFromSet( + sticker=self.file_id, + **kwargs, + ) diff --git a/aiogram/types/user.py b/aiogram/types/user.py index 2308dbd4..3b71af19 100644 --- a/aiogram/types/user.py +++ b/aiogram/types/user.py @@ -1,11 +1,14 @@ from __future__ import annotations -from typing import Optional +from typing import TYPE_CHECKING, Any, Optional from ..utils import markdown from ..utils.link import create_tg_link from .base import TelegramObject +if TYPE_CHECKING: + from ..methods import GetUserProfilePhotos + class User(TelegramObject): """ @@ -56,3 +59,35 @@ class User(TelegramObject): 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, + **kwargs: Any, + ) -> GetUserProfilePhotos: + """ + Shortcut for method :class:`aiogram.methods.get_user_profile_photos.GetUserProfilePhotos` + will automatically fill method attributes: + + - :code:`user_id` + + Use this method to get a list of profile pictures for a user. Returns a :class:`aiogram.types.user_profile_photos.UserProfilePhotos` object. + + Source: https://core.telegram.org/bots/api#getuserprofilephotos + + :param offset: Sequential number of the first photo to be returned. By default, all photos are returned. + :param limit: Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. + :return: instance of method :class:`aiogram.methods.get_user_profile_photos.GetUserProfilePhotos` + """ + # DO NOT EDIT MANUALLY!!! + # This method was auto-generated via `butcher` + + from aiogram.methods import GetUserProfilePhotos + + return GetUserProfilePhotos( + user_id=self.id, + offset=offset, + limit=limit, + **kwargs, + )