Render shortcuts

This commit is contained in:
Alex Root Junior 2022-11-21 01:47:40 +02:00
parent 3438d2446d
commit c556290e3e
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC
15 changed files with 2701 additions and 754 deletions

View file

@ -0,0 +1,4 @@
answer:
method: answerCallbackQuery
fill:
callback_query_id: self.id

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
answer:
method: answerInlineQuery
fill:
inline_query_id: self.id

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
get_profile_photos:
method: getUserProfilePhotos
fill:
user_id: self.id

1
CHANGES/952.feature.rst Normal file
View file

@ -0,0 +1 @@
Add missing shortcuts, added new enums, reworked old stuff

View file

@ -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 <https://core.telegram.org/bots/features#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 <https://t.me/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 <https://t.me/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 <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,
)

View file

@ -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 <https://core.telegram.org/bots/api#unbanchatsenderchat>`_, 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 <https://t.me/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 <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_.
: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 <https://core.telegram.org/bots/api#unbanchatmember>`_ 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,
)

View file

@ -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,
)

View file

@ -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 <https://core.telegram.org/bots/features#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,
)

File diff suppressed because it is too large Load diff

View file

@ -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,
)

View file

@ -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,
)