Bot object

That is extended (and recommended for usage) bot class based on BaseBot class. You can use instance of that bot in aiogram.dispatcher.Dispatcher

class aiogram.bot.bot.Bot(token: String, loop: typing.Union[asyncio.events.AbstractEventLoop, NoneType] = None, connections_limit: typing.Union[~Integer, NoneType] = 10, proxy: str = None, proxy_auth: typing.Union[aiohttp.helpers.BasicAuth, NoneType] = None, continue_retry: typing.Union[bool, NoneType] = False)[исходный код]
Базовые классы: aiogram.bot.base.BaseBot

Main bot class. Based on aiogram.bot.BaseBot and in this module is realized data serialization.

Instructions how to get Bot token is found here: https://core.telegram.org/bots#3-how-do-i-create-a-bot

Параметры:
  • token (str) – token from @BotFather
  • loop (Optional Union asyncio.BaseEventLoop, asyncio.AbstractEventLoop) – event loop
  • connections_limit (int) – connections limit for aiohttp.ClientSession
  • proxy (str) – HTTP proxy URL
  • proxy_auth (Optional aiohttp.BasicAuth) – Authentication information
  • continue_retry (bool) – automatic retry sent request when flood control exceeded
Raise:

when token is invalid throw an aiogram.utils.exceptions.ValidationError

me

Alias for self.get_me() but lazy and with caching.

Результат:aiogram.types.User
prepare_object(obj, parent=None)[исходный код]

Setup bot instance and objects tree for object

Параметры:
  • obj – instance of types.base.Deserializable
  • parent – first parent object
Результат:

configured object

download_file_by_id(file_id, destination=None, timeout=30, chunk_size=65536, seek=True)[исходный код]

Download file by file_id to destination

if You want to automatically create destination (io.BytesIO) use default value of destination and handle result of this method.

Параметры:
  • file_id – str
  • destination – filename or instance of io.IOBase. For e. g. io.BytesIO
  • timeout – int
  • chunk_size – int
  • seek – bool - go to start of file when downloading is finished.
Результат:

destination

get_updates(offset: typing.Union[~Integer, NoneType] = None, limit: typing.Union[~Integer, NoneType] = None, timeout: typing.Union[~Integer, NoneType] = None, allowed_updates: typing.Union[typing.List[~String], NoneType] = None) → typing.List[aiogram.types.update.Update][исходный код]

Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.

Notes
  1. This method will not work if an outgoing webhook is set up.
  2. In order to avoid getting duplicate updates, recalculate offset after each server response.

Source: https://core.telegram.org/bots/api#getupdates

Параметры:
  • offset – Integer (Optional) - Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from - offset update from the end of the updates queue. All previous updates will forgotten.
  • limit – Integer (Optional) - Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100.
  • timeout – Integer (Optional) - Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
  • allowed_updates

    List[String] (Optional) - List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.

    Please note that this parameter doesn’t affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.

Результат:

An Array of Update objects is returned. (serialized)

get_webhook_info() → aiogram.types.webhook_info.WebhookInfo[исходный код]
Use this method to get current webhook status. Requires no parameters. On success,
returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.

Source: https://core.telegram.org/bots/api#getwebhookinfo

Результат:On success, returns a WebhookInfo object. (serialized)
get_me() → aiogram.types.user.User[исходный код]

A simple method for testing your bot’s auth token. Requires no parameters. Returns basic information about the bot in form of a User object.

Source: https://core.telegram.org/bots/api#getme

Результат:Returns basic information about the bot in form of a User object. (serialized)
send_message(chat_id: typing.Union[~Integer, ~String], text: String, parse_mode: typing.Union[~String, NoneType] = None, disable_web_page_preview: typing.Union[~Boolean, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send text messages. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendmessage

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • text – String - Text of the message to be sent
  • parse_mode – String (Optional) - Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot’s message.
  • disable_web_page_preview – Boolean (Optional) - Disables link previews for links in this message
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

forward_message(chat_id: typing.Union[~Integer, ~String], from_chat_id: typing.Union[~Integer, ~String], message_id: Integer, disable_notification: typing.Union[~Boolean, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to forward messages of any kind. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#forwardmessage

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • from_chat_id – Union[Integer, String] - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • message_id – Integer - Message identifier in the chat specified in from_chat_id
Результат:

On success, the sent Message is returned. (serialized)

send_photo(chat_id: typing.Union[~Integer, ~String], photo: typing.Union[_io.BytesIO, _io.FileIO, ~String], caption: typing.Union[~String, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send photos. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendphoto

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • photo – Union[io.BytesIO, io.FileIO, String] - 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.
  • caption – String (Optional) - Photo caption (may also be used when resending photos by file_id), 0-200 characters
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

send_audio(chat_id: typing.Union[~Integer, ~String], audio: typing.Union[_io.BytesIO, _io.FileIO, ~String], caption: typing.Union[~String, NoneType] = None, duration: typing.Union[~Integer, NoneType] = None, performer: typing.Union[~String, NoneType] = None, title: typing.Union[~String, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → typing.Dict[исходный код]

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 format. On success, the sent 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 sendVoice method instead.

Source: https://core.telegram.org/bots/api#sendaudio

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • audio – Union[io.BytesIO, io.FileIO, String] - 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.
  • caption – String (Optional) - Audio caption, 0-200 characters
  • duration – Integer (Optional) - Duration of the audio in seconds
  • performer – String (Optional) - Performer
  • title – String (Optional) - Track name
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

send_document(chat_id: typing.Union[~Integer, ~String], document: typing.Union[_io.BytesIO, _io.FileIO, ~String], caption: typing.Union[~String, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None, filename: typing.Union[str, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send general files. On success, the sent 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

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • document – Union[io.BytesIO, io.FileIO, String] - 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.
  • caption – String (Optional) - Document caption (may also be used when resending documents by file_id), 0-200 characters
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
  • filename – Set file name
Результат:

On success, the sent Message is returned. (serialized)

send_video(chat_id: typing.Union[~Integer, ~String], video: typing.Union[_io.BytesIO, _io.FileIO, ~String], duration: typing.Union[~Integer, NoneType] = None, width: typing.Union[~Integer, NoneType] = None, height: typing.Union[~Integer, NoneType] = None, caption: typing.Union[~String, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent 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

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • video – Union[io.BytesIO, io.FileIO, String] - 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.
  • duration – Integer (Optional) - Duration of sent video in seconds
  • width – Integer (Optional) - Video width
  • height – Integer (Optional) - Video height
  • caption – String (Optional) - Video caption (may also be used when resending videos by file_id), 0-200 characters
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

send_voice(chat_id: typing.Union[~Integer, ~String], voice: typing.Union[_io.BytesIO, _io.FileIO, ~String], caption: typing.Union[~String, NoneType] = None, duration: typing.Union[~Integer, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent 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

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • voice – Union[io.BytesIO, io.FileIO, String] - 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.
  • caption – String (Optional) - Voice message caption, 0-200 characters
  • duration – Integer (Optional) - Duration of the voice message in seconds
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

send_video_note(chat_id: typing.Union[~Integer, ~String], video_note: typing.Union[_io.BytesIO, _io.FileIO, ~String], duration: typing.Union[~Integer, NoneType] = None, length: typing.Union[~Integer, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendvideonote

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • video_note – Union[io.BytesIO, io.FileIO, String] - 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. Sending video notes by a URL is currently unsupported
  • duration – Integer (Optional) - Duration of sent video in seconds
  • length – Integer (Optional) - Video width and height
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

send_location(chat_id: typing.Union[~Integer, ~String], latitude: Float, longitude: Float, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send point on the map. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendlocation

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • latitude – Float - Latitude of location
  • longitude – Float - Longitude of location
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

send_venue(chat_id: typing.Union[~Integer, ~String], latitude: Float, longitude: Float, title: String, address: String, foursquare_id: typing.Union[~String, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send information about a venue. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendvenue

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • latitude – Float - Latitude of the venue
  • longitude – Float - Longitude of the venue
  • title – String - Name of the venue
  • address – String - Address of the venue
  • foursquare_id – String (Optional) - Foursquare identifier of the venue
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

send_contact(chat_id: typing.Union[~Integer, ~String], phone_number: String, first_name: String, last_name: typing.Union[~String, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send phone contacts. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendcontact

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • phone_number – String - Contact’s phone number
  • first_name – String - Contact’s first name
  • last_name – String (Optional) - Contact’s last name
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user.
Результат:

On success, the sent Message is returned. (serialized)

get_user_profile_photos(user_id: Integer, offset: typing.Union[~Integer, NoneType] = None, limit: typing.Union[~Integer, NoneType] = None) → aiogram.types.user_profile_photos.UserProfilePhotos[исходный код]

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

Source: https://core.telegram.org/bots/api#getuserprofilephotos

Параметры:
  • user_id – Integer - Unique identifier of the target user
  • offset – Integer (Optional) - Sequential number of the first photo to be returned. By default, all photos are returned.
  • limit – Integer (Optional) - Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
Результат:

Returns a UserProfilePhotos object. (serialized)

get_file(file_id: String) → aiogram.types.file.File[исходный код]

Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.

Note: This function may not preserve the original file name and MIME type. You should save the file’s MIME type and name (if available) when the File object is received.

Source: https://core.telegram.org/bots/api#getfile

Параметры:file_id – String - File identifier to get info about
Результат:On success, a File object is returned. (serialized)
get_chat(chat_id: typing.Union[~Integer, ~String]) → aiogram.types.chat.Chat[исходный код]

Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.

Source: https://core.telegram.org/bots/api#getchat

Параметры:chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
Результат:Returns a Chat object on success.
get_chat_administrators(chat_id: typing.Union[~Integer, ~String]) → typing.List[aiogram.types.chat_member.ChatMember][исходный код]

Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.

Source: https://core.telegram.org/bots/api#getchatadministrators

Параметры:chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
Результат:On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. (serialized)
get_chat_member(chat_id: typing.Union[~Integer, ~String], user_id: Integer) → aiogram.types.chat_member.ChatMember[исходный код]

Use this method to get information about a member of a chat. Returns a ChatMember object on success.

Source: https://core.telegram.org/bots/api#getchatmember

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
  • user_id – Integer - Unique identifier of the target user
Результат:

Returns a ChatMember object on success. (serialized)

send_sticker(chat_id: typing.Union[~Integer, ~String], sticker: typing.Union[_io.BytesIO, _io.FileIO, ~String], disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, aiogram.types.reply_keyboard.ReplyKeyboardMarkup, typing.Dict, ~String, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send .webp stickers. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendsticker

Параметры:
  • chat_id – Union[Integer, String] - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • sticker – Union[io.BytesIO, io.FileIO, String] - 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. More info on Sending Files »
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, Dict, String] (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

get_sticker_set(name: String) → aiogram.types.sticker_set.StickerSet[исходный код]

Use this method to get a sticker set. On success, a StickerSet object is returned.

Source: https://core.telegram.org/bots/api#getstickerset

Параметры:name – String - Name of the sticker set
Результат:On success, a StickerSet object is returned.
upload_sticker_file(user_id: Integer, png_sticker: _io.BytesIO) → aiogram.types.file.File[исходный код]

Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.

Source: https://core.telegram.org/bots/api#uploadstickerfile

Параметры:
  • user_id – Integer - User identifier of sticker file owner
  • png_sticker – io.BytesIO - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.
Результат:

Returns the uploaded File on success. (serialized)

send_invoice(chat_id: Integer, title: String, description: String, payload: String, provider_token: String, start_parameter: String, currency: String, prices: [<class 'aiogram.types.labeled_price.LabeledPrice'>], photo_url: typing.Union[~String, NoneType] = None, photo_size: typing.Union[~Integer, NoneType] = None, photo_width: typing.Union[~Integer, NoneType] = None, photo_height: typing.Union[~Integer, NoneType] = None, need_name: typing.Union[~Boolean, NoneType] = None, need_phone_number: typing.Union[~Boolean, NoneType] = None, need_email: typing.Union[~Boolean, NoneType] = None, need_shipping_address: typing.Union[~Boolean, NoneType] = None, is_flexible: typing.Union[~Boolean, NoneType] = None, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send invoices. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendinvoice

Параметры:
  • chat_id – Integer - Unique identifier for the target private chat
  • title – String - Product name, 1-32 characters
  • description – String - Product description, 1-255 characters
  • payload – String - Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
  • provider_token – String - Payments provider token, obtained via Botfather
  • start_parameter – String - Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter
  • currency – String - Three-letter ISO 4217 currency code, see more on currencies
  • prices – [types.LabeledPrice] - Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
  • photo_url – String (Optional) - URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
  • photo_size – Integer (Optional) - Photo size
  • photo_width – Integer (Optional) - Photo width
  • photo_height – Integer (Optional) - Photo height
  • need_name – Boolean (Optional) - Pass True, if you require the user’s full name to complete the order
  • need_phone_number – Boolean (Optional) - Pass True, if you require the user’s phone number to complete the order
  • need_email – Boolean (Optional) - Pass True, if you require the user’s email to complete the order
  • need_shipping_address – Boolean (Optional) - Pass True, if you require the user’s shipping address to complete the order
  • is_flexible – Boolean (Optional) - Pass True, if the final price depends on the shipping method
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – types.InlineKeyboardMarkup (Optional) - A JSON-serialized object for an inline keyboard. If empty, one ‘Pay total price’ button will be shown. If not empty, the first button must be a Pay button.
Результат:

On success, the sent Message is returned. (serialized)

send_game(chat_id: Integer, game_short_name: String, disable_notification: typing.Union[~Boolean, NoneType] = None, reply_to_message_id: typing.Union[~Integer, NoneType] = None, reply_markup: typing.Union[aiogram.types.inline_keyboard.InlineKeyboardMarkup, NoneType] = None) → aiogram.types.message.Message[исходный код]

Use this method to send a game. On success, the sent Message is returned.

Source: https://core.telegram.org/bots/api#sendgame

Параметры:
  • chat_id – Integer - Unique identifier for the target chat
  • game_short_name – String - Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
  • disable_notification – Boolean (Optional) - Sends the message silently. Users will receive a notification with no sound.
  • reply_to_message_id – Integer (Optional) - If the message is a reply, ID of the original message
  • reply_markup – types.InlineKeyboardMarkup (Optional) - 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.
Результат:

On success, the sent Message is returned. (serialized)

set_game_score(user_id: Integer, score: Integer, force: typing.Union[~Boolean, NoneType] = None, disable_edit_message: typing.Union[~Boolean, NoneType] = None, chat_id: typing.Union[~Integer, NoneType] = None, message_id: typing.Union[~Integer, NoneType] = None, inline_message_id: typing.Union[~String, NoneType] = None) → typing.Union[aiogram.types.message.Message, ~Boolean][исходный код]

Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user’s current score in the chat and force is False.

Source: https://core.telegram.org/bots/api#setgamescore

Параметры:
  • user_id – Integer - User identifier
  • score – Integer - New score, must be non-negative
  • force – Boolean (Optional) - Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
  • disable_edit_message – Boolean (Optional) - Pass True, if the game message should not be automatically edited to include the current scoreboard
  • chat_id – Integer (Optional) - Required if inline_message_id is not specified. Unique identifier for the target chat
  • message_id – Integer (Optional) - Required if inline_message_id is not specified. Identifier of the sent message
  • inline_message_id – String (Optional) - Required if chat_id and message_id are not specified. Identifier of the inline message
Результат:

On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. (serialized)