Available Types¶
All the names of the types are exactly the same described in the offical documentation.
Note:
Attribute from of the types, has been changed to from_user because in python it causes conflict.
If the type
Messagehas not text, the text it’s an empty string instead ofNone, so you can do as follows without getting an AttributeError.
import apitele
from apitele.types import Message
bot = apitele.Client('<yor_api_token>')
@bot.manage_message()
async def foo(msg: Message):
if msg.text.startswith('/start'):
...
# An error will never be raised
# because the text is always of type string.
All other optional attributes are
Noneif they are not in the received JSON.
- class apitele.types.AcceptedGiftTypes(unlimited_gifts, limited_gifts, unique_gifts, premium_subscription)[source]¶
https://core.telegram.org/bots/api#acceptedgifttypes
This object describes the types of gifts that can be gifted to a user or a chat.
- Parameters:
unlimited_gifts (
bool) –True, if unlimited regular gifts are accepted.limited_gifts (
bool) –True, if limited regular gifts are accepted.unique_gifts (
bool) –True, if unique gifts or gifts that can be upgraded to unique for free are accepted.premium_subscription (
bool) –True, if a Telegram Premium subscription is accepted.
- class apitele.types.AffiliateInfo(commission_per_mille, amount, affiliate_user=None, affiliate_chat=None, nanostar_amount=None)[source]¶
https://core.telegram.org/bots/api#affiliateinfo
Contains information about the affiliate that received a commission via this transaction.
- Parameters:
commission_per_mille (
int) – The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users.amount (
int) – Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds.affiliate_user (
User, optional) – The bot or the user that received an affiliate commission if it was received by a bot or a user.affiliate_chat (
Chat, optional) – The chat that received an affiliate commission if it was received by a chat.nanostar_amount (
int, optional) – The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds.
- class apitele.types.Animation(file_id, file_unique_id, width, height, duration, thumbnail=None, file_name=None, mime_type=None, file_size=None)[source]¶
https://core.telegram.org/bots/api#animation
This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.width (
int) – Video width as defined by sender.height (
int) – Video height as defined by sender.duration (
int) – Duration of the video in seconds as defined by sender.thumbnail (
PhotoSize, optional) – Animation thumbnail as defined by sender.file_name (
str, optional) – Original animation filename as defined by sender.mime_type (
str, optional) – MIME type of the file as defined by sender.file_size (
int, optional) – File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
- class apitele.types.Audio(file_id, file_unique_id, duration, performer=None, title=None, file_name=None, mime_type=None, file_size=None, thumbnail=None)[source]¶
https://core.telegram.org/bots/api#audio
This object represents an audio file to be treated as music by the Telegram clients.
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.duration (
int) – Duration of the audio in seconds as defined by sender.performer (
str, optional) – Performer of the audio as defined by sender or by audio tags.title (
str, optional) – Title of the audio as defined by sender or by audio tags.file_name (
str, optional) – Original filename as defined by sender.mime_type (
str, optional) – MIME type of the file as defined by sender.file_size (
int, optional) – File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.thumbnail (
PhotoSize, optional) – Thumbnail of the album cover to which the music file belongs.
- apitele.types.BackgroundFill¶
https://core.telegram.org/bots/api#backgroundfill
This object describes the way a background is filled based on the selected colors. Currently, it can be one of:
alias of
BackgroundFillSolid|BackgroundFillGradient|BackgroundFillFreeformGradient
- class apitele.types.BackgroundFillFreeformGradient(colors)[source]¶
https://core.telegram.org/bots/api#backgroundfillfreeformgradient
The background is a freeform gradient that rotates after every message in the chat.
- Parameters:
colors (
listofint) – A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format.
- class apitele.types.BackgroundFillGradient(top_color, bottom_color, rotation_angle)[source]¶
https://core.telegram.org/bots/api#backgroundfillgradient
The background is a gradient fill.
- Parameters:
top_color (
int) – Top color of the gradient in the RGB24 format.bottom_color (
int) – Bottom color of the gradient in the RGB24 format.rotation_angle (
int) – Clockwise rotation angle of the background fill in degrees; 0-359.
- class apitele.types.BackgroundFillSolid(color)[source]¶
https://core.telegram.org/bots/api#backgroundfillsolid
The background is filled using the selected color.
- Parameters:
color (
int) – The color of the background fill in the RGB24 format.
- apitele.types.BackgroundType¶
https://core.telegram.org/bots/api#backgroundtype
This object describes the type of a background. Currently, it can be one of:
alias of
BackgroundTypeFill|BackgroundTypeWallpaper|BackgroundTypePattern|BackgroundTypeChatTheme
- class apitele.types.BackgroundTypeChatTheme(theme_name)[source]¶
https://core.telegram.org/bots/api#backgroundtypechattheme
The background is taken directly from a built-in chat theme.
- Parameters:
theme_name (
str) – Name of the chat theme, which is usually an emoji.
- class apitele.types.BackgroundTypeFill(fill, dark_theme_dimming)[source]¶
https://core.telegram.org/bots/api#backgroundtypefill
The background is automatically filled based on the selected colors.
- Parameters:
fill (
BackgroundFill) – The background fill.dark_theme_dimming (
int) – Dimming of the background in dark themes, as a percentage; 0-100.
- class apitele.types.BackgroundTypePattern(document, fill, intensity, is_inverted=None, is_moving=None)[source]¶
https://core.telegram.org/bots/api#backgroundtypepattern
The background is a PNG or TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user.
- Parameters:
document (
Document) – Document with the pattern.fill (
BackgroundFill) – The background fill that is combined with the pattern.intensity (
int) – Intensity of the pattern when it is shown above the filled background; 0-100.is_inverted (
True, optional) –True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only.is_moving (
True, optional) –True, if the background moves slightly when the device is tilted.
- class apitele.types.BackgroundTypeWallpaper(document, dark_theme_dimming, is_blurred=None, is_moving=None)[source]¶
https://core.telegram.org/bots/api#backgroundtypewallpaper
The background is a wallpaper in the JPEG format.
- Parameters:
document (
Document) – Document with the wallpaper.dark_theme_dimming (
int) – Dimming of the background in dark themes, as a percentage; 0-100.is_blurred (
True, optional) –True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12.is_moving (
True, optional) –True, if the background moves slightly when the device is tilted.
- class apitele.types.Birthdate(day, month, year=None)[source]¶
https://core.telegram.org/bots/api#birthdate
- Parameters:
day (
int) – Day of the user’s birth; 1-31.month (
int) – Month of the user’s birth; 1-12.year (
int, optional) – Year of the user’s birth.
- class apitele.types.BotCommand(command, description)[source]¶
https://core.telegram.org/bots/api#botcommand
This object represents a bot command.
- Parameters:
command (
str) – Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores.description (
str) – Description of the command; 1-256 characters.
- apitele.types.BotCommandScope¶
https://core.telegram.org/bots/api#botcommandscope
This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
Determining list of commands
The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned:
Commands in the chat with the bot
BotCommandScopeChat+ language_codeBotCommandScopeAllPrivateChats+ language_codeBotCommandScopeDefault+ language_code
Commands in group and supergroup chats
BotCommandScopeChatMember+ language_codeBotCommandScopeChatAdministrators+ language_code (administrators only)BotCommandScopeChatAdministrators(administrators only)BotCommandScopeChat+ language_codeBotCommandScopeAllChatAdministrators+ language_code (administrators only)BotCommandScopeAllChatAdministrators(administrators only)BotCommandScopeAllGroupChats+ language_codeBotCommandScopeDefault+ language_code
alias of
BotCommandScopeDefault|BotCommandScopeAllPrivateChats|BotCommandScopeAllGroupChats|BotCommandScopeAllChatAdministrators|BotCommandScopeChat|BotCommandScopeChatAdministrators|BotCommandScopeChatMember
- class apitele.types.BotCommandScopeAllChatAdministrators[source]¶
https://core.telegram.org/bots/api#botcommandscopeallchatadministrators
Represents the
scopeof bot commands, covering all group and supergroup chat administrators.
- class apitele.types.BotCommandScopeAllGroupChats[source]¶
https://core.telegram.org/bots/api#botcommandscopeallgroupchats
Represents the
scopeof bot commands, covering all group and supergroup chats.
- class apitele.types.BotCommandScopeAllPrivateChats[source]¶
https://core.telegram.org/bots/api#botcommandscopeallprivatechats
Represents the
scopeof bot commands, covering all private chats.
- class apitele.types.BotCommandScopeChat(chat_id)[source]¶
https://core.telegram.org/bots/api#botcommandscopechat
Represents the
scopeof bot commands, covering a specific chat.- Parameters:
chat_id (
intorstr) – Unique identifier for the target chat or username of the target supergroup (in the format@supergroupusername).
- class apitele.types.BotCommandScopeChatAdministrators(chat_id)[source]¶
https://core.telegram.org/bots/api#botcommandscopechatadministrators
Represents the
scopeof bot commands, covering all administrators of a specific group or supergroup chat.- Parameters:
chat_id (
intorstr) – Unique identifier for the target chat or username of the target supergroup (in the format@supergroupusername).
- class apitele.types.BotCommandScopeChatMember(chat_id, user_id)[source]¶
https://core.telegram.org/bots/api#botcommandscopechatmember
Represents the
scopeof bot commands, covering a specific member of a group or supergroup chat.- Parameters:
chat_id (
intorstr) – Unique identifier for the target chat or username of the target supergroup (in the format@supergroupusername).user_id (
int) – Unique identifier of the target user.
- class apitele.types.BotCommandScopeDefault[source]¶
https://core.telegram.org/bots/api#botcommandscopedefault
Represents the default
scopeof bot commands. Default commands are used if no commands with a narrower scope are specified for the user.
- class apitele.types.BotDescription(description)[source]¶
https://core.telegram.org/bots/api#botdescription
This object represents the bot’s description.
- Parameters:
description (
str) – The bot’s description.
- class apitele.types.BotName(name)[source]¶
https://core.telegram.org/bots/api#botname
This object represents the bot’s name.
- Parameters:
name (
str) – The bot’s name.
- class apitele.types.BotShortDescription(short_description)[source]¶
https://core.telegram.org/bots/api#botshortdescription
This object represents the bot’s short description.
- Parameters:
short_description (
str) – The bot’s short description.
- class apitele.types.BusinessBotRights(can_reply=None, can_read_messages=None, can_delete_sent_messages=None, can_delete_all_messages=None, can_edit_name=None, can_edit_bio=None, can_edit_profile_photo=None, can_edit_username=None, can_change_gift_settings=None, can_view_gifts_and_stars=None, can_convert_gifts_to_stars=None, can_transfer_and_upgrade_gifts=None, can_transfer_stars=None, can_manage_stories=None)[source]¶
https://core.telegram.org/bots/api#businessbotrights
Represents the rights of a business bot.
- Parameters:
can_reply (
True, optional) –True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours.can_read_messages (
True, optional) –True, if the bot can mark incoming private messages as read.can_delete_sent_messages (
True, optional) –True, if the bot can delete messages sent by the bot.can_delete_all_messages (
True, optional) –True, if the bot can delete all private messages in managed chats.can_edit_name (
True, optional) –True, if the bot can edit the first and last name of the business account.can_edit_bio (
True, optional) –True, if the bot can edit the bio of the business account.can_edit_profile_photo (
True, optional) –True, if the bot can edit the profile photo of the business account.can_edit_username (
True, optional) –True, if the bot can edit the username of the business account.can_change_gift_settings (
True, optional) –True, if the bot can change the privacy settings pertaining to gifts for the business account.can_view_gifts_and_stars (
True, optional) –True, if the bot can view gifts and the amount of Telegram Stars owned by the business account.can_convert_gifts_to_stars (
True, optional) –True, if the bot can convert regular gifts owned by the business account to Telegram Stars.can_transfer_and_upgrade_gifts (
True, optional) –True, if the bot can transfer and upgrade gifts owned by the business account.can_transfer_stars (
True, optional) –True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts.can_manage_stories (
True, optional) –True, if the bot can post, edit and delete stories on behalf of the business account.
- class apitele.types.BusinessConnection(id, user, user_chat_id, date, is_enabled, rights=None)[source]¶
https://core.telegram.org/bots/api#businessconnection
Describes the connection of the bot with a business account.
- Parameters:
id (
str) – Unique identifier of the business connection.user (
User) – Business account user that created the business connection.user_chat_id (
int) – Identifier of a private chat with the user who created the business connection. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.date (
int) – Date the connection was established in Unix time.is_enabled (
bool) –True, if the connection is active.rights (
BusinessBotRights, optional) – Rights of the business bot.
- class apitele.types.BusinessIntro(title=None, message=None, sticker=None)[source]¶
https://core.telegram.org/bots/api#businessintro
- Parameters:
title (
str, optional) – Title text of the business intro.message (
str, optional) – Message text of the business intro.sticker (
Sticker, optional) – Sticker of the business intro.
- class apitele.types.BusinessLocation(address, location=None)[source]¶
https://core.telegram.org/bots/api#businesslocation
- Parameters:
address (
str) – Address of the business.location (
Location, optional) – Location of the business.
- class apitele.types.BusinessMessagesDeleted(business_connection_id, chat, message_ids)[source]¶
https://core.telegram.org/bots/api#businessmessagesdeleted
This object is received when messages are deleted from a connected business account.
- Parameters:
business_connection_id (
str) – Unique identifier of the business connection.chat (
Chat) – Information about a chat in the business account. The bot may not have access to the chat or the corresponding user.message_ids (
listofint) – A JSON-serialized list of identifiers of deleted messages in the chat of the business account.
- class apitele.types.BusinessOpeningHours(time_zone_name, opening_hours)[source]¶
https://core.telegram.org/bots/api#businessopeninghours
- Parameters:
time_zone_name (
str) – Unique name of the time zone for which the opening hours are defined.opening_hours (
listofBusinessOpeningHoursInterval) – List of time intervals describing business opening hours.
- class apitele.types.BusinessOpeningHoursInterval(opening_minute, closing_minute)[source]¶
https://core.telegram.org/bots/api#businessopeninghoursinterval
- Parameters:
opening_minute (
int) – The minute’s sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60.closing_minute (
int) – The minute’s sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60.
- class apitele.types.CallbackGame[source]¶
https://core.telegram.org/bots/api#callbackgame
A placeholder, currently holds no information. Use BotFather to set up your game.
- class apitele.types.CallbackQuery(id, from_user, chat_instance, message=None, inline_message_id=None, data=None, game_short_name=None)[source]¶
https://core.telegram.org/bots/api#callbackquery
This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
- Parameters:
id (
str) – Unique identifier for this query.from_user (
User) – Sender.chat_instance (
str) – Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.message (
MaybeInaccessibleMessage, optional) – Message sent by the bot with the callback button that originated the query.inline_message_id (
str, optional) – Identifier of the message sent via the bot in inline mode, that originated the query.data (
str, optional) – Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data.game_short_name (
str, optional) – Short name of a Game to be returned, serves as the unique identifier for the game.
- class apitele.types.Chat(id, type, title=None, username=None, first_name=None, last_name=None, is_forum=None, is_direct_messages=None)[source]¶
https://core.telegram.org/bots/api#chat
This object represents a chat.
- Parameters:
id (
int) – Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.type (
str) – Type of chat, can be either “private”, “group”, “supergroup” or “channel”.title (
str, optional) – Title, for supergroups, channels and group chats.username (
str, optional) – Username, for private chats, supergroups and channels if available.first_name (
str, optional) – First name of the other party in a private chat.last_name (
str, optional) – Last name of the other party in a private chat.is_forum (
True, optional) –True, if the supergroup chat is a forum (has topics enabled).is_direct_messages (
True, optional) –True, if the chat is the direct messages chat of a channel.
- class apitele.types.ChatAdministratorRights(is_anonymous, can_manage_chat, can_delete_messages, can_manage_video_chats, can_restrict_members, can_promote_members, can_change_info, can_invite_users, can_post_stories, can_edit_stories, can_delete_stories, can_post_messages=None, can_edit_messages=None, can_pin_messages=None, can_manage_topics=None, can_manage_direct_messages=None)[source]¶
https://core.telegram.org/bots/api#chatadministratorrights
Represents the rights of an administrator in a chat.
- Parameters:
is_anonymous (
bool) –True, if the user’s presence in the chat is hidden.can_manage_chat (
bool) –True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege.can_delete_messages (
bool) –True, if the administrator can delete messages of other users.can_manage_video_chats (
bool) –True, if the administrator can manage video chats.can_restrict_members (
bool) –True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics.can_promote_members (
bool) –True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user).can_change_info (
bool) –True, if the user is allowed to change the chat title, photo and other settings.can_invite_users (
bool) –True, if the user is allowed to invite new users to the chat.can_post_stories (
bool) –True, if the administrator can post stories to the chat.can_edit_stories (
bool) –True, if the administrator can edit stories posted by other users.can_delete_stories (
bool) –True, if the administrator can delete stories posted by other users.can_post_messages (
bool, optional) –True, if the administrator can post messages in the channel, or access channel statistics; for channels only.can_edit_messages (
bool, optional) –True, if the administrator can edit messages of other users and can pin messages; for channels only.can_pin_messages (
bool, optional) –True, if the user is allowed to pin messages; for groups and supergroups only.can_manage_topics (
bool, optional) –True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only.can_manage_direct_messages (
bool, optional) –True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only.
- class apitele.types.ChatBackground(type)[source]¶
https://core.telegram.org/bots/api#chatbackground
This object represents a chat background.
- Parameters:
type (
BackgroundType) – Type of the background.
- class apitele.types.ChatBoost(boost_id, add_date, expiration_date, source)[source]¶
https://core.telegram.org/bots/api#chatboost
This object contains information about a chat boost.
- Parameters:
boost_id (
str) – Unique identifier of the boost.add_date (
int) – Point in time (Unix timestamp) when the chat was boosted.expiration_date (
int) – Point in time (Unix timestamp) when the boost will automatically expire, unless the booster’s Telegram Premium subscription is prolonged.source (
ChatBoostSource) – Source of the added boost.
- class apitele.types.ChatBoostAdded(boost_count)[source]¶
https://core.telegram.org/bots/api#chatboostadded
This object represents a service message about a user boosting a chat.
- Parameters:
boost_count (
int) – Number of boosts added by the user.
- class apitele.types.ChatBoostRemoved(chat, boost_id, remove_date, source)[source]¶
https://core.telegram.org/bots/api#chatboostremoved
This object represents a boost removed from a chat.
- Parameters:
chat (
Chat) – Chat which was boosted.boost_id (
str) – Unique identifier of the boost.remove_date (
int) – Point in time (Unix timestamp) when the boost was removed.source (
ChatBoostSource) – Source of the removed boost.
- apitele.types.ChatBoostSource¶
https://core.telegram.org/bots/api#chatboostsource
This object describes the source of a chat boost. It can be one of:
alias of
ChatBoostSourcePremium|ChatBoostSourceGiftCode|ChatBoostSourceGiveaway
- class apitele.types.ChatBoostSourceGiftCode(user)[source]¶
https://core.telegram.org/bots/api#chatboostsourcegiftcode
The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
- Parameters:
user (
User) – User for which the gift code was created.
- class apitele.types.ChatBoostSourceGiveaway(giveaway_message_id, user=None, prize_star_count=None, is_unclaimed=None)[source]¶
https://core.telegram.org/bots/api#chatboostsourcegiveaway
The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.
- Parameters:
giveaway_message_id (
int) – Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn’t sent yet.user (
User, optional) – User that won the prize in the giveaway if any.prize_star_count (
int, optional) – The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only.is_unclaimed (
True, optional) –True, if the giveaway was completed, but there was no user to win the prize.
- class apitele.types.ChatBoostSourcePremium(user)[source]¶
https://core.telegram.org/bots/api#chatboostsourcepremium
The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.
- Parameters:
user (
User) – User that boosted the chat.
- class apitele.types.ChatBoostUpdated(chat, boost)[source]¶
https://core.telegram.org/bots/api#chatboostupdated
This object represents a boost added to a chat or changed.
- class apitele.types.ChatFullInfo(id, type, accent_color_id, max_reaction_count, accepted_gift_types, title=None, username=None, first_name=None, last_name=None, is_forum=None, is_direct_messages=None, photo=None, active_usernames=None, birthdate=None, business_intro=None, business_location=None, business_opening_hours=None, personal_chat=None, parent_chat=None, available_reactions=None, background_custom_emoji_id=None, profile_accent_color_id=None, profile_background_custom_emoji_id=None, emoji_status_custom_emoji_id=None, emoji_status_expiration_date=None, bio=None, has_private_forwards=None, has_restricted_voice_and_video_messages=None, join_to_send_messages=None, join_by_request=None, description=None, invite_link=None, pinned_message=None, permissions=None, can_send_paid_media=None, slow_mode_delay=None, unrestrict_boost_count=None, message_auto_delete_time=None, has_aggressive_anti_spam_enabled=None, has_hidden_members=None, has_protected_content=None, has_visible_history=None, sticker_set_name=None, can_set_sticker_set=None, custom_emoji_sticker_set_name=None, linked_chat_id=None, location=None)[source]¶
https://core.telegram.org/bots/api#chatfullinfo
This object contains full information about a chat.
- Parameters:
id (
int) – Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.type (
str) – Type of the chat, can be either “private”, “group”, “supergroup” or “channel”.accent_color_id (
int) – Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details.max_reaction_count (
int) – The maximum number of reactions that can be set on a message in the chat.accepted_gift_types (
AcceptedGiftTypes) – Information about types of gifts that are accepted by the chat or by the corresponding user for private chats.title (
str, optional) – Title, for supergroups, channels and group chats.username (
str, optional) – Username, for private chats, supergroups and channels if available.first_name (
str, optional) – First name of the other party in a private chat.last_name (
str, optional) – Last name of the other party in a private chat.is_forum (
True, optional) –True, if the supergroup chat is a forum (has topics enabled).is_direct_messages (
True, optional) –True, if the chat is the direct messages chat of a channel.photo (
ChatPhoto, optional) – Chat photo.active_usernames (
listofstr, optional) – If non-empty, the list of all active chat usernames; for private chats, supergroups and channels.birthdate (
Birthdate, optional) – For private chats, the date of birth of the user.business_intro (
BusinessIntro, optional) – For private chats with business accounts, the intro of the business.business_location (
BusinessLocation, optional) – For private chats with business accounts, the location of the business.business_opening_hours (
BusinessOpeningHours, optional) – For private chats with business accounts, the opening hours of the business.personal_chat (
Chat, optional) – For private chats, the personal channel of the user.parent_chat (
Chat, optional) – Information about the corresponding channel chat; for direct messages chats only.available_reactions (
listofReactionType, optional) – List of available reactions allowed in the chat. If omitted, then allemoji reactionsare allowed.background_custom_emoji_id (
str, optional) – Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background.profile_accent_color_id (
int, optional) – Identifier of the accent color for the chat’s profile background. See profile accent colors for more details.profile_background_custom_emoji_id (
str, optional) – Custom emoji identifier of the emoji chosen by the chat for its profile background.emoji_status_custom_emoji_id (
str, optional) – Custom emoji identifier of the emoji status of the chat or the other party in a private chat.emoji_status_expiration_date (
int, optional) – Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any.bio (
str, optional) – Bio of the other party in a private chat.has_private_forwards (
True, optional) –True, if privacy settings of the other party in the private chat allows to usetg://user?id=<user_id>links only in chats with the user.has_restricted_voice_and_video_messages (
True, optional) –True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat.join_to_send_messages (
True, optional) –True, if users need to join the supergroup before they can send messages.join_by_request (
True, optional) –True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators.description (
str, optional) – Description, for groups, supergroups and channel chats.invite_link (
str, optional) – Primary invite link, for groups, supergroups and channel chats.pinned_message (
Message, optional) – The most recent pinned message (by sending date).can_send_paid_media (
True, optional) –True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.permissions (
ChatPermissions, optional) – Default chat member permissions, for groups and supergroups.slow_mode_delay (
int, optional) – For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds.unrestrict_boost_count (
int, optional) – For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions.message_auto_delete_time (
int, optional) – The time after which all messages sent to the chat will be automatically deleted; in seconds.has_aggressive_anti_spam_enabled (
True, optional) –True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators.has_hidden_members (
True, optional) –True, if non-administrators can only get the list of bots and administrators in the chat.has_protected_content (
True, optional) –True, if messages from the chat can’t be forwarded to other chats.has_visible_history (
True, optional) –True, if new chat members will have access to old messages; available only to chat administrators.sticker_set_name (
str, optional) – For supergroups, name of the group sticker set.can_set_sticker_set (
True, optional) –True, if the bot can change the group sticker set.custom_emoji_sticker_set_name (
str, optional) – For supergroups, the name of the group’s custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.linked_chat_id (
int, optional) – Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.location (
ChatLocation, optional) – For supergroups, the location to which the supergroup is connected.
- class apitele.types.ChatInviteLink(invite_link, creator, creates_join_request, is_primary, is_revoked, name=None, expire_date=None, member_limit=None, pending_join_request_count=None)[source]¶
https://core.telegram.org/bots/api#chatinvitelink
Represents an invite link for a chat.
- Parameters:
invite_link (
str) – The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.creator (
User) – Creator of the link.creates_join_request (
bool) –True, if users joining the chat via the link need to be approved by chat administrators.is_primary (
bool) –True, if the link is primary.is_revoked (
bool) –True, if the link is revoked.name (
str, optional) – Invite link name.expire_date (
int, optional) – Point in time (Unix timestamp) when the link will expire or has been expired.member_limit (
int, optional) – The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999.pending_join_request_count (
int, optional) – Number of pending join requests created using this link.
- class apitele.types.ChatJoinRequest(chat, from_user, user_chat_id, date, bio=None, invite_link=None)[source]¶
https://core.telegram.org/bots/api#chatjoinrequest
Represents a join request sent to a chat.
- Parameters:
chat (
Chat) – Chat to which the request was sent.from_user (
User) – User that sent the join request.user_chat_id (
int) – Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.date (
int) – Date the request was sent in Unix time.bio (
str, optional) – Bio of the user.invite_link (
ChatInviteLink, optional) – Chat invite link that was used by the user to send the join request.
- class apitele.types.ChatLocation(location, address)[source]¶
https://core.telegram.org/bots/api#chatlocation
Represents a location to which a chat is connected.
- Parameters:
location (
Location) – The location to which the supergroup is connected. Can’t be a live location.address (
str) – Location address; 1-64 characters, as defined by the chat owner.
- apitele.types.ChatMember¶
https://core.telegram.org/bots/api#chatmember
This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
alias of
ChatMemberOwner|ChatMemberAdministrator|ChatMemberMember|ChatMemberRestricted|ChatMemberLeft|ChatMemberBanned
- class apitele.types.ChatMemberAdministrator(user, can_be_edited, is_anonymous, can_manage_chat, can_delete_messages, can_manage_video_chats, can_restrict_members, can_promote_members, can_change_info, can_invite_users, can_post_stories, can_edit_stories, can_delete_stories, can_post_messages=None, can_edit_messages=None, can_pin_messages=None, can_manage_topics=None, can_manage_direct_messages=None, custom_title=None)[source]¶
https://core.telegram.org/bots/api#chatmemberadministrator
Represents a
chat memberthat has some additional privileges.- Parameters:
user (
User) – Information about the user.can_be_edited (
bool) –True, if the bot is allowed to edit administrator privileges of that user.is_anonymous (
bool) –True, if the user’s presence in the chat is hidden.can_manage_chat (
bool) –True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege.can_delete_messages (
bool) –True, if the administrator can delete messages of other users.can_manage_video_chats (
bool) –True, if the administrator can manage video chats.can_restrict_members (
bool) –True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics.can_promote_members (
bool) –True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user).can_change_info (
bool) –True, if the user is allowed to change the chat title, photo and other settings.can_invite_users (
bool) –True, if the user is allowed to invite new users to the chat.can_post_stories (
bool) –True, if the administrator can post stories to the chat.can_edit_stories (
bool) –True, if the administrator can edit stories posted by other users.can_delete_stories (
bool) –True, if the administrator can delete stories posted by other users.can_post_messages (
bool, optional) –True, if the administrator can post messages in the channel, or access channel statistics; for channels only.can_edit_messages (
bool, optional) –True, if the administrator can edit messages of other users and can pin messages; for channels only.can_pin_messages (
bool, optional) –True, if the user is allowed to pin messages; for groups and supergroups only.can_manage_topics (
bool, optional) –True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only.can_manage_direct_messages (
bool, optional) –True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only.custom_title (
str, optional) – Custom title for this user.
- class apitele.types.ChatMemberBanned(user, until_date)[source]¶
https://core.telegram.org/bots/api#chatmemberbanned
Represents a
chat memberthat was banned in the chat and can’t return to the chat or view chat messages.- Parameters:
user (
User) – Information about the user.until_date (
int) – Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever.
- class apitele.types.ChatMemberLeft(user)[source]¶
https://core.telegram.org/bots/api#chatmemberleft
Represents a
chat memberthat isn’t currently a member of the chat, but may join it themselves.- Parameters:
user (
User) – Information about the user.
- class apitele.types.ChatMemberMember(user, until_date=None)[source]¶
https://core.telegram.org/bots/api#chatmembermember
Represents a
chat memberthat has no additional privileges or restrictions.- Parameters:
user (
User) – Information about the user.until_date (
int, optional) – Date when the user’s subscription will expire; Unix time.
- class apitele.types.ChatMemberOwner(user, is_anonymous, custom_title=None)[source]¶
https://core.telegram.org/bots/api#chatmemberowner
Represents a
chat memberthat owns the chat and has all administrator privileges.- Parameters:
user (
User) – Information about the user.is_anonymous (
bool) –True, if the user’s presence in the chat is hidden.custom_title (
str, optional) – Custom title for this user.
- class apitele.types.ChatMemberRestricted(user, is_member, can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, can_send_voice_notes, can_send_polls, can_send_other_messages, can_add_web_page_previews, can_change_info, can_invite_users, can_pin_messages, can_manage_topics, until_date)[source]¶
https://core.telegram.org/bots/api#chatmemberrestricted
Represents a
chat memberthat is under certain restrictions in the chat. Supergroups only.- Parameters:
user (
User) – Information about the user.is_member (
bool) –True, if the user is a member of the chat at the moment of the request.can_send_messages (
bool) –True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues.can_send_audios (
bool) –True, if the user is allowed to send audios.can_send_documents (
bool) –True, if the user is allowed to send documents.can_send_photos (
bool) –True, if the user is allowed to send photos.can_send_videos (
bool) –True, if the user is allowed to send videos.can_send_video_notes (
bool) –True, if the user is allowed to send video notes.can_send_voice_notes (
bool) –True, if the user is allowed to send voice notes.can_send_polls (
bool) –True, if the user is allowed to send polls.can_send_other_messages (
bool) –True, if the user is allowed to send animations, games, stickers and use inline bots.can_add_web_page_previews (
bool) –True, if the user is allowed to add web page previews to their messages.can_change_info (
bool) –True, if the user is allowed to change the chat title, photo and other settings.can_invite_users (
bool) –True, if the user is allowed to invite new users to the chat.can_pin_messages (
bool) –True, if the user is allowed to pin messages.can_manage_topics (
bool) –True, if the user is allowed to create forum topics.until_date (
int) – Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever.
- class apitele.types.ChatMemberUpdated(chat, from_user, date, old_chat_member, new_chat_member, invite_link=None, via_join_request=None, via_chat_folder_invite_link=None)[source]¶
https://core.telegram.org/bots/api#chatmemberupdated
This object represents changes in the status of a chat member.
- Parameters:
chat (
Chat) – Chat the user belongs to.from_user (
User) – Performer of the action, which resulted in the change.date (
int) – Date the change was done in Unix time.old_chat_member (
ChatMember) – Previous information about the chat member.new_chat_member (
ChatMember) – New information about the chat member.invite_link (
ChatInviteLink, optional) – Chat invite link, which was used by the user to join the chat; for joining by invite link events only.via_join_request (
bool, optional) –True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator.via_chat_folder_invite_link (
bool, optional) –True, if the user joined the chat via a chat folder invite link.
- class apitele.types.ChatPermissions(can_send_messages=None, can_send_audios=None, can_send_documents=None, can_send_photos=None, can_send_videos=None, can_send_video_notes=None, can_send_voice_notes=None, can_send_polls=None, can_send_other_messages=None, can_add_web_page_previews=None, can_change_info=None, can_invite_users=None, can_pin_messages=None, can_manage_topics=None)[source]¶
https://core.telegram.org/bots/api#chatpermissions
Describes actions that a non-administrator user is allowed to take in a chat.
- Parameters:
can_send_messages (
bool, optional) –True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues.can_send_audios (
bool, optional) –True, if the user is allowed to send audios.can_send_documents (
bool, optional) –True, if the user is allowed to send documents.can_send_photos (
bool, optional) –True, if the user is allowed to send photos.can_send_videos (
bool, optional) –True, if the user is allowed to send videos.can_send_video_notes (
bool, optional) –True, if the user is allowed to send video notes.can_send_voice_notes (
bool, optional) –True, if the user is allowed to send voice notes.can_send_polls (
bool, optional) –True, if the user is allowed to send polls.can_send_other_messages (
bool, optional) –True, if the user is allowed to send animations, games, stickers and use inline bots.can_add_web_page_previews (
bool, optional) –True, if the user is allowed to add web page previews to their messages.can_change_info (
bool, optional) –True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups.can_invite_users (
bool, optional) –True, if the user is allowed to invite new users to the chat.can_pin_messages (
bool, optional) –True, if the user is allowed to pin messages. Ignored in public supergroups.can_manage_topics (
bool, optional) –True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages.
- class apitele.types.ChatPhoto(small_file_id, small_file_unique_id, big_file_id, big_file_unique_id)[source]¶
https://core.telegram.org/bots/api#chatphoto
This object represents a chat photo.
- Parameters:
small_file_id (
str) – File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.small_file_unique_id (
str) – Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.big_file_id (
str) – File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.big_file_unique_id (
str) – Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.
https://core.telegram.org/bots/api#chatshared
This object contains information about the chat whose identifier was shared with the bot using a
KeyboardButtonRequestChatbutton.- Parameters:
request_id (
int) – Identifier of the request.chat_id (
int) – Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means.title (
str, optional) – Title of the chat, if the title was requested by the bot.username (
str, optional) – Username of the chat, if the username was requested by the bot and available.photo (
listofPhotoSize, optional) – Available sizes of the chat photo, if the photo was requested by the bot.
- class apitele.types.Checklist(title, tasks, title_entities=None, others_can_add_tasks=None, others_can_mark_tasks_as_done=None)[source]¶
https://core.telegram.org/bots/api#checklist
Describes a checklist.
- Parameters:
title (
str) – Title of the checklist.tasks (
listofChecklistTask) – List of tasks in the checklist.title_entities (
listofMessageEntity, optional) – Special entities that appear in the checklist title.others_can_add_tasks (
True, optional) –True, if users other than the creator of the list can add tasks to the list.others_can_mark_tasks_as_done (
True, optional) –True, if users other than the creator of the list can mark tasks as done or not done.
- class apitele.types.ChecklistTask(id, text, text_entities=None, completed_by_user=None, completion_date=None)[source]¶
https://core.telegram.org/bots/api#checklisttask
Describes a task in a checklist.
- Parameters:
id (
int) – Unique identifier of the task.text (
str) – Text of the task.text_entities (
listofMessageEntity, optional) – Special entities that appear in the task text.completed_by_user (
User, optional) – User that completed the task; omitted if the task wasn’t completed.completion_date (
int, optional) – Point in time (Unix timestamp) when the task was completed; 0 if the task wasn’t completed.
- class apitele.types.ChecklistTasksAdded(tasks, checklist_message=None)[source]¶
https://core.telegram.org/bots/api#checklisttasksadded
Describes a service message about tasks added to a checklist.
- Parameters:
tasks (
listofChecklistTask) – List of tasks added to the checklist.checklist_message (
Message, optional) – Message containing the checklist to which the tasks were added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
- class apitele.types.ChecklistTasksDone(checklist_message=None, marked_as_done_task_ids=None, marked_as_not_done_task_ids=None)[source]¶
https://core.telegram.org/bots/api#checklisttasksdone
Describes a service message about checklist tasks marked as done or not done.
- Parameters:
checklist_message (
Message, optional) – Message containing the checklist whose tasks were marked as done or not done. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.marked_as_done_task_ids (
listofint, optional) – Identifiers of the tasks that were marked as done.marked_as_not_done_task_ids (
listofint, optional) – Identifiers of the tasks that were marked as not done.
- class apitele.types.ChosenInlineResult(result_id, from_user, query, location=None, inline_message_id=None)[source]¶
https://core.telegram.org/bots/api#choseninlineresult
Represents a
resultof an inline query that was chosen by the user and sent to their chat partner.Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates.
- Parameters:
result_id (
str) – The unique identifier for the result that was chosen.from_user (
User) – The user that chose the result.query (
str) – The query that was used to obtain the result.location (
Location, optional) – Sender location, only for bots that require user location.inline_message_id (
str, optional) – Identifier of the sent inline message. Available only if there is aninline keyboardattached to the message. Will be also received incallback queriesand can be used to edit the message.
- class apitele.types.Contact(phone_number, first_name, last_name=None, user_id=None, vcard=None)[source]¶
https://core.telegram.org/bots/api#contact
This object represents a phone contact.
- Parameters:
phone_number (
str) – Contact’s phone number.first_name (
str) – Contact’s first name.last_name (
str, optional) – Contact’s last name.user_id (
int, optional) – Contact’s user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.vcard (
str, optional) – Additional data about the contact in the form of a vCard.
- class apitele.types.CopyTextButton(text)[source]¶
https://core.telegram.org/bots/api#copytextbutton
This object represents an inline keyboard button that copies specified text to the clipboard.
- Parameters:
text (
str) – The text to be copied to the clipboard; 1-256 characters.
- class apitele.types.Dice(emoji, value)[source]¶
https://core.telegram.org/bots/api#dice
This object represents an animated emoji that displays a random value.
- Parameters:
emoji (
str) – Emoji on which the dice throw animation is based.value (
int) – Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji.
- class apitele.types.DirectMessagePriceChanged(are_direct_messages_enabled, direct_message_star_count=None)[source]¶
https://core.telegram.org/bots/api#directmessagepricechanged
Describes a service message about a change in the price of direct messages sent to a channel chat.
- Parameters:
are_direct_messages_enabled (
bool) –True, if direct messages are enabled for the channel chat;Falseotherwise.direct_message_star_count (
int, optional) – The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Does not apply to users who have been exempted by administrators. Defaults to 0.
- class apitele.types.DirectMessagesTopic(topic_id, user=None)[source]¶
https://core.telegram.org/bots/api#directmessagestopic
Describes a topic of a direct messages chat.
- Parameters:
topic_id (
int) – Unique identifier of the topic. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.user (
User, optional) – Information about the user that created the topic. Currently, it is always present.
- class apitele.types.Document(file_id, file_unique_id, thumbnail=None, file_name=None, mime_type=None, file_size=None)[source]¶
https://core.telegram.org/bots/api#document
This object represents a general file (as opposed to
photos,voice messagesandaudio files).- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.thumbnail (
PhotoSize, optional) – Document thumbnail as defined by sender.file_name (
str, optional) – Original filename as defined by sender.mime_type (
str, optional) – MIME type of the file as defined by sender.file_size (
int, optional) – File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
- class apitele.types.EncryptedCredentials(data, hash, secret)[source]¶
https://core.telegram.org/bots/api#encryptedcredentials
Describes data required for decrypting and authenticating
EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.- Parameters:
data (
str) – Base64-encoded encrypted JSON-serialized data with unique user’s payload, data hashes and secrets required forEncryptedPassportElementdecryption and authentication.hash (
str) – Base64-encoded data hash for data authentication.secret (
str) – Base64-encoded secret, encrypted with the bot’s public RSA key, required for data decryption.
- class apitele.types.EncryptedPassportElement(type, hash, data=None, phone_number=None, email=None, files=None, front_side=None, reverse_side=None, selfie=None, translation=None)[source]¶
https://core.telegram.org/bots/api#encryptedpassportelement
Describes documents or other Telegram Passport elements shared with the bot by the user.
- Parameters:
type (
str) – Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.hash (
str) – Base64-encoded element hash for using inPassportElementErrorUnspecified.data (
str, optional) – Base64-encoded encrypted Telegram Passport element data provided by the user; available only for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanyingEncryptedCredentials.phone_number (
str, optional) – User’s verified phone number; available only for “phone_number” type.email (
str, optional) – User’s verified email address; available only for “email” type.files (
listofPassportFile, optional) – Array of encrypted files with documents provided by the user; available only for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanyingEncryptedCredentials.front_side (
PassportFile, optional) – Encrypted file with the front side of the document, provided by the user; available only for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanyingEncryptedCredentials.reverse_side (
PassportFile, optional) – Encrypted file with the reverse side of the document, provided by the user; available only for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanyingEncryptedCredentials.selfie (
PassportFile, optional) – Encrypted file with the selfie of the user holding a document, provided by the user; available if requested for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanyingEncryptedCredentials.translation (
listofPassportFile, optional) – Array of encrypted files with translated versions of documents provided by the user; available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanyingEncryptedCredentials.
- class apitele.types.ExternalReplyInfo(origin, chat=None, message_id=None, link_preview_options=None, animation=None, audio=None, document=None, paid_media=None, photo=None, sticker=None, story=None, video=None, video_note=None, voice=None, has_media_spoiler=None, checklist=None, contact=None, dice=None, game=None, giveaway=None, giveaway_winners=None, invoice=None, location=None, poll=None, venue=None)[source]¶
https://core.telegram.org/bots/api#externalreplyinfo
This object contains information about a message that is being replied to, which may come from another chat or forum topic.
- Parameters:
origin (
MessageOrigin) – Origin of the message replied to by the given message.chat (
Chat, optional) – Chat the original message belongs to. Available only if the chat is a supergroup or a channel.message_id (
int, optional) – Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel.link_preview_options (
LinkPreviewOptions, optional) – Options used for link preview generation for the original message, if it is a text message.animation (
Animation, optional) – Message is an animation, information about the animation.audio (
Audio, optional) – Message is an audio file, information about the file.document (
Document, optional) – Message is a general file, information about the file.paid_media (
PaidMediaInfo, optional) – Message contains paid media; information about the paid media.photo (
listofPhotoSize, optional) – Message is a photo, available sizes of the photo.sticker (
Sticker, optional) – Message is a sticker, information about the sticker.story (
Story, optional) – Message is a forwarded story.video (
Video, optional) – Message is a video, information about the video.video_note (
VideoNote, optional) – Message is a video note, information about the video message.voice (
Voice, optional) – Message is a voice message, information about the file.has_media_spoiler (
True, optional) –True, if the message media is covered by a spoiler animation.checklist (
Checklist, optional) – Message is a checklist.contact (
Contact, optional) – Message is a shared contact, information about the contact.dice (
Dice, optional) – Message is a dice with random value.game (
Game, optional) – Message is a game, information about the game. More about games ».giveaway (
Giveaway, optional) – Message is a scheduled giveaway, information about the giveaway.giveaway_winners (
GiveawayWinners, optional) – A giveaway with public winners was completed.invoice (
Invoice, optional) – Message is an invoice for a payment, information about the invoice. More about payments ».location (
Location, optional) – Message is a shared location, information about the location.poll (
Poll, optional) – Message is a native poll, information about the poll.venue (
Venue, optional) – Message is a venue, information about the venue.
- class apitele.types.File(file_id, file_unique_id, file_size=None, file_path=None)[source]¶
https://core.telegram.org/bots/api#file
This object represents a file ready to be downloaded. The file can be downloaded via the link
https://api.telegram.org/file/bot<token>/<file_path>. 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 callingget_file().The maximum file size to download is 20 MB
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.file_size (
int, optional) – File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.file_path (
str, optional) – File path. Usehttps://api.telegram.org/file/bot<token>/<file_path>to get the file.
- class apitele.types.ForceReply(input_field_placeholder=None, selective=None)[source]¶
https://core.telegram.org/bots/api#forcereply
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot’s message and tapped ‘Reply’). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
Guide the user through a step-by-step process. ‘Please send me your question’, ‘Cool, now let’s add the first answer option’, ‘Great. Keep adding answer options, then send /done when you’re ready’.
The last option is definitely more attractive. And if you use
ForceReplyin your bot’s questions, it will receive the user’s answers even if it only receives replies, commands and mentions - without any extra work for the user.- Parameters:
input_field_placeholder (
str, optional) – The placeholder to be shown in the input field when the reply is active; 1-64 characters.selective (
bool, optional) – Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of theMessageobject; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.
- class apitele.types.ForumTopic(message_thread_id, name, icon_color, icon_custom_emoji_id=None)[source]¶
https://core.telegram.org/bots/api#forumtopic
This object represents a forum topic.
- Parameters:
message_thread_id (
int) – Unique identifier of the forum topic.name (
str) – Name of the topic.icon_color (
int) – Color of the topic icon in RGB format.icon_custom_emoji_id (
str, optional) – Unique identifier of the custom emoji shown as the topic icon.
- class apitele.types.ForumTopicClosed[source]¶
https://core.telegram.org/bots/api#forumtopicclosed
This object represents a service message about a forum topic closed in the chat. Currently holds no information.
- class apitele.types.ForumTopicCreated(name, icon_color, icon_custom_emoji_id=None)[source]¶
https://core.telegram.org/bots/api#forumtopiccreated
This object represents a service message about a new forum topic created in the chat.
- Parameters:
name (
str) – Name of the topic.icon_color (
int) – Color of the topic icon in RGB format.icon_custom_emoji_id (
str, optional) – Unique identifier of the custom emoji shown as the topic icon.
- class apitele.types.ForumTopicEdited(name=None, icon_custom_emoji_id=None)[source]¶
https://core.telegram.org/bots/api#forumtopicedited
This object represents a service message about an edited forum topic.
- Parameters:
name (
str, optional) – New name of the topic, if it was edited.icon_custom_emoji_id (
str, optional) – New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed.
- class apitele.types.ForumTopicReopened[source]¶
https://core.telegram.org/bots/api#forumtopicreopened
This object represents a service message about a forum topic reopened in the chat. Currently holds no information.
- class apitele.types.Game(title, description, photo, text=None, text_entities=None, animation=None)[source]¶
https://core.telegram.org/bots/api#game
This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
- Parameters:
title (
str) – Title of the game.description (
str) – Description of the game.photo (
listofPhotoSize) – Photo that will be displayed in the game message in chats.text (
str, optional) – Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot callsset_game_score(), or manually edited usingedit_message_text(). 0-4096 characters.text_entities (
listofMessageEntity, optional) – Special entities that appear in text, such as usernames, URLs, bot commands, etc.animation (
Animation, optional) –Animation that will be displayed in the game message in chats. Upload via BotFather.
- class apitele.types.GameHighScore(position, user, score)[source]¶
https://core.telegram.org/bots/api#gamehighscore
This object represents one row of the high scores table for a game.
- Parameters:
position (
int) – Position in high score table for the game.user (
User) – User.score (
int) – Score.
- class apitele.types.GeneralForumTopicHidden[source]¶
https://core.telegram.org/bots/api#generalforumtopichidden
This object represents a service message about General forum topic hidden in the chat. Currently holds no information.
https://core.telegram.org/bots/api#generalforumtopicunhidden
This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.
- class apitele.types.Gift(id, sticker, star_count, upgrade_star_count=None, total_count=None, remaining_count=None, publisher_chat=None)[source]¶
https://core.telegram.org/bots/api#gift
This object represents a gift that can be sent by the bot.
- Parameters:
id (
str) – Unique identifier of the gift.sticker (
Sticker) – The sticker that represents the gift.star_count (
int) – The number of Telegram Stars that must be paid to send the sticker.upgrade_star_count (
int, optional) – The number of Telegram Stars that must be paid to upgrade the gift to a unique one.total_count (
int, optional) – The total number of the gifts of this type that can be sent; for limited gifts only.remaining_count (
int, optional) – The number of remaining gifts of this type that can be sent; for limited gifts only.publisher_chat (
Chat, optional) – Information about the chat that published the gift.
- class apitele.types.GiftInfo(gift, owned_gift_id=None, convert_star_count=None, prepaid_upgrade_star_count=None, can_be_upgraded=None, text=None, entities=None, is_private=None)[source]¶
https://core.telegram.org/bots/api#giftinfo
Describes a service message about a regular gift that was sent or received.
- Parameters:
gift (
Gift) – Information about the gift.owned_gift_id (
str, optional) – Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts.convert_star_count (
int, optional) – Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible.prepaid_upgrade_star_count (
int, optional) – Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift.can_be_upgraded (
True, optional) –True, if the gift can be upgraded to a unique gift.text (
str, optional) – Text of the message that was added to the gift.entities (
listofMessageEntity, optional) – Special entities that appear in the text.is_private (
True, optional) –True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them.
- class apitele.types.Gifts(gifts)[source]¶
https://core.telegram.org/bots/api#gifts
This object represent a list of gifts.
- Parameters:
gifts (
listofGift) – The list of gifts.
- class apitele.types.Giveaway(chats, winners_selection_date, winner_count, only_new_members=None, has_public_winners=None, prize_description=None, country_codes=None, prize_star_count=None, premium_subscription_month_count=None)[source]¶
https://core.telegram.org/bots/api#giveaway
This object represents a message about a scheduled giveaway.
- Parameters:
chats (
listofChat) – The list of chats which the user must join to participate in the giveaway.winners_selection_date (
int) – Point in time (Unix timestamp) when winners of the giveaway will be selected.winner_count (
int) – The number of users which are supposed to be selected as winners of the giveaway.only_new_members (
True, optional) –True, if only users who join the chats after the giveaway started should be eligible to win.has_public_winners (
True, optional) –True, if the list of giveaway winners will be visible to everyoneprize_description (
str, optional) – Description of additional giveaway prize.country_codes (
listofstr, optional) – A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.prize_star_count (
int, optional) – The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only.premium_subscription_month_count (
int, optional) – The number of months the Telegram Premium subscription won from the giveaway will be active for.
- class apitele.types.GiveawayCompleted(winner_count, unclaimed_prize_count=None, giveaway_message=None, is_star_giveaway=None)[source]¶
https://core.telegram.org/bots/api#giveawaycompleted
This object represents a service message about the completion of a giveaway without public winners.
- Parameters:
winner_count (
int) – Number of winners in the giveaway.unclaimed_prize_count (
int, optional) – Number of undistributed prizes.giveaway_message (
Message, optional) – Message with the giveaway that was completed, if it wasn’t deleted.is_star_giveaway (
True, optional) –True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.
- class apitele.types.GiveawayCreated(prize_star_count=None)[source]¶
https://core.telegram.org/bots/api#giveawaycreated
This object represents a service message about the creation of a scheduled giveaway.
- Parameters:
prize_star_count (
int, optional) – The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only.
- class apitele.types.GiveawayWinners(chat, giveaway_message_id, winners_selection_date, winner_count, winners, additional_chat_count=None, prize_star_count=None, premium_subscription_month_count=None, unclaimed_prize_count=None, only_new_members=None, was_refunded=None, prize_description=None)[source]¶
https://core.telegram.org/bots/api#giveawaywinners
This object represents a message about the completion of a giveaway with public winners.
- Parameters:
chat (
Chat) – The chat that created the giveaway.giveaway_message_id (
int) – Identifier of the message with the giveaway in the chat.winners_selection_date (
int) – Point in time (Unix timestamp) when winners of the giveaway were selected.winner_count (
int) – Total number of winners in the giveaway.winners (
listofUser) – List of up to 100 winners of the giveaway.additional_chat_count (
int, optional) – The number of other chats the user had to join in order to be eligible for the giveaway.prize_star_count (
int, optional) – The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only.premium_subscription_month_count (
int, optional) – The number of months the Telegram Premium subscription won from the giveaway will be active for.unclaimed_prize_count (
int, optional) – Number of undistributed prizes.only_new_members (
True, optional) –True, if only users who had joined the chats after the giveaway started were eligible to win.was_refunded (
True, optional) –True, if the giveaway was canceled because the payment for it was refunded.prize_description (
str, optional) – Description of additional giveaway prize.
- class apitele.types.InaccessibleMessage(chat, message_id, date)[source]¶
https://core.telegram.org/bots/api#inaccessiblemessage
This object describes a message that was deleted or is otherwise inaccessible to the bot.
- Parameters:
chat (
Chat) – Chat the message belonged to.message_id (
int) – Unique message identifier inside the chat.date (
int) – Always 0. The field can be used to differentiate regular and inaccessible messages.
- class apitele.types.InlineKeyboardButton(text, url=None, callback_data=None, web_app=None, login_url=None, switch_inline_query=None, switch_inline_query_current_chat=None, switch_inline_query_chosen_chat=None, copy_text=None, callback_game=None, pay=None)[source]¶
https://core.telegram.org/bots/api#inlinekeyboardbutton
This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
- Parameters:
text (
str) – Label text on the button.url (
str, optional) – HTTP or tg:// URL to be opened when the button is pressed. Linkstg://user?id=<user_id>can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.callback_data (
str, optional) – Data to be sent in acallback queryto the bot when button is pressed, 1-64 bytes.web_app (
WebAppInfo, optional) – Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the methodanswer_web_app_query(). Available only in private chats between a user and the bot.login_url (
LoginUrl, optional) – An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.switch_inline_query (
str, optional) – If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.switch_inline_query_current_chat (
str, optional) –If set, pressing the button will insert the bot’s username and the specified inline query in the current chat’s input field. May be empty, in which case only the bot’s username will be inserted.
This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.
switch_inline_query_chosen_chat (
SwitchInlineQueryChosenChat, optional) – If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot’s username and the specified inline query in the input field.copy_text (
CopyTextButton, optional) – Description of the button that copies the specified text to the clipboard.callback_game (
CallbackGame, optional) –Description of the game that will be launched when the user presses the button.
NOTE: This type of button must always be the first button in the first row.
pay (
bool, optional) –Specify
True, to send a Pay button.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
- class apitele.types.InlineKeyboardMarkup(inline_keyboard=None)[source]¶
https://core.telegram.org/bots/api#inlinekeyboardmarkup
This object represents an inline keyboard that appears right next to the message it belongs to.
- Parameters:
inline_keyboard (
listoflistofInlineKeyboardButton, optional) – Array of button rows, each represented by an Array ofInlineKeyboardButtonobjects.
- add(*buttons)[source]¶
Usage:
markup = InlineKeyboardMarkup() markup.add( InlineKeyboardButton('x', callback_data='x'), InlineKeyboardButton('y', callback_data='y'), InlineKeyboardButton('z', callback_data='z') ) # All the buttons added with this method will be in # the same row, you can change the row width after the # object initialization using the property setter 'row_width'.
- Parameters:
buttons (*
InlineKeyboardButton) –InlineKeyboardButtonsto add to a new row of the inline_keyboard.- Return type:
- property row_width: int¶
Usage:
markup.row_width = 2 # The inline_keyboard will be rearranged with 2 buttons for each row.
- class apitele.types.InlineQuery(id, from_user, query, offset, chat_type=None, location=None)[source]¶
https://core.telegram.org/bots/api#inlinequery
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
- Parameters:
id (
str) – Unique identifier for this query.from_user (
User) – Sender.query (
str) – Text of the query (up to 256 characters).offset (
str) – Offset of the results to be returned, can be controlled by the bot.chat_type (
str, optional) – Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat.location (
Location, optional) – Sender location, only for bots that request user location.
- apitele.types.InlineQueryResult¶
https://core.telegram.org/bots/api#inlinequeryresult
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public.
alias of
InlineQueryResultCachedAudio|InlineQueryResultCachedDocument|InlineQueryResultCachedGif|InlineQueryResultCachedMpeg4Gif|InlineQueryResultCachedPhoto|InlineQueryResultCachedSticker|InlineQueryResultCachedVideo|InlineQueryResultCachedVoice|InlineQueryResultArticle|InlineQueryResultAudio|InlineQueryResultContact|InlineQueryResultGame|InlineQueryResultDocument|InlineQueryResultGif|InlineQueryResultLocation|InlineQueryResultMpeg4Gif|InlineQueryResultPhoto|InlineQueryResultVenue|InlineQueryResultVideo|InlineQueryResultVoice
- class apitele.types.InlineQueryResultArticle(id, title, input_message_content, reply_markup=None, url=None, description=None, thumbnail_url=None, thumbnail_width=None, thumbnail_height=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultarticle
Represents a link to an article or web page.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 Bytes.title (
str) – Title of the result.input_message_content (
InputMessageContent) – Content of the message to be sent.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
url (
str, optional) – URL of the result.description (
str, optional) – Short description of the result.thumbnail_url (
str, optional) – Url of the thumbnail for the result.thumbnail_width (
int, optional) – Thumbnail width.thumbnail_height (
int, optional) – Thumbnail height.
- class apitele.types.InlineQueryResultAudio(id, audio_url, title, caption=None, parse_mode=None, caption_entities=None, performer=None, audio_duration=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultaudio
Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.audio_url (
str) – A valid URL for the audio file.title (
str) – Title.caption (
str, optional) – Caption, 0-1024 characters after entities parsing.parse_mode (
str, optional) – Mode for parsing entities in the audio caption. See formatting options for more details.caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.performer (
str, optional) – Performer.audio_duration (
int, optional) – Audio duration in seconds.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the audio.
- class apitele.types.InlineQueryResultCachedAudio(id, audio_file_id, caption=None, parse_mode=None, caption_entities=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcachedaudio
Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.audio_file_id (
str) – A valid file identifier for the audio file.caption (
str, optional) – Caption, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the audio caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the audio.
- class apitele.types.InlineQueryResultCachedDocument(id, title, document_file_id, description=None, caption=None, parse_mode=None, caption_entities=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcacheddocument
Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.title (
str) – Title for the result.document_file_id (
str) – A valid file identifier for the file.description (
str, optional) – Short description of the result.caption (
str, optional) – Caption of the document to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the document caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the file.
- class apitele.types.InlineQueryResultCachedGif(id, gif_file_id, title=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcachedgif
Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.gif_file_id (
str) – A valid file identifier for the GIF file.title (
str, optional) – Title for the result.caption (
str, optional) – Caption of the GIF file to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the GIF animation.
- class apitele.types.InlineQueryResultCachedMpeg4Gif(id, mpeg4_file_id, title=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.mpeg4_file_id (
str) – A valid file identifier for the MPEG4 file.title (
str, optional) – Title for the result.caption (
str, optional) – Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the video animation.
- class apitele.types.InlineQueryResultCachedPhoto(id, photo_file_id, title=None, description=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcachedphoto
Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.photo_file_id (
str) – A valid file identifier of the photo.title (
str, optional) – Title for the result.description (
str, optional) – Short description of the result.caption (
str, optional) – Caption of the photo to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the photo caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the photo.
- class apitele.types.InlineQueryResultCachedSticker(id, sticker_file_id, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcachedsticker
Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.sticker_file_id (
str) – A valid file identifier of the sticker.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the sticker.
- class apitele.types.InlineQueryResultCachedVideo(id, video_file_id, title, description=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcachedvideo
Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.video_file_id (
str) – A valid file identifier for the video file.title (
str) – Title for the result.description (
str, optional) – Short description of the result.caption (
str, optional) – Caption of the video to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the video caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the video.
- class apitele.types.InlineQueryResultCachedVoice(id, voice_file_id, title, caption=None, parse_mode=None, caption_entities=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcachedvoice
Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.voice_file_id (
str) – A valid file identifier for the voice message.title (
str) – Voice message title.caption (
str, optional) – Caption, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the voice message caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the voice message.
- class apitele.types.InlineQueryResultContact(id, phone_number, first_name, last_name=None, vcard=None, reply_markup=None, input_message_content=None, thumbnail_url=None, thumbnail_width=None, thumbnail_height=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultcontact
Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 Bytes.phone_number (
str) – Contact’s phone number.first_name (
str) – Contact’s first name.last_name (
str, optional) – Contact’s last name.vcard (
str, optional) –Additional data about the contact in the form of a vCard, 0-2048 bytes.
reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the contact.thumbnail_url (
str, optional) – Url of the thumbnail for the result.thumbnail_width (
int, optional) – Thumbnail width.thumbnail_height (
int, optional) – Thumbnail height.
- class apitele.types.InlineQueryResultDocument(id, title, document_url, mime_type, caption=None, parse_mode=None, caption_entities=None, description=None, reply_markup=None, input_message_content=None, thumbnail_url=None, thumbnail_width=None, thumbnail_height=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultdocument
Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.title (
str) – Title for the result.document_url (
str) – A valid URL for the file.mime_type (
str) – MIME type of the content of the file, either “application/pdf” or “application/zip”.caption (
str, optional) – Caption of the document to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the document caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.description (
str, optional) – Short description of the result.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the file.thumbnail_url (
str, optional) – URL of the thumbnail (JPEG only) for the file.thumbnail_width (
int, optional) – Thumbnail width.thumbnail_height (
int, optional) – Thumbnail height.
- class apitele.types.InlineQueryResultGame(id, game_short_name, reply_markup=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultgame
Represents a Game.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.game_short_name (
str) – Short name of the game.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
- class apitele.types.InlineQueryResultGif(id, gif_url, thumbnail_url, gif_width=None, gif_height=None, gif_duration=None, thumbnail_mime_type=None, title=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultgif
Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.gif_url (
str) – A valid URL for the GIF file. File size must not exceed 1MB.thumbnail_url (
str) – URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.gif_width (
int, optional) – Width of the GIF.gif_height (
int, optional) – Height of the GIF.gif_duration (
int, optional) – Duration of the GIF in seconds.thumbnail_mime_type (
str, optional) – MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”.title (
str, optional) – Title for the result.caption (
str, optional) – Caption of the GIF file to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the GIF animation.
- class apitele.types.InlineQueryResultLocation(id, latitude, longitude, title, horizontal_accuracy=None, live_period=None, heading=None, proximity_alert_radius=None, reply_markup=None, input_message_content=None, thumbnail_url=None, thumbnail_width=None, thumbnail_height=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultlocation
Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 Bytes.latitude (
float) – Location latitude in degrees.longitude (
float) – Location longitude in degrees.title (
str) – Location title.horizontal_accuracy (
float, optional) – The radius of uncertainty for the location, measured in meters; 0-1500.live_period (
int, optional) – Period in seconds for which the location can be updated, should be between 60 and 86400.heading (
int, optional) – For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.proximity_alert_radius (
int, optional) – For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the location.thumbnail_url (
str, optional) – Url of the thumbnail for the result.thumbnail_width (
int, optional) – Thumbnail width.thumbnail_height (
int, optional) – Thumbnail height.
- class apitele.types.InlineQueryResultMpeg4Gif(id, mpeg4_url, thumbnail_url, mpeg4_width=None, mpeg4_height=None, mpeg4_duration=None, thumbnail_mime_type=None, title=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.mpeg4_url (
str) – A valid URL for the MPEG4 file. File size must not exceed 1MB.thumbnail_url (
str) – URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.mpeg4_width (
int, optional) – Video width.mpeg4_height (
int, optional) – Video height.mpeg4_duration (
int, optional) – Video duration in seconds.thumbnail_mime_type (
str, optional) – MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”.title (
str, optional) – Title for the result.caption (
str, optional) – Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the video animation.
- class apitele.types.InlineQueryResultPhoto(id, photo_url, thumbnail_url, photo_width=None, photo_height=None, title=None, description=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultphoto
Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.photo_url (
str) – A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB.thumbnail_url (
str) – URL of the thumbnail for the photo.photo_width (
int, optional) – Width of the photo.photo_height (
int, optional) – Height of the photo.title (
str, optional) – Title for the result.description (
str, optional) – Short description of the result.caption (
str, optional) – Caption of the photo to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the photo caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the photo.
- class apitele.types.InlineQueryResultVenue(id, latitude, longitude, title, address, foursquare_id=None, foursquare_type=None, google_place_id=None, google_place_type=None, reply_markup=None, input_message_content=None, thumbnail_url=None, thumbnail_width=None, thumbnail_height=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultvenue
Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 Bytes.latitude (
float) – Latitude of the venue location in degrees.longitude (
float) – Longitude of the venue location in degrees.title (
str) – Title of the venue.address (
str) – Address of the venue.foursquare_id (
str, optional) – Foursquare identifier of the venue if known.foursquare_type (
str, optional) – Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)google_place_id (
str, optional) – Google Places identifier of the venue.google_place_type (
str, optional) – Google Places type of the venue. (See supported types.)reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the venue.thumbnail_url (
str, optional) – Url of the thumbnail for the result.thumbnail_width (
int, optional) – Thumbnail width.thumbnail_height (
int, optional) – Thumbnail height.
- class apitele.types.InlineQueryResultVideo(id, video_url, mime_type, thumbnail_url, title, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, video_width=None, video_height=None, video_duration=None, description=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultvideo
Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
If an
InlineQueryResultVideomessage contains an embedded video (e.g., YouTube), you must replace its content using input_message_content.- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.video_url (
str) – A valid URL for the embedded video player or video file.mime_type (
str) – MIME type of the content of the video URL, “text/html” or “video/mp4”.thumbnail_url (
str) – URL of the thumbnail (JPEG only) for the video.title (
str) – Title for the result.caption (
str, optional) – Caption of the video to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the video caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.video_width (
int, optional) – Video width.video_height (
int, optional) – Video height.video_duration (
int, optional) – Video duration in seconds.description (
str, optional) – Short description of the result.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the video. This field is required ifInlineQueryResultVideois used to send an HTML-page as a result (e.g., a YouTube video).
- class apitele.types.InlineQueryResultVoice(id, voice_url, title, caption=None, parse_mode=None, caption_entities=None, voice_duration=None, reply_markup=None, input_message_content=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultvoice
Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
- Parameters:
id (
str) – Unique identifier for this result, 1-64 bytes.voice_url (
str) – A valid URL for the voice recording.title (
str) – Recording title.caption (
str, optional) – Caption, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the voice message caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.voice_duration (
int, optional) – Recording duration in seconds.reply_markup (
InlineKeyboardMarkup, optional) –Inline keyboard attached to the message.
input_message_content (
InputMessageContent, optional) – Content of the message to be sent instead of the voice recording.
- class apitele.types.InlineQueryResultsButton(text, web_app=None, start_parameter=None)[source]¶
https://core.telegram.org/bots/api#inlinequeryresultsbutton
This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.
- Parameters:
text (
str) – Label text on the button.web_app (
WebAppInfo, optional) –Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.
start_parameter (
str, optional) –Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only
A-Z,a-z,0-9,_and-are allowed.Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a ‘Connect your YouTube account’ button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a
switch_inlinebutton so that the user can easily return to the chat where they wanted to use the bot’s inline capabilities.
- class apitele.types.InputChecklist(title, tasks, parse_mode=None, title_entities=None, others_can_add_tasks=None, others_can_mark_tasks_as_done=None)[source]¶
https://core.telegram.org/bots/api#inputchecklist
Describes a checklist to create.
- Parameters:
title (
str) – Title of the checklist; 1-255 characters after entities parsing.tasks (
listofInputChecklistTask) – List of 1-30 tasks in the checklist.parse_mode (
str, optional) –Mode for parsing entities in the title. See formatting options for more details.
title_entities (
listofMessageEntity, optional) – List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed.others_can_add_tasks (
bool, optional) – PassTrueif other users can add tasks to the checklist.others_can_mark_tasks_as_done (
bool, optional) – PassTrueif other users can mark tasks as done or not done in the checklist.
- class apitele.types.InputChecklistTask(id, text, parse_mode=None, text_entities=None)[source]¶
https://core.telegram.org/bots/api#inputchecklisttask
Describes a task to add to a checklist.
- Parameters:
id (
int) – Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist.text (
str) – Text of the task; 1-100 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the text. See formatting options for more details.
text_entities (
listofMessageEntity, optional) – List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed.
- class apitele.types.InputContactMessageContent(phone_number, first_name, last_name=None, vcard=None)[source]¶
https://core.telegram.org/bots/api#inputcontactmessagecontent
Represents the
contentof a contact message to be sent as the result of an inline query.- Parameters:
phone_number (
str) – Contact’s phone number.first_name (
str) – Contact’s first name.last_name (
str, optional) – Contact’s last name.vcard (
str, optional) –Additional data about the contact in the form of a vCard, 0-2048 bytes.
- class apitele.types.InputFile(path, file_name=None, hide_name=None)[source]¶
https://core.telegram.org/bots/api#inputfile
This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
Note: If file_name or hide_name are not set, then the filename will be taken from the path.
- Parameters:
path (
str) – Directory of the file.file_name (
str, optional) – Select a different filename.hide_name (
bool, optional) – Hide the filename.
- class apitele.types.InputInvoiceMessageContent(title, description, payload, currency, prices, provider_token=None, max_tip_amount=None, suggested_tip_amounts=None, provider_data=None, photo_url=None, photo_size=None, photo_width=None, photo_height=None, need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, send_phone_number_to_provider=None, send_email_to_provider=None, is_flexible=None)[source]¶
https://core.telegram.org/bots/api#inputinvoicemessagecontent
Represents the
contentof an invoice message to be sent as the result of an inline query.- Parameters:
title (
str) – Product name, 1-32 characters.description (
str) – Product description, 1-255 characters.payload (
str) – Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.currency (
str) – Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.prices (
listofLabeledPrice) –Price breakdown, a JSON-serialized list of components. (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
provider_token (
str, optional) –Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
max_tip_amount (
int, optional) –The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of
US$ 1.45passmax_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to0. Not supported for payments in Telegram Stars.suggested_tip_amounts (
listofint, optional) – A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.provider_data (
str, optional) – A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider.photo_url (
str, optional) – URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.photo_size (
int, optional) – Photo size in bytes.photo_width (
int, optional) – Photo width.photo_height (
int, optional) – Photo height.need_name (
bool, optional) –Pass
Trueif you require the user’s full name to complete the order. Ignored for payments in Telegram Stars.need_phone_number (
bool, optional) –Pass
Trueif you require the user’s phone number to complete the order. Ignored for payments in Telegram Stars.need_email (
bool, optional) –Pass
Trueif you require the user’s email address to complete the order. Ignored for payments in Telegram Stars.need_shipping_address (
bool, optional) –Pass
Trueif you require the user’s shipping address to complete the order. Ignored for payments in Telegram Stars.send_phone_number_to_provider (
bool, optional) –Pass
Trueif the user’s phone number should be sent to provider. Ignored for payments in Telegram Stars.send_email_to_provider (
bool, optional) –Pass
Trueif the user’s email address should be sent to provider. Ignored for payments in Telegram Stars.is_flexible (
bool, optional) –Pass
Trueif the final price depends on the shipping method. Ignored for payments in Telegram Stars.
- class apitele.types.InputLocationMessageContent(latitude, longitude, horizontal_accuracy=None, live_period=None, heading=None, proximity_alert_radius=None)[source]¶
https://core.telegram.org/bots/api#inputlocationmessagecontent
Represents the
contentof a location message to be sent as the result of an inline query.- Parameters:
latitude (
float) – Latitude of the location in degrees.longitude (
float) – Longitude of the location in degrees.horizontal_accuracy (
float, optional) – The radius of uncertainty for the location, measured in meters; 0-1500.live_period (
int, optional) – Period in seconds for which the location can be updated, should be between 60 and 86400.heading (
int, optional) – For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.proximity_alert_radius (
int, optional) – For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
- apitele.types.InputMedia¶
https://core.telegram.org/bots/api#inputmedia
This object represents the content of a media message to be sent. It should be one of:
alias of
InputMediaAnimation|InputMediaDocument|InputMediaAudio|InputMediaPhoto|InputMediaVideo
- class apitele.types.InputMediaAnimation(media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, width=None, height=None, duration=None, has_spoiler=None)[source]¶
https://core.telegram.org/bots/api#inputmediaanimation
Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
- Parameters:
media (
str) – File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».thumbnail (
InputFileorstr, optional) –Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
caption (
str, optional) – Caption of the animation to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the animation caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.width (
int, optional) – Animation width.height (
int, optional) – Animation height.duration (
int, optional) – Animation duration in seconds.has_spoiler (
bool, optional) – PassTrueif the animation needs to be covered with a spoiler animation.
- class apitele.types.InputMediaAudio(media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None, duration=None, performer=None, title=None)[source]¶
https://core.telegram.org/bots/api#inputmediaaudio
Represents an audio file to be treated as music to be sent.
- Parameters:
media (
str) –File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
thumbnail (
InputFileorstr, optional) –Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
caption (
str, optional) – Caption of the audio to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the audio caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.duration (
int, optional) – Duration of the audio in seconds.performer (
str, optional) – Performer of the audio.title (
str, optional) – Title of the audio.
- class apitele.types.InputMediaDocument(media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None, disable_content_type_detection=None)[source]¶
https://core.telegram.org/bots/api#inputmediadocument
Represents a general file to be sent.
- Parameters:
media (
str) –File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
thumbnail (
InputFileorstr, optional) –Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
caption (
str, optional) – Caption of the document to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the document caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.disable_content_type_detection (
bool, optional) – Disables automatic server-side content type detection for files uploaded using multipart/form-data. AlwaysTrue, if the document is sent as part of an album.
- class apitele.types.InputMediaPhoto(media, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, has_spoiler=None)[source]¶
https://core.telegram.org/bots/api#inputmediaphoto
Represents a photo to be sent.
- Parameters:
media (
str) –File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
caption (
str, optional) – Caption of the photo to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the photo caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.has_spoiler (
bool, optional) – PassTrueif the photo needs to be covered with a spoiler animation.
- class apitele.types.InputMediaVideo(media, thumbnail=None, cover=None, start_timestamp=None, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, width=None, height=None, duration=None, supports_streaming=None, has_spoiler=None)[source]¶
https://core.telegram.org/bots/api#inputmediavideo
Represents a video to be sent.
- Parameters:
media (
str) –File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
thumbnail (
InputFileorstr, optional) –Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
cover (
str, optional) –Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
start_timestamp (
int, optional) – Start timestamp for the video in the message.caption (
str, optional) – Caption of the video to be sent, 0-1024 characters after entities parsing.parse_mode (
str, optional) –Mode for parsing entities in the video caption. See formatting options for more details.
caption_entities (
listofMessageEntity, optional) – List of special entities that appear in the caption, which can be specified instead of parse_mode.show_caption_above_media (
bool, optional) – PassTrue, if the caption must be shown above the message media.width (
int, optional) – Video width.height (
int, optional) – Video height.duration (
int, optional) – Video duration in seconds.supports_streaming (
bool, optional) – PassTrueif the uploaded video is suitable for streaming.has_spoiler (
bool, optional) – PassTrueif the video needs to be covered with a spoiler animation.
- apitele.types.InputMessageContent¶
https://core.telegram.org/bots/api#inputmessagecontent
This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:
alias of
InputTextMessageContent|InputLocationMessageContent|InputVenueMessageContent|InputContactMessageContent|InputInvoiceMessageContent
- apitele.types.InputPaidMedia¶
https://core.telegram.org/bots/api#inputpaidmedia
This object describes the paid media to be sent. Currently, it can be one of:
alias of
InputPaidMediaPhoto|InputPaidMediaVideo
- class apitele.types.InputPaidMediaPhoto(media)[source]¶
https://core.telegram.org/bots/api#inputpaidmediaphoto
The paid media to send is a photo.
- Parameters:
media (
str) –File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
- class apitele.types.InputPaidMediaVideo(media, thumbnail=None, cover=None, start_timestamp=None, width=None, height=None, duration=None, supports_streaming=None)[source]¶
https://core.telegram.org/bots/api#inputpaidmediavideo
The paid media to send is a video.
- Parameters:
media (
str) –File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
thumbnail (
InputFileorstr, optional) –Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
cover (
str, optional) –Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ».
start_timestamp (
int, optional) – Start timestamp for the video in the message.width (
int, optional) – Video width.height (
int, optional) – Video height.duration (
int, optional) – Video duration in seconds.supports_streaming (
bool, optional) – PassTrueif the uploaded video is suitable for streaming.
- class apitele.types.InputPollOption(text, text_parse_mode=None, text_entities=None)[source]¶
https://core.telegram.org/bots/api#inputpolloption
This object contains information about one answer option in a poll to send.
- Parameters:
text (
str) – Option text, 1-100 characters.text_parse_mode (
str, optional) –Mode for parsing entities in the text. See formatting options for more details. Currently, only custom emoji entities are allowed.
text_entities (
listofMessageEntity, optional) – A JSON-serialized list of special entities that appear in the poll option text. It can be specified instead of text_parse_mode.
- apitele.types.InputProfilePhoto¶
https://core.telegram.org/bots/api#inputprofilephoto
This object describes a profile photo to set. Currently, it can be one of:
alias of
InputProfilePhotoStatic|InputProfilePhotoAnimated
- class apitele.types.InputProfilePhotoAnimated(animation, main_frame_timestamp=None)[source]¶
https://core.telegram.org/bots/api#inputprofilephotoanimated
An animated profile photo in the MPEG4 format.
- Parameters:
animation (
str) –The animated profile photo. Profile photos can’t be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
main_frame_timestamp (
float, optional) – Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0.
- class apitele.types.InputProfilePhotoStatic(photo)[source]¶
https://core.telegram.org/bots/api#inputprofilephotostatic
A static profile photo in the .JPG format.
- Parameters:
photo (
str) –The static profile photo. Profile photos can’t be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
- class apitele.types.InputSticker(sticker, format, emoji_list, mask_position=None, keywords=None)[source]¶
https://core.telegram.org/bots/api#inputsticker
This object describes a sticker to be added to a sticker set.
- Parameters:
sticker (
InputFileorstr) –The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can’t be uploaded via HTTP URL. More information on Sending Files ».
format (
str) – Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video.emoji_list (
listofstr) – List of 1-20 emoji associated with the sticker.mask_position (
MaskPosition, optional) – Position where the mask should be placed on faces. For “mask” stickers only.keywords (
listofstr, optional) – List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.
- apitele.types.InputStoryContent¶
https://core.telegram.org/bots/api#inputstorycontent
This object describes the content of a story to post. Currently, it can be one of:
alias of
InputStoryContentPhoto|InputStoryContentVideo
- class apitele.types.InputStoryContentPhoto(photo)[source]¶
https://core.telegram.org/bots/api#inputstorycontentphoto
Describes a photo to post as a story.
- Parameters:
photo (
str) –The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can’t be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
- class apitele.types.InputStoryContentVideo(video, duration=None, cover_frame_timestamp=None, is_animation=None)[source]¶
https://core.telegram.org/bots/api#inputstorycontentvideo
Describes a video to post as a story.
- Parameters:
video (
str) –The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can’t be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the video was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files ».
duration (
float, optional) – Precise duration of the video in seconds; 0-60.cover_frame_timestamp (
float, optional) – Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0.is_animation (
bool, optional) – PassTrueif the video has no sound.
- class apitele.types.InputTextMessageContent(message_text, parse_mode=None, entities=None, link_preview_options=None)[source]¶
https://core.telegram.org/bots/api#inputtextmessagecontent
Represents the
contentof a text message to be sent as the result of an inline query.- Parameters:
message_text (
str) – Text of the message to be sent, 1-4096 characters.parse_mode (
str, optional) –Mode for parsing entities in the message text. See formatting options for more details.
entities (
listofMessageEntity, optional) – List of special entities that appear in message text, which can be specified instead of parse_mode.link_preview_options (
LinkPreviewOptions, optional) – Link preview generation options for the message.
- class apitele.types.InputVenueMessageContent(latitude, longitude, title, address, foursquare_id=None, foursquare_type=None, google_place_id=None, google_place_type=None)[source]¶
https://core.telegram.org/bots/api#inputvenuemessagecontent
Represents the
contentof a venue message to be sent as the result of an inline query.- Parameters:
latitude (
float) – Latitude of the venue in degrees.longitude (
float) – Longitude of the venue in degrees.title (
str) – Name of the venue.address (
str) – Address of the venue.foursquare_id (
str, optional) – Foursquare identifier of the venue, if known.foursquare_type (
str, optional) – Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)google_place_id (
str, optional) – Google Places identifier of the venue.google_place_type (
str, optional) –Google Places type of the venue. (See supported types.)
- class apitele.types.Invoice(title, description, start_parameter, currency, total_amount)[source]¶
https://core.telegram.org/bots/api#invoice
This object contains basic information about an invoice.
- Parameters:
title (
str) – Product name.description (
str) – Product description.start_parameter (
str) – Unique bot deep-linking parameter that can be used to generate this invoice.currency (
str) – Three-letter ISO 4217 currency code.total_amount (
int) –Total price in the smallest units of the currency (integer, not float/double). For example, for a price of
US$ 1.45passamount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
- class apitele.types.KeyboardButton(text, request_users=None, request_chat=None, request_contact=None, request_location=None, request_poll=None, web_app=None)[source]¶
https://core.telegram.org/bots/api#keyboardbutton
This object represents one button of the reply keyboard. For simple text buttons,
Stringcan be used instead of this object to specify the button text. The optional fields web_app, request_users, request_chat, request_contact, request_location, and request_poll are mutually exclusive.- Parameters:
text (
str) – Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed.request_users (
KeyboardButtonRequestUsers, optional) – If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.request_chat (
KeyboardButtonRequestChat, optional) – If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only.request_contact (
bool, optional) – IfTrue, the user’s phone number will be sent as a contact when the button is pressed. Available in private chats only.request_location (
bool, optional) – IfTrue, the user’s current location will be sent when the button is pressed. Available in private chats only.request_poll (
KeyboardButtonPollType, optional) – If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.web_app (
WebAppInfo, optional) –If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only.
- class apitele.types.KeyboardButtonPollType(type=None)[source]¶
https://core.telegram.org/bots/api#keyboardbuttonpolltype
This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
- Parameters:
type (
str, optional) – If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
- class apitele.types.KeyboardButtonRequestChat(request_id, chat_is_channel, chat_is_forum=None, chat_has_username=None, chat_is_created=None, user_administrator_rights=None, bot_administrator_rights=None, bot_is_member=None, request_title=None, request_username=None, request_photo=None)[source]¶
https://core.telegram.org/bots/api#keyboardbuttonrequestchat
This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate More about requesting chats ».
- Parameters:
request_id (
int) – Signed 32-bit identifier of the request, which will be received back in theChatSharedobject. Must be unique within the message.chat_is_channel (
bool) – PassTrueto request a channel chat, passFalseto request a group or a supergroup chat.chat_is_forum (
bool, optional) – PassTrueto request a forum supergroup, passFalseto request a non-forum chat. If not specified, no additional restrictions are applied.chat_has_username (
bool, optional) – PassTrueto request a supergroup or a channel with a username, passFalseto request a chat without a username. If not specified, no additional restrictions are applied.chat_is_created (
bool, optional) – PassTrueto request a chat owned by the user. Otherwise, no additional restrictions are applied.user_administrator_rights (
ChatAdministratorRights, optional) – A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied.bot_administrator_rights (
ChatAdministratorRights, optional) – A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied.bot_is_member (
bool, optional) – PassTrueto request a chat with the bot as a member. Otherwise, no additional restrictions are applied.request_title (
bool, optional) – PassTrueto request the chat’s title.request_username (
bool, optional) – PassTrueto request the chat’s username.request_photo (
bool, optional) – PassTrueto request the chat’s photo.
- class apitele.types.KeyboardButtonRequestUsers(request_id, user_is_bot=None, user_is_premium=None, max_quantity=None, request_name=None, request_username=None, request_photo=None)[source]¶
https://core.telegram.org/bots/api#keyboardbuttonrequestusers
This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed. More about requesting users ».
- Parameters:
request_id (
int) – Signed 32-bit identifier of the request that will be received back in theUsersSharedobject. Must be unique within the message.user_is_bot (
bool, optional) – PassTrueto request bots, passFalseto request regular users. If not specified, no additional restrictions are applied.user_is_premium (
bool, optional) – PassTrueto request premium users, passFalseto request non-premium users. If not specified, no additional restrictions are applied.max_quantity (
int, optional) – The maximum number of users to be selected; 1-10. Defaults to1.request_name (
bool, optional) – PassTrueto request the users’ first and last name.request_username (
bool, optional) – PassTrueto request the users’ username.request_photo (
bool, optional) – PassTrueto request the users’ photo.
- class apitele.types.LabeledPrice(label, amount)[source]¶
https://core.telegram.org/bots/api#labeledprice
This object represents a portion of the price for goods or services.
- Parameters:
label (
str) – Portion label.amount (
int) –Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of
US$ 1.45passamount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
- class apitele.types.LinkPreviewOptions(is_disabled=None, url=None, prefer_small_media=None, prefer_large_media=None, show_above_text=None)[source]¶
https://core.telegram.org/bots/api#linkpreviewoptions
Describes the options used for link preview generation.
- Parameters:
is_disabled (
bool, optional) –True, if the link preview is disabled.url (
str, optional) – URL to use for the link preview. If empty, then the first URL found in the message text will be used.prefer_small_media (
bool, optional) –True, if the media in the link preview is supposed to be shrunk; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.prefer_large_media (
bool, optional) –True, if the media in the link preview is supposed to be enlarged; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.show_above_text (
bool, optional) –True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text.
- class apitele.types.Location(latitude, longitude, horizontal_accuracy=None, live_period=None, heading=None, proximity_alert_radius=None)[source]¶
https://core.telegram.org/bots/api#location
This object represents a point on the map.
- Parameters:
latitude (
float) – Latitude as defined by sender.longitude (
float) – Longitude as defined by sender.horizontal_accuracy (
float, optional) – The radius of uncertainty for the location, measured in meters; 0-1500.live_period (
int, optional) – Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.heading (
int, optional) – The direction in which user is moving, in degrees; 1-360. For active live locations only.proximity_alert_radius (
int, optional) – The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
- class apitele.types.LocationAddress(country_code, state=None, city=None, street=None)[source]¶
https://core.telegram.org/bots/api#locationaddress
Describes the physical address of a location.
- Parameters:
country_code (
str) – The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located.state (
str, optional) – State of the location.city (
str, optional) – City of the location.street (
str, optional) – Street address of the location.
- class apitele.types.LoginUrl(url, forward_text=None, bot_username=None, request_write_access=None)[source]¶
https://core.telegram.org/bots/api#loginurl
This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
Telegram apps support these buttons as of version 5.7.
Sample bot: @discussbot
- Parameters:
url (
str) –An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.
NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
forward_text (
str, optional) – New text of the button in forwarded messages.bot_username (
str, optional) – Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot’s username will be assumed. The url’s domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.request_write_access (
bool, optional) – PassTrueto request the permission for your bot to send messages to the user.
- class apitele.types.MaskPosition(point, x_shift, y_shift, scale)[source]¶
https://core.telegram.org/bots/api#maskposition
This object describes the position on faces where a mask should be placed by default.
- Parameters:
point (
str) – The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.x_shift (
float) – Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.y_shift (
float) – Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.scale (
float) – Mask scaling coefficient. For example, 2.0 means double size.
- apitele.types.MaybeInaccessibleMessage¶
https://core.telegram.org/bots/api#maybeinaccessiblemessage
This object describes a message that can be inaccessible to the bot. It can be one of:
alias of
Message|InaccessibleMessage
- apitele.types.MenuButton¶
https://core.telegram.org/bots/api#menubutton
This object describes the bot’s menu button in a private chat. It should be one of
If a menu button other than
MenuButtonDefaultis set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands.alias of
MenuButtonCommands|MenuButtonWebApp|MenuButtonDefault
- class apitele.types.MenuButtonCommands[source]¶
https://core.telegram.org/bots/api#menubuttoncommands
Represents a menu button, which opens the bot’s list of commands.
- class apitele.types.MenuButtonDefault[source]¶
https://core.telegram.org/bots/api#menubuttondefault
Describes that no specific value for the menu button was set.
- class apitele.types.MenuButtonWebApp(text, web_app)[source]¶
https://core.telegram.org/bots/api#menubuttonwebapp
Represents a menu button, which launches a Web App.
- Parameters:
text (
str) – Text on the button.web_app (
WebAppInfo) – Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the methodanswer_web_app_query(). Alternatively, at.melink to a Web App of the bot can be specified in the object instead of the Web App’s URL, in which case the Web App will be opened as if the user pressed the link.
- class apitele.types.Message(message_id, date, chat, message_thread_id=None, direct_messages_topic=None, from_user=None, sender_chat=None, sender_boost_count=None, sender_business_bot=None, business_connection_id=None, forward_origin=None, is_topic_message=None, is_automatic_forward=None, reply_to_message=None, external_reply=None, quote=None, reply_to_story=None, reply_to_checklist_task_id=None, via_bot=None, edit_date=None, has_protected_content=None, is_from_offline=None, is_paid_post=None, media_group_id=None, author_signature=None, paid_star_count=None, text=None, entities=None, link_preview_options=None, suggested_post_info=None, effect_id=None, animation=None, audio=None, document=None, paid_media=None, photo=None, sticker=None, story=None, video=None, video_note=None, voice=None, caption=None, caption_entities=None, show_caption_above_media=None, has_media_spoiler=None, checklist=None, contact=None, dice=None, game=None, poll=None, venue=None, location=None, new_chat_members=None, left_chat_member=None, new_chat_title=None, new_chat_photo=None, delete_chat_photo=None, group_chat_created=None, supergroup_chat_created=None, channel_chat_created=None, message_auto_delete_timer_changed=None, migrate_to_chat_id=None, migrate_from_chat_id=None, pinned_message=None, invoice=None, successful_payment=None, refunded_payment=None, users_shared=None, chat_shared=None, gift=None, unique_gift=None, connected_website=None, write_access_allowed=None, passport_data=None, proximity_alert_triggered=None, boost_added=None, chat_background_set=None, checklist_tasks_done=None, checklist_tasks_added=None, direct_message_price_changed=None, forum_topic_created=None, forum_topic_edited=None, forum_topic_closed=None, forum_topic_reopened=None, general_forum_topic_hidden=None, general_forum_topic_unhidden=None, giveaway_created=None, giveaway=None, giveaway_winners=None, giveaway_completed=None, paid_message_price_changed=None, suggested_post_approved=None, suggested_post_approval_failed=None, suggested_post_declined=None, suggested_post_paid=None, suggested_post_refunded=None, video_chat_scheduled=None, video_chat_started=None, video_chat_ended=None, video_chat_participants_invited=None, web_app_data=None, reply_markup=None)[source]¶
https://core.telegram.org/bots/api#message
This object represents a message.
- Parameters:
message_id (
int) – Unique message identifier inside this chat.date (
int) – Date the message was sent in Unix time. It is always a positive number, representing a valid date.chat (
Chat) – Chat the message belongs to.message_thread_id (
int, optional) – Unique identifier of a message thread to which the message belongs; for supergroups only.direct_messages_topic (
DirectMessagesTopic, optional) – Information about the direct messages chat topic that contains the message.from_user (
User, optional) – Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.sender_chat (
Chat, optional) – Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.sender_boost_count (
int, optional) – If the sender of the message boosted the chat, the number of boosts added by the user.sender_business_bot (
User, optional) – The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.business_connection_id (
str, optional) – Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.forward_origin (
MessageOrigin, optional) – Information about the original message for forwarded messages.is_topic_message (
True, optional) –True, if the message is sent to a forum topic.is_automatic_forward (
True, optional) –True, if the message is a channel post that was automatically forwarded to the connected discussion group.reply_to_message (
Message, optional) – For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.external_reply (
ExternalReplyInfo, optional) – Information about the message that is being replied to, which may come from another chat or forum topic.quote (
TextQuote, optional) – For replies that quote part of the original message, the quoted part of the message.reply_to_story (
Story, optional) – For replies to a story, the original story.reply_to_checklist_task_id (
int, optional) – Identifier of the specific checklist task that is being replied to.via_bot (
User, optional) – Bot through which the message was sent.edit_date (
int, optional) – Date the message was last edited in Unix time.has_protected_content (
True, optional) –True, if the message can’t be forwarded.is_from_offline (
True, optional) –True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message.is_paid_post (
True, optional) –True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can’t be edited.media_group_id (
str, optional) – The unique identifier of a media message group this message belongs to.author_signature (
str, optional) – Signature of the post author for messages in channels, or the custom title of an anonymous group administrator.paid_star_count (
int, optional) – The number of Telegram Stars that were paid by the sender of the message to send it.text (
str, optional) – For text messages, the actual UTF-8 text of the message.entities (
listofMessageEntity, optional) – For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.link_preview_options (
LinkPreviewOptions, optional) – Options used for link preview generation for the message, if it is a text message and link preview options were changed.suggested_post_info (
SuggestedPostInfo, optional) – Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can’t be edited.effect_id (
str, optional) – Unique identifier of the message effect added to the message.animation (
Animation, optional) – Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set.audio (
Audio, optional) – Message is an audio file, information about the file.document (
Document, optional) – Message is a general file, information about the file.paid_media (
PaidMediaInfo, optional) – Message contains paid media; information about the paid media.photo (
listofPhotoSize, optional) – Message is a photo, available sizes of the photo.sticker (
Sticker, optional) – Message is a sticker, information about the sticker.story (
Story, optional) – Message is a forwarded story.video (
Video, optional) – Message is a video, information about the video.video_note (
VideoNote, optional) –Message is a video note, information about the video message.
voice (
Voice, optional) – Message is a voice message, information about the file.caption (
str, optional) – Caption for the animation, audio, document, photo, video or voice.caption_entities (
listofMessageEntity, optional) – For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption.show_caption_above_media (
True, optional) –True, if the caption must be shown above the message media.has_media_spoiler (
True, optional) –True, if the message media is covered by a spoiler animation.checklist (
Checklist, optional) – Message is a checklist.contact (
Contact, optional) – Message is a shared contact, information about the contact.dice (
Dice, optional) – Message is a dice with random value.game (
Game, optional) –Message is a game, information about the game. More about games ».
poll (
Poll, optional) – Message is a native poll, information about the poll.venue (
Venue, optional) – Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set.location (
Location, optional) – Message is a shared location, information about the location.new_chat_members (
listofUser, optional) – New members that were added to the group or supergroup and information about them (the bot itself may be one of these members).left_chat_member (
User, optional) – A member was removed from the group, information about them (this member may be the bot itself).new_chat_title (
str, optional) – A chat title was changed to this value.new_chat_photo (
listofPhotoSize, optional) – A chat photo was change to this value.delete_chat_photo (
True, optional) – Service message: the chat photo was deleted.group_chat_created (
True, optional) – Service message: the group has been created.supergroup_chat_created (
True, optional) – Service message: the supergroup has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.channel_chat_created (
True, optional) – Service message: the channel has been created. This field can’t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.message_auto_delete_timer_changed (
MessageAutoDeleteTimerChanged, optional) – Service message: auto-delete timer settings changed in the chat.migrate_to_chat_id (
int, optional) – The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.migrate_from_chat_id (
int, optional) – The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.pinned_message (
MaybeInaccessibleMessage, optional) – Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.invoice (
Invoice, optional) –Message is an invoice for a payment, information about the invoice. More about payments ».
successful_payment (
SuccessfulPayment, optional) –Message is a service message about a successful payment, information about the payment. More about payments ».
refunded_payment (
RefundedPayment, optional) –Message is a service message about a refunded payment, information about the payment. More about payments ».
users_shared (
UsersShared, optional) – Service message: users were shared with the bot.chat_shared (
ChatShared, optional) – Service message: a chat was shared with the bot.gift (
GiftInfo, optional) – Service message: a regular gift was sent or received.unique_gift (
UniqueGiftInfo, optional) – Service message: a unique gift was sent or received.connected_website (
str, optional) – The domain name of the website on which the user has logged in. More about Telegram Login ».write_access_allowed (
WriteAccessAllowed, optional) – Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.passport_data (
PassportData, optional) – Telegram Passport data.proximity_alert_triggered (
ProximityAlertTriggered, optional) – Service message. A user in the chat triggered another user’s proximity alert while sharing Live Location.boost_added (
ChatBoostAdded, optional) – Service message: user boosted the chat.chat_background_set (
ChatBackground, optional) – Service message: chat background set.checklist_tasks_done (
ChecklistTasksDone, optional) – Service message: some tasks in a checklist were marked as done or not done.checklist_tasks_added (
ChecklistTasksAdded, optional) – Service message: tasks were added to a checklist.direct_message_price_changed (
DirectMessagePriceChanged, optional) – Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed.forum_topic_created (
ForumTopicCreated, optional) – Service message: forum topic created.forum_topic_edited (
ForumTopicEdited, optional) – Service message: forum topic edited.forum_topic_closed (
ForumTopicClosed, optional) – Service message: forum topic closed.forum_topic_reopened (
ForumTopicReopened, optional) – Service message: forum topic reopened.general_forum_topic_hidden (
GeneralForumTopicHidden, optional) – Service message: the ‘General’ forum topic hidden.general_forum_topic_unhidden (
GeneralForumTopicUnhidden, optional) – Service message: the ‘General’ forum topic unhidden.giveaway_created (
GiveawayCreated, optional) – Service message: a scheduled giveaway was created.giveaway (
Giveaway, optional) – The message is a scheduled giveaway message.giveaway_winners (
GiveawayWinners, optional) – A giveaway with public winners was completed.giveaway_completed (
GiveawayCompleted, optional) – Service message: a giveaway without public winners was completed.paid_message_price_changed (
PaidMessagePriceChanged, optional) – Service message: the price for paid messages has changed in the chat.suggested_post_approved (
SuggestedPostApproved, optional) – Service message: a suggested post was approved.suggested_post_approval_failed (
SuggestedPostApprovalFailed, optional) – Service message: approval of a suggested post has failed.suggested_post_declined (
SuggestedPostDeclined, optional) – Service message: a suggested post was declined.suggested_post_paid (
SuggestedPostPaid, optional) – Service message: payment for a suggested post was received.suggested_post_refunded (
SuggestedPostRefunded, optional) – Service message: payment for a suggested post was refunded.video_chat_scheduled (
VideoChatScheduled, optional) – Service message: video chat scheduled.video_chat_started (
VideoChatStarted, optional) – Service message: video chat started.video_chat_ended (
VideoChatEnded, optional) – Service message: video chat ended.video_chat_participants_invited (
VideoChatParticipantsInvited, optional) – Service message: new participants invited to a video chat.web_app_data (
WebAppData, optional) – Service message: data sent by a Web App.reply_markup (
InlineKeyboardMarkup, optional) – Inline keyboard attached to the message.login_urlbuttons are represented as ordinaryurlbuttons.
- class apitele.types.MessageAutoDeleteTimerChanged(message_auto_delete_time)[source]¶
https://core.telegram.org/bots/api#messageautodeletetimerchanged
This object represents a service message about a change in auto-delete timer settings.
- Parameters:
message_auto_delete_time (
int) – New auto-delete time for messages in the chat; in seconds.
- class apitele.types.MessageEntity(type, offset, length, url=None, user=None, language=None, custom_emoji_id=None)[source]¶
https://core.telegram.org/bots/api#messageentity
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
- Parameters:
type (
str) – Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers).offset (
int) – Offset in UTF-16 code units to the start of the entity.length (
int) –Length of the entity in UTF-16 code units.
url (
str, optional) – For “text_link” only, URL that will be opened after user taps on the text.user (
User, optional) – For “text_mention” only, the mentioned user.language (
str, optional) – For “pre” only, the programming language of the entity text.custom_emoji_id (
str, optional) – For “custom_emoji” only, unique identifier of the custom emoji. Useget_custom_emoji_stickers()to get full information about the sticker.
- class apitele.types.MessageId(message_id)[source]¶
https://core.telegram.org/bots/api#messageid
This object represents a unique message identifier.
- Parameters:
message_id (
int) – Unique message identifier.
- apitele.types.MessageOrigin¶
https://core.telegram.org/bots/api#messageorigin
This object describes the origin of a message. It can be one of:
alias of
MessageOriginUser|MessageOriginHiddenUser|MessageOriginChat|MessageOriginChannel
- class apitele.types.MessageOriginChannel(date, chat, message_id, author_signature=None)[source]¶
https://core.telegram.org/bots/api#messageoriginchannel
The message was originally sent to a channel chat.
- Parameters:
date (
int) – Date the message was sent originally in Unix time.chat (
Chat) – Channel chat to which the message was originally sent.message_id (
int) – Unique message identifier inside the chat.author_signature (
str, optional) – Signature of the original post author.
- class apitele.types.MessageOriginChat(date, sender_chat, author_signature=None)[source]¶
https://core.telegram.org/bots/api#messageoriginchat
The message was originally sent on behalf of a chat to a group chat.
- Parameters:
date (
int) – Date the message was sent originally in Unix time.sender_chat (
Chat) – Chat that sent the message originally.author_signature (
str, optional) – For messages originally sent by an anonymous chat administrator, original message author signature.
- class apitele.types.MessageOriginHiddenUser(date, sender_user_name)[source]¶
https://core.telegram.org/bots/api#messageoriginhiddenuser
The message was originally sent by an unknown user.
- Parameters:
date (
int) – Date the message was sent originally in Unix time.sender_user_name (
str) – Name of the user that sent the message originally.
- class apitele.types.MessageOriginUser(date, sender_user)[source]¶
https://core.telegram.org/bots/api#messageoriginuser
The message was originally sent by a known user.
- Parameters:
date (
int) – Date the message was sent originally in Unix time.sender_user (
User) – User that sent the message originally.
- class apitele.types.MessageReactionCountUpdated(chat, message_id, date, reactions)[source]¶
https://core.telegram.org/bots/api#messagereactioncountupdated
This object represents reaction changes on a message with anonymous reactions.
- Parameters:
chat (
Chat) – The chat containing the message.message_id (
int) – Unique message identifier inside the chat.date (
int) – Date of the change in Unix time.reactions (
listofReactionCount) – List of reactions that are present on the message.
- class apitele.types.MessageReactionUpdated(chat, message_id, date, old_reaction, new_reaction, user=None, actor_chat=None)[source]¶
https://core.telegram.org/bots/api#messagereactionupdated
This object represents a change of a reaction on a message performed by a user.
- Parameters:
chat (
Chat) – The chat containing the message the user reacted to.message_id (
int) – Unique identifier of the message inside the chat.date (
int) – Date of the change in Unix time.old_reaction (
listofReactionType) – Previous list of reaction types that were set by the user.new_reaction (
listofReactionType) – New list of reaction types that have been set by the user.user (
User, optional) – The user that changed the reaction, if the user isn’t anonymous.actor_chat (
Chat, optional) – The chat on behalf of which the reaction was changed, if the user is anonymous.
- class apitele.types.OrderInfo(name=None, phone_number=None, email=None, shipping_address=None)[source]¶
https://core.telegram.org/bots/api#orderinfo
This object represents information about an order.
- Parameters:
name (
str, optional) – User name.phone_number (
str, optional) – User’s phone number.email (
str, optional) – User email.shipping_address (
ShippingAddress, optional) – User shipping address.
- apitele.types.OwnedGift¶
https://core.telegram.org/bots/api#ownedgift
This object describes a gift received and owned by a user or a chat. Currently, it can be one of:
alias of
OwnedGiftRegular|OwnedGiftUnique
- class apitele.types.OwnedGiftRegular(gift, send_date, owned_gift_id=None, sender_user=None, text=None, entities=None, is_private=None, is_saved=None, can_be_upgraded=None, was_refunded=None, convert_star_count=None, prepaid_upgrade_star_count=None)[source]¶
https://core.telegram.org/bots/api#ownedgiftregular
Describes a regular gift owned by a user or a chat.
- Parameters:
gift (
Gift) – Information about the regular gift.send_date (
int) – Date the gift was sent in Unix time.owned_gift_id (
str, optional) – Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only.sender_user (
User, optional) – Sender of the gift if it is a known user.text (
str, optional) – Text of the message that was added to the gift.entities (
listofMessageEntity, optional) – Special entities that appear in the text.is_private (
True, optional) –True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them.is_saved (
True, optional) –True, if the gift is displayed on the account’s profile page; for gifts received on behalf of business accounts only.can_be_upgraded (
True, optional) –True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only.was_refunded (
True, optional) –True, if the gift was refunded and isn’t available anymore.convert_star_count (
int, optional) – Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars.prepaid_upgrade_star_count (
int, optional) – Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift.
- class apitele.types.OwnedGiftUnique(gift, send_date, owned_gift_id=None, sender_user=None, is_saved=None, can_be_transferred=None, transfer_star_count=None, next_transfer_date=None)[source]¶
https://core.telegram.org/bots/api#ownedgiftunique
Describes a unique gift received and owned by a user or a chat.
- Parameters:
gift (
UniqueGift) – Information about the unique gift.send_date (
int) – Date the gift was sent in Unix time.owned_gift_id (
str, optional) – Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only.sender_user (
User, optional) – Sender of the gift if it is a known user.is_saved (
True, optional) –True, if the gift is displayed on the account’s profile page; for gifts received on behalf of business accounts only.can_be_transferred (
True, optional) –True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only.transfer_star_count (
int, optional) – Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift.next_transfer_date (
int, optional) – Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now.
- class apitele.types.OwnedGifts(total_count, gifts, next_offset=None)[source]¶
https://core.telegram.org/bots/api#ownedgifts
Contains the list of gifts received and owned by a user or a chat.
- Parameters:
total_count (
int) – The total number of gifts owned by the user or the chat.gifts (
listofOwnedGift) – The list of gifts.next_offset (
str, optional) – Offset for the next request. If empty, then there are no more results.
- apitele.types.PaidMedia¶
https://core.telegram.org/bots/api#paidmedia
This object describes paid media. Currently, it can be one of:
alias of
PaidMediaPreview|PaidMediaPhoto|PaidMediaVideo
- class apitele.types.PaidMediaInfo(star_count, paid_media)[source]¶
https://core.telegram.org/bots/api#paidmediainfo
Describes the paid media added to a message.
- Parameters:
star_count (
int) – The number of Telegram Stars that must be paid to buy access to the media.paid_media (
listofPaidMedia) – Information about the paid media.
- class apitele.types.PaidMediaPhoto(photo)[source]¶
https://core.telegram.org/bots/api#paidmediaphoto
The paid media is a photo.
- Parameters:
photo (
listofPhotoSize) – The photo.
- class apitele.types.PaidMediaPreview(width, height, duration)[source]¶
https://core.telegram.org/bots/api#paidmediapreview
The paid media isn’t available before the payment.
- Parameters:
width (
int, optional) – Media width as defined by the sender.height (
int, optional) – Media height as defined by the sender.duration (
int, optional) – Duration of the media in seconds as defined by the sender.
- class apitele.types.PaidMediaPurchased(from_user, paid_media_payload)[source]¶
https://core.telegram.org/bots/api#paidmediapurchased
This object contains information about a paid media purchase.
- Parameters:
from_user (
User) – User who purchased the media.paid_media_payload (
str) – Bot-specified paid media payload.
- class apitele.types.PaidMediaVideo(video)[source]¶
https://core.telegram.org/bots/api#paidmediavideo
The paid media is a video.
- Parameters:
video (
Video) – The video.
- class apitele.types.PaidMessagePriceChanged(paid_message_star_count)[source]¶
https://core.telegram.org/bots/api#paidmessagepricechanged
Describes a service message about a change in the price of paid messages within a chat.
- Parameters:
paid_message_star_count (
int) – The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message.
- class apitele.types.PassportData(data, credentials)[source]¶
https://core.telegram.org/bots/api#passportdata
Describes Telegram Passport data shared with the bot by the user.
- Parameters:
data (
listofEncryptedPassportElement) – Array with information about documents and other Telegram Passport elements that was shared with the bot.credentials (
EncryptedCredentials) – Encrypted credentials required to decrypt the data.
- apitele.types.PassportElementError¶
https://core.telegram.org/bots/api#passportelementerror
This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
alias of
PassportElementErrorDataField|PassportElementErrorFrontSide|PassportElementErrorReverseSide|PassportElementErrorSelfie|PassportElementErrorFile|PassportElementErrorFiles|PassportElementErrorTranslationFile|PassportElementErrorTranslationFiles|PassportElementErrorUnspecified
- class apitele.types.PassportElementErrorDataField(type, field_name, data_hash, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrordatafield
Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field’s value changes.
- Parameters:
type (
str) – The section of the user’s Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”.field_name (
str) – Name of the data field which has the error.data_hash (
str) – Base64-encoded data hash.message (
str) – Error message.
- class apitele.types.PassportElementErrorFile(type, file_hash, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrorfile
Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
- Parameters:
type (
str) – The section of the user’s Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”.file_hash (
str) – Base64-encoded file hash.message (
str) – Error message.
- class apitele.types.PassportElementErrorFiles(type, file_hashes, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrorfiles
Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
- Parameters:
type (
str) – The section of the user’s Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”.file_hashes (
listofstr) – List of base64-encoded file hashes.message (
str) – Error message.
- class apitele.types.PassportElementErrorFrontSide(type, file_hash, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrorfrontside
Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.
- Parameters:
type (
str) – The section of the user’s Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”.file_hash (
str) – Base64-encoded hash of the file with the front side of the document.message (
str) – Error message.
- class apitele.types.PassportElementErrorReverseSide(type, file_hash, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrorreverseside
Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.
- Parameters:
type (
str) – The section of the user’s Telegram Passport which has the issue, one of “driver_license”, “identity_card”.file_hash (
str) – Base64-encoded hash of the file with the reverse side of the document.message (
str) – Error message.
- class apitele.types.PassportElementErrorSelfie(type, file_hash, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrorselfie
Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
- Parameters:
type (
str) – The section of the user’s Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”.file_hash (
str) – Base64-encoded hash of the file with the selfie.message (
str) – Error message.
- class apitele.types.PassportElementErrorTranslationFile(type, file_hash, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrortranslationfile
Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.
- Parameters:
type (
str) – Type of element of the user’s Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”.file_hash (
str) – Base64-encoded file hash.message (
str) – Error message.
- class apitele.types.PassportElementErrorTranslationFiles(type, file_hashes, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrortranslationfiles
Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.
- Parameters:
type (
str) – Type of element of the user’s Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”.file_hashes (
listofstr) – List of base64-encoded file hashes.message (
str) – Error message.
- class apitele.types.PassportElementErrorUnspecified(type, element_hash, message)[source]¶
https://core.telegram.org/bots/api#passportelementerrorunspecified
Represents an issue in an unspecified place. The error is considered resolved when new data is added.
- Parameters:
type (
str) – Type of element of the user’s Telegram Passport which has the issue.element_hash (
str) – Base64-encoded element hash.message (
str) – Error message.
- class apitele.types.PassportFile(file_id, file_unique_id, file_size, file_date)[source]¶
https://core.telegram.org/bots/api#passportfile
This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don’t exceed 10MB.
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.file_size (
int) – File size in bytes.file_date (
int) – Unix time when the file was uploaded.
- class apitele.types.PhotoSize(file_id, file_unique_id, width, height, file_size=None)[source]¶
https://core.telegram.org/bots/api#photosize
This object represents one size of a photo or a
file/stickerthumbnail.- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.width (
int) – Photo width.height (
int) – Photo height.file_size (
int, optional) – File size in bytes.
- class apitele.types.Poll(id, question, options, total_voter_count, is_closed, is_anonymous, type, allows_multiple_answers, question_entities=None, correct_option_id=None, explanation=None, explanation_entities=None, open_period=None, close_date=None)[source]¶
https://core.telegram.org/bots/api#poll
This object contains information about a poll.
- Parameters:
id (
str) – Unique poll identifier.question (
str) – Poll question, 1-300 characters.options (
listofPollOption) – List of poll options.total_voter_count (
int) – Total number of users that voted in the poll.is_closed (
bool) –True, if the poll is closed.is_anonymous (
bool) –True, if the poll is anonymous.type (
str) – Poll type, currently can be “regular” or “quiz”.allows_multiple_answers (
bool) –True, if the poll allows multiple answers.question_entities (
listofMessageEntity, optional) – Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions.correct_option_id (
int, optional) – 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.explanation (
str, optional) – Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters.explanation_entities (
listofMessageEntity, optional) – Special entities like usernames, URLs, bot commands, etc. that appear in the explanation.open_period (
int, optional) – Amount of time in seconds the poll will be active after creation.close_date (
int, optional) – Point in time (Unix timestamp) when the poll will be automatically closed.
- class apitele.types.PollAnswer(poll_id, option_ids, voter_chat=None, user=None)[source]¶
https://core.telegram.org/bots/api#pollanswer
This object represents an answer of a user in a non-anonymous poll.
- Parameters:
poll_id (
str) – Unique poll identifier.option_ids (
listofint) – 0-based identifiers of chosen answer options. May be empty if the vote was retracted.voter_chat (
Chat, optional) – The chat that changed the answer to the poll, if the voter is anonymous.user (
User, optional) – The user that changed the answer to the poll, if the voter isn’t anonymous.
- class apitele.types.PollOption(text, voter_count, text_entities=None)[source]¶
https://core.telegram.org/bots/api#polloption
This object contains information about one answer option in a poll.
- Parameters:
text (
str) – Option text, 1-100 characters.voter_count (
int) – Number of users that voted for this option.text_entities (
listofMessageEntity, optional) – Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts.
- class apitele.types.PreCheckoutQuery(id, from_user, currency, total_amount, invoice_payload, shipping_option_id=None, order_info=None)[source]¶
https://core.telegram.org/bots/api#precheckoutquery
This object contains information about an incoming pre-checkout query.
- Parameters:
id (
str) – Unique query identifier.from_user (
User) – User who sent the query.currency (
str) –Three-letter ISO 4217 currency code.
total_amount (
int) –Total price in the smallest units of the currency (integer, not float/double). For example, for a price of
US$ 1.45passamount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).invoice_payload (
str) – Bot specified invoice payload.shipping_option_id (
str, optional) – Identifier of the shipping option chosen by the user.order_info (
OrderInfo, optional) – Order information provided by the user.
- class apitele.types.PreparedInlineMessage(id, expiration_date)[source]¶
https://core.telegram.org/bots/api#preparedinlinemessage
Describes an inline message to be sent by a user of a Mini App.
- Parameters:
id (
str) – Unique identifier of the prepared message.expiration_date (
int) – Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used.
- class apitele.types.ProximityAlertTriggered(traveler, watcher, distance)[source]¶
https://core.telegram.org/bots/api#proximityalerttriggered
This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
- apitele.types.REPLY_MARKUP_TYPES¶
One of the following reply markups:
alias of
InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply
- class apitele.types.ReactionCount(type, total_count)[source]¶
https://core.telegram.org/bots/api#reactioncount
Represents a reaction added to a message along with the number of times it was added.
- Parameters:
type (
ReactionType) – Type of the reaction.total_count (
int) – Number of times the reaction was added.
- apitele.types.ReactionType¶
https://core.telegram.org/bots/api#reactiontype
This object describes the type of a reaction. Currently, it can be one of:
alias of
ReactionTypeEmoji|ReactionTypeCustomEmoji|ReactionTypePaid
- class apitele.types.ReactionTypeCustomEmoji(custom_emoji_id)[source]¶
https://core.telegram.org/bots/api#reactiontypecustomemoji
The reaction is based on a custom emoji.
- Parameters:
custom_emoji_id (
str) – Custom emoji identifier.
- class apitele.types.ReactionTypeEmoji(emoji)[source]¶
https://core.telegram.org/bots/api#reactiontypeemoji
The reaction is based on an emoji.
- Parameters:
emoji (
str) – Reaction emoji. Currently, it can be one of “👍”, “👎”, “❤”, “🔥”, “🥰”, “👏”, “😁”, “🤔”, “🤯”, “😱”, “🤬”, “😢”, “🎉”, “🤩”, “🤮”, “💩”, “🙏”, “👌”, “🕊”, “🤡”, “🥱”, “🥴”, “😍”, “🐳”, “❤🔥”, “🌚”, “🌭”, “💯”, “🤣”, “⚡”, “🍌”, “🏆”, “💔”, “🤨”, “😐”, “🍓”, “🍾”, “💋”, “🖕”, “😈”, “😴”, “😭”, “🤓”, “👻”, “👨💻”, “👀”, “🎃”, “🙈”, “😇”, “😨”, “🤝”, “✍”, “🤗”, “🫡”, “🎅”, “🎄”, “☃”, “💅”, “🤪”, “🗿”, “🆒”, “💘”, “🙉”, “🦄”, “😘”, “💊”, “🙊”, “😎”, “👾”, “🤷♂”, “🤷”, “🤷♀”, “😡”.
- class apitele.types.ReactionTypePaid[source]¶
https://core.telegram.org/bots/api#reactiontypepaid
The reaction is paid.
- class apitele.types.RefundedPayment(currency, total_amount, invoice_payload, telegram_payment_charge_id, provider_payment_charge_id=None)[source]¶
https://core.telegram.org/bots/api#refundedpayment
This object contains basic information about a refunded payment.
- Parameters:
currency (
str) –Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently, always “XTR”.
total_amount (
int) –Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of
US$ 1.45,total_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).invoice_payload (
str) – Bot-specified invoice payload.telegram_payment_charge_id (
str) – Telegram payment identifier.provider_payment_charge_id (
str, optional) – Provider payment identifier.
- class apitele.types.ReplyKeyboardMarkup(keyboard=None, is_persistent=None, resize_keyboard=None, one_time_keyboard=None, input_field_placeholder=None, selective=None)[source]¶
https://core.telegram.org/bots/api#replykeyboardmarkup
This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
- Parameters:
keyboard (
listoflistofKeyboardButton, optional) – Array of button rows, each represented by an Array ofKeyboardButtonobjects.is_persistent (
bool, optional) – Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults toFalse, in which case the custom keyboard can be hidden and opened with a keyboard icon.resize_keyboard (
bool, optional) – Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults toFalse, in which case the custom keyboard is always of the same height as the app’s standard keyboard.one_time_keyboard (
bool, optional) – Requests clients to hide the keyboard as soon as it’s been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults toFalse.input_field_placeholder (
str, optional) – The placeholder to be shown in the input field when the keyboard is active; 1-64 characters.selective (
bool, optional) –Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the
Messageobject; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.Example: A user requests to change the bot’s language, bot replies to the request with a keyboard to select the new language. Other users in the group don’t see the keyboard.
- add(*buttons)[source]¶
Usage:
markup = ReplyKeyboardMarkup() markup.add( KeyboardButton('x'), KeyboardButton('y'), KeyboardButton('z') ) # All the buttons added with this method will be in # the same row, you can change the row width after the # object initialization using the property setter 'row_width'.
- Parameters:
buttons (*
KeyboardButtonor *str) –KeyboardButtonsto add to a new row of the keyboard. For simple text buttons, you can pass aStringinstead of aKeyboardButtonobject to specify the button text.- Return type:
- property row_width: int¶
Usage:
markup.row_width = 2 # The keyboard will be rearranged with 2 buttons for each row.
- class apitele.types.ReplyKeyboardRemove(selective=None)[source]¶
https://core.telegram.org/bots/api#replykeyboardremove
Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see
ReplyKeyboardMarkup).- Parameters:
selective (
bool, optional) –Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the
Messageobject; 2) if the bot’s message is a reply to a message in the same chat and forum topic, sender of the original message.Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven’t voted yet.
- class apitele.types.ReplyParameters(message_id, chat_id=None, allow_sending_without_reply=None, quote=None, quote_parse_mode=None, quote_entities=None, quote_position=None, checklist_task_id=None)[source]¶
https://core.telegram.org/bots/api#replyparameters
Describes reply parameters for the message that is being sent.
- Parameters:
message_id (
int) – Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified.chat_id (
intorstr, optional) – If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format@channelusername). Not supported for messages sent on behalf of a business account.allow_sending_without_reply (
bool, optional) – PassTrueif the message should be sent even if the specified message to be replied to is not found. AlwaysFalsefor replies in another chat or forum topic. AlwaysTruefor messages sent on behalf of a business account.quote (
str, optional) – Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn’t found in the original message.quote_parse_mode (
str, optional) –Mode for parsing entities in the quote. See formatting options for more details.
quote_entities (
listofMessageEntity, optional) – A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode.quote_position (
int, optional) – Position of the quote in the original message in UTF-16 code units.checklist_task_id (
int, optional) – Identifier of the specific checklist task to be replied to.
- class apitele.types.ResponseParameters(migrate_to_chat_id=None, retry_after=None)[source]¶
https://core.telegram.org/bots/api#responseparameters
Describes why a request was unsuccessful.
- Parameters:
migrate_to_chat_id (
int, optional) – The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.retry_after (
int, optional) – In case of exceeding flood control, the number of seconds left to wait before the request can be repeated.
- apitele.types.RevenueWithdrawalState¶
https://core.telegram.org/bots/api#revenuewithdrawalstate
This object describes the state of a revenue withdrawal operation. Currently, it can be one of:
alias of
RevenueWithdrawalStatePending|RevenueWithdrawalStateSucceeded|RevenueWithdrawalStateFailed
- class apitele.types.RevenueWithdrawalStateFailed[source]¶
https://core.telegram.org/bots/api#revenuewithdrawalstatefailed
The withdrawal failed and the transaction was refunded.
- class apitele.types.RevenueWithdrawalStatePending[source]¶
https://core.telegram.org/bots/api#revenuewithdrawalstatepending
The withdrawal is in progress.
- class apitele.types.RevenueWithdrawalStateSucceeded(date, url)[source]¶
https://core.telegram.org/bots/api#revenuewithdrawalstatesucceeded
The withdrawal succeeded.
- Parameters:
date (
int) – Date the withdrawal was completed in Unix time.url (
str) – An HTTPS URL that can be used to see transaction details.
- class apitele.types.SentWebAppMessage(inline_message_id=None)[source]¶
https://core.telegram.org/bots/api#sentwebappmessage
Describes an inline message sent by a Web App on behalf of a user.
- Parameters:
inline_message_id (
str, optional) – Identifier of the sent inline message. Available only if there is aninline keyboardattached to the message.
https://core.telegram.org/bots/api#shareduser
This object contains information about a user that was shared with the bot using a
KeyboardButtonRequestUsersbutton.- Parameters:
user_id (
int) – Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.first_name (
str, optional) – First name of the user, if the name was requested by the bot.last_name (
str, optional) – Last name of the user, if the name was requested by the bot.username (
str, optional) – Username of the user, if the username was requested by the bot.photo (
listofPhotoSize, optional) – Available sizes of the chat photo, if the photo was requested by the bot.
- class apitele.types.ShippingAddress(country_code, state, city, street_line1, street_line2, post_code)[source]¶
https://core.telegram.org/bots/api#shippingaddress
This object represents a shipping address.
- Parameters:
country_code (
str) –Two-letter ISO 3166-1 alpha-2 country code.
state (
str) – State, if applicable.city (
str) – City.street_line1 (
str) – First line for the address.street_line2 (
str) – Second line for the address.post_code (
str) – Address post code.
- class apitele.types.ShippingOption(id, title, prices)[source]¶
https://core.telegram.org/bots/api#shippingoption
This object represents one shipping option.
- Parameters:
id (
str) – Shipping option identifier.title (
str) – Option title.prices (
listofLabeledPrice) – List of price portions.
- class apitele.types.ShippingQuery(id, from_user, invoice_payload, shipping_address)[source]¶
https://core.telegram.org/bots/api#shippingquery
This object contains information about an incoming shipping query.
- Parameters:
id (
str) – Unique query identifier.from_user (
User) – User who sent the query.invoice_payload (
str) – Bot specified invoice payload.shipping_address (
ShippingAddress) – User specified shipping address.
- class apitele.types.StarAmount(amount, nanostar_amount=None)[source]¶
https://core.telegram.org/bots/api#staramount
Describes an amount of Telegram Stars.
- Parameters:
amount (
int) – Integer amount of Telegram Stars, rounded to 0; can be negative.nanostar_amount (
int, optional) – The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if amount is non-positive.
- class apitele.types.StarTransaction(id, amount, date, nanostar_amount=None, source=None, receiver=None)[source]¶
https://core.telegram.org/bots/api#startransaction
Describes a Telegram Star transaction.
- Parameters:
id (
str) – Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides withSuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users.amount (
int) – Number of Telegram Stars transferred by the transaction.date (
int) – Date the transaction was created in Unix time.nanostar_amount (
int, optional) – The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999.source (
TransactionPartner, optional) – Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions.receiver (
TransactionPartner, optional) – Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions.
- class apitele.types.StarTransactions(transactions)[source]¶
https://core.telegram.org/bots/api#startransactions
Contains a list of Telegram Star transactions.
- Parameters:
transactions (
listofStarTransaction) – The list of transactions.
- class apitele.types.Sticker(file_id, file_unique_id, type, width, height, is_animated, is_video, thumbnail=None, emoji=None, set_name=None, premium_animation=None, mask_position=None, custom_emoji_id=None, needs_repainting=None, file_size=None)[source]¶
https://core.telegram.org/bots/api#sticker
This object represents a sticker.
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.type (
str) – Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.width (
int) – Sticker width.height (
int) – Sticker height.is_animated (
bool) –True, if the sticker is animated.is_video (
bool) –True, if the sticker is a video sticker.thumbnail (
PhotoSize, optional) – Sticker thumbnail in the .WEBP or .JPG format.emoji (
str, optional) – Emoji associated with the sticker.set_name (
str, optional) – Name of the sticker set to which the sticker belongs.premium_animation (
File, optional) – For premium regular stickers, premium animation for the sticker.mask_position (
MaskPosition, optional) – For mask stickers, the position where the mask should be placed.custom_emoji_id (
str, optional) – For custom emoji stickers, unique identifier of the custom emoji.needs_repainting (
True, optional) –True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places.file_size (
int, optional) – File size in bytes.
- class apitele.types.StickerSet(name, title, sticker_type, stickers, thumbnail=None)[source]¶
https://core.telegram.org/bots/api#stickerset
This object represents a sticker set.
- Parameters:
name (
str) – Sticker set name.title (
str) – Sticker set title.sticker_type (
str) – Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”.stickers (
listofSticker) – List of all set stickers.thumbnail (
PhotoSize, optional) – Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format.
- class apitele.types.Story(chat, id)[source]¶
https://core.telegram.org/bots/api#story
This object represents a story.
- Parameters:
chat (
Chat) – Chat that posted the story.id (
int) – Unique identifier for the story in the chat.
- class apitele.types.StoryArea(position, type)[source]¶
https://core.telegram.org/bots/api#storyarea
Describes a clickable area on a story media.
- Parameters:
position (
StoryAreaPosition) – Position of the area.type (
StoryAreaType) – Type of the area.
- class apitele.types.StoryAreaPosition(x_percentage, y_percentage, width_percentage, height_percentage, rotation_angle, corner_radius_percentage)[source]¶
https://core.telegram.org/bots/api#storyareaposition
Describes the position of a clickable area within a story.
- Parameters:
x_percentage (
float) – The abscissa of the area’s center, as a percentage of the media width.y_percentage (
float) – The ordinate of the area’s center, as a percentage of the media height.width_percentage (
float) – The width of the area’s rectangle, as a percentage of the media width.height_percentage (
float) – The height of the area’s rectangle, as a percentage of the media height.rotation_angle (
float) – The clockwise rotation angle of the rectangle, in degrees; 0-360.corner_radius_percentage (
float) – The radius of the rectangle corner rounding, as a percentage of the media width.
- apitele.types.StoryAreaType¶
https://core.telegram.org/bots/api#storyareatype
Describes the type of a clickable area on a story. Currently, it can be one of:
alias of
StoryAreaTypeLocation|StoryAreaTypeSuggestedReaction|StoryAreaTypeLink|StoryAreaTypeWeather|StoryAreaTypeUniqueGift
- class apitele.types.StoryAreaTypeLink(url)[source]¶
https://core.telegram.org/bots/api#storyareatypelink
Describes a story area pointing to an HTTP or tg:// link. Currently, a story can have up to 3 link areas.
- Parameters:
url (
str) – HTTP or tg:// URL to be opened when the area is clicked.
- class apitele.types.StoryAreaTypeLocation(latitude, longitude, address=None)[source]¶
https://core.telegram.org/bots/api#storyareatypelocation
Describes a story area pointing to a location. Currently, a story can have up to 10 location areas.
- Parameters:
latitude (
float) – Location latitude in degrees.longitude (
float) – Location longitude in degrees.address (
LocationAddress, optional) – Address of the location.
- class apitele.types.StoryAreaTypeSuggestedReaction(reaction_type, is_dark=None, is_flipped=None)[source]¶
https://core.telegram.org/bots/api#storyareatypesuggestedreaction
Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas.
- Parameters:
reaction_type (
ReactionType) – Type of the reaction.is_dark (
bool, optional) – PassTrueif the reaction area has a dark background.is_flipped (
bool, optional) – PassTrueif reaction area corner is flipped.
- class apitele.types.StoryAreaTypeUniqueGift(name)[source]¶
https://core.telegram.org/bots/api#storyareatypeuniquegift
Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area.
- Parameters:
name (
str) – Unique name of the gift.
- class apitele.types.StoryAreaTypeWeather(temperature, emoji, background_color)[source]¶
https://core.telegram.org/bots/api#storyareatypeweather
Describes a story area containing weather information. Currently, a story can have up to 3 weather areas.
- Parameters:
temperature (
float) – Temperature, in degree Celsius.emoji (
str) – Emoji representing the weather.background_color (
int) – A color of the area background in the ARGB format.
- class apitele.types.SuccessfulPayment(currency, total_amount, invoice_payload, telegram_payment_charge_id, provider_payment_charge_id, subscription_expiration_date=None, is_recurring=None, is_first_recurring=None, shipping_option_id=None, order_info=None)[source]¶
https://core.telegram.org/bots/api#successfulpayment
This object contains basic information about a successful payment.
- Parameters:
currency (
str) –Three-letter ISO 4217 currency code.
total_amount (
int) –Total price in the smallest units of the currency (integer, not float/double). For example, for a price of
US$ 1.45passamount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).invoice_payload (
str) – Bot specified invoice payload.telegram_payment_charge_id (
str) – Telegram payment identifier.provider_payment_charge_id (
str) – Provider payment identifier.subscription_expiration_date (
int, optional) – Expiration date of the subscription, in Unix time; for recurring payments only.is_recurring (
True, optional) –True, if the payment is a recurring payment for a subscription.is_first_recurring (
True, optional) –True, if the payment is the first payment for a subscription.shipping_option_id (
str, optional) – Identifier of the shipping option chosen by the user.order_info (
OrderInfo, optional) – Order information provided by the user.
- class apitele.types.SuggestedPostApprovalFailed(price, suggested_post_message=None)[source]¶
https://core.telegram.org/bots/api#suggestedpostapprovalfailed
Describes a service message about the failed approval of a suggested post. Currently, only caused by insufficient user funds at the time of approval.
- Parameters:
price (
SuggestedPostPrice) – Expected price of the post.suggested_post_message (
Message, optional) – Message containing the suggested post whose approval has failed. Note that theMessageobject in this field will not contain the reply_to_message field even if it itself is a reply.
- class apitele.types.SuggestedPostApproved(send_date, suggested_post_message=None, price=None)[source]¶
https://core.telegram.org/bots/api#suggestedpostapproved
Describes a service message about the approval of a suggested post.
- Parameters:
send_date (
int) – Date when the post will be published.suggested_post_message (
Message, optional) – Message containing the suggested post. Note that theMessageobject in this field will not contain the reply_to_message field even if it itself is a reply.price (
SuggestedPostPrice, optional) – Amount paid for the post.
- class apitele.types.SuggestedPostDeclined(suggested_post_message=None, comment=None)[source]¶
https://core.telegram.org/bots/api#suggestedpostdeclined
Describes a service message about the rejection of a suggested post.
- class apitele.types.SuggestedPostInfo(state, price=None, send_date=None)[source]¶
https://core.telegram.org/bots/api#suggestedpostinfo
Contains information about a suggested post.
- Parameters:
state (
str) – State of the suggested post. Currently, it can be one of “pending”, “approved”, “declined”.price (
SuggestedPostPrice, optional) – Proposed price of the post. If the field is omitted, then the post is unpaid.send_date (
int, optional) – Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it.
- class apitele.types.SuggestedPostPaid(currency, suggested_post_message=None, amount=None, star_amount=None)[source]¶
https://core.telegram.org/bots/api#suggestedpostpaid
Describes a service message about a successful payment for a suggested post.
- Parameters:
currency (
str) – Currency in which the payment was made. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins.suggested_post_message (
Message, optional) – Message containing the suggested post. Note that theMessageobject in this field will not contain the reply_to_message field even if it itself is a reply.amount (
int, optional) – The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only.star_amount (
StarAmount, optional) – The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only.
- class apitele.types.SuggestedPostParameters(price=None, send_date=None)[source]¶
https://core.telegram.org/bots/api#suggestedpostparameters
Contains parameters of a post that is being suggested by the bot.
- Parameters:
price (
SuggestedPostPrice, optional) – Proposed price for the post. If the field is omitted, then the post is unpaid.send_date (
int, optional) – Proposed send date of the post. If specified, then the date must be between 300 second and 2678400 seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user who approves it.
- class apitele.types.SuggestedPostPrice(currency, amount)[source]¶
https://core.telegram.org/bots/api#suggestedpostprice
Describes the price of a suggested post.
- Parameters:
currency (
str) – Currency in which the post will be paid. Currently, must be one of “XTR” for Telegram Stars or “TON” for toncoins.amount (
int) – The amount of the currency that will be paid for the post in the smallest units of the currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must be between 5 and 100000, and price in nanotoncoins must be between 10000000 and 10000000000000.
- class apitele.types.SuggestedPostRefunded(reason, suggested_post_message=None)[source]¶
https://core.telegram.org/bots/api#suggestedpostrefunded
Describes a service message about a payment refund for a suggested post.
- Parameters:
reason (
str) – Reason for the refund. Currently, one of “post_deleted” if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or “payment_refunded” if the payer refunded their payment.suggested_post_message (
Message, optional) – Message containing the suggested post. Note that theMessageobject in this field will not contain the reply_to_message field even if it itself is a reply.
- class apitele.types.SwitchInlineQueryChosenChat(query=None, allow_user_chats=None, allow_bot_chats=None, allow_group_chats=None, allow_channel_chats=None)[source]¶
https://core.telegram.org/bots/api#switchinlinequerychosenchat
This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
- Parameters:
query (
str, optional) – The default inline query to be inserted in the input field. If left empty, only the bot’s username will be inserted.allow_user_chats (
bool, optional) –True, if private chats with users can be chosen.allow_bot_chats (
bool, optional) –True, if private chats with bots can be chosen.allow_group_chats (
bool, optional) –True, if group and supergroup chats can be chosen.allow_channel_chats (
bool, optional) –True, if channel chats can be chosen.
- class apitele.types.TextQuote(text, position, entities=None, is_manual=None)[source]¶
https://core.telegram.org/bots/api#textquote
This object contains information about the quoted part of a message that is replied to by the given message.
- Parameters:
text (
str) – Text of the quoted part of a message that is replied to by the given message.position (
int) – Approximate quote position in the original message in UTF-16 code units as specified by the sender.entities (
listofMessageEntity, optional) – Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes.is_manual (
True, optional) –True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server.
- apitele.types.TransactionPartner¶
https://core.telegram.org/bots/api#transactionpartner
This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of:
alias of
TransactionPartnerAffiliateProgram|TransactionPartnerChat|TransactionPartnerFragment|TransactionPartnerUser|TransactionPartnerOther
- class apitele.types.TransactionPartnerAffiliateProgram(commission_per_mille, sponsor_user=None)[source]¶
https://core.telegram.org/bots/api#transactionpartneraffiliateprogram
Describes the affiliate program that issued the affiliate commission received via this transaction.
- Parameters:
commission_per_mille (
int) – The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users.sponsor_user (
User, optional) – Information about the bot that sponsored the affiliate program.
- class apitele.types.TransactionPartnerChat(chat, gift=None)[source]¶
https://core.telegram.org/bots/api#transactionpartnerchat
Describes a transaction with a chat.
- class apitele.types.TransactionPartnerFragment(withdrawal_state=None)[source]¶
https://core.telegram.org/bots/api#transactionpartnerfragment
Describes a withdrawal transaction with Fragment.
- Parameters:
withdrawal_state (
RevenueWithdrawalState, optional) – State of the transaction if the transaction is outgoing.
- class apitele.types.TransactionPartnerOther[source]¶
https://core.telegram.org/bots/api#transactionpartnerother
Describes a transaction with an unknown source or recipient.
- class apitele.types.TransactionPartnerTelegramAds[source]¶
https://core.telegram.org/bots/api#transactionpartnertelegramads
Describes a withdrawal transaction to the Telegram Ads platform.
- class apitele.types.TransactionPartnerTelegramApi(request_count)[source]¶
https://core.telegram.org/bots/api#transactionpartnertelegramapi
Describes a transaction with payment for paid broadcasting.
- Parameters:
request_count (
int) – The number of successful requests that exceeded regular limits and were therefore billed.
- class apitele.types.TransactionPartnerUser(transaction_type, user, affiliate=None, invoice_payload=None, subscription_period=None, paid_media=None, paid_media_payload=None, gift=None, premium_subscription_duration=None)[source]¶
https://core.telegram.org/bots/api#transactionpartneruser
Describes a transaction with a user.
- Parameters:
transaction_type (
str) – Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts.user (
User) – Information about the user.affiliate (
AffiliateInfo, optional) – Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions.invoice_payload (
str, optional) – Bot-specified invoice payload.subscription_period (
int, optional) – The duration of the paid subscription. Can be available only for “invoice_payment” transactions.paid_media (
listofPaidMedia, optional) – Information about the paid media bought by the user.paid_media_payload (
str, optional) – Bot-specified paid media payload.gift (
Gift, optional) – The gift sent to the user by the bot; for “gift_purchase” transactions onlypremium_subscription_duration (
int, optional) – Number of months the gifted Telegram Premium subscription will be active for; for “premium_purchase” transactions only.
- class apitele.types.UniqueGift(base_name, name, number, model, symbol, backdrop, publisher_chat=None)[source]¶
https://core.telegram.org/bots/api#uniquegift
This object describes a unique gift that was upgraded from a regular gift.
- Parameters:
base_name (
str) – Human-readable name of the regular gift from which this unique gift was upgraded.name (
str) – Unique name of the gift. This name can be used inhttps://t.me/nft/...links and story areas.number (
int) – Unique number of the upgraded gift among gifts upgraded from the same regular gift.model (
UniqueGiftModel) – Model of the gift.symbol (
UniqueGiftSymbol) – Symbol of the gift.backdrop (
UniqueGiftBackdrop) – Backdrop of the gift.publisher_chat (
Chat, optional) – Information about the chat that published the gift.
- class apitele.types.UniqueGiftBackdrop(name, colors, rarity_per_mille)[source]¶
https://core.telegram.org/bots/api#uniquegiftbackdrop
This object describes the backdrop of a unique gift.
- Parameters:
name (
str) – Name of the backdrop.colors (
UniqueGiftBackdropColors) – Colors of the backdrop.rarity_per_mille (
int) – The number of unique gifts that receive this backdrop for every 1000 gifts upgraded.
- class apitele.types.UniqueGiftBackdropColors(center_color, edge_color, symbol_color, text_color)[source]¶
https://core.telegram.org/bots/api#uniquegiftbackdropcolors
This object describes the colors of the backdrop of a unique gift.
- Parameters:
center_color (
int) – The color in the center of the backdrop in RGB format.edge_color (
int) – The color on the edges of the backdrop in RGB format.symbol_color (
int) – The color to be applied to the symbol in RGB format.text_color (
int) – The color for the text on the backdrop in RGB format.
- class apitele.types.UniqueGiftInfo(gift, origin, last_resale_star_count=None, owned_gift_id=None, transfer_star_count=None, next_transfer_date=None)[source]¶
https://core.telegram.org/bots/api#uniquegiftinfo
Describes a service message about a unique gift that was sent or received.
- Parameters:
gift (
UniqueGift) – Information about the gift.origin (
str) – Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, or “resale” for gifts bought from other users.last_resale_star_count (
int, optional) – For gifts bought from other users, the price paid for the gift.owned_gift_id (
str, optional) – Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts.transfer_star_count (
int, optional) – Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift.next_transfer_date (
int, optional) – Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now.
- class apitele.types.UniqueGiftModel(name, sticker, rarity_per_mille)[source]¶
https://core.telegram.org/bots/api#uniquegiftmodel
This object describes the model of a unique gift.
- Parameters:
name (
str) – Name of the model.sticker (
Sticker) – The sticker that represents the unique gift.rarity_per_mille (
int) – The number of unique gifts that receive this model for every 1000 gifts upgraded.
- class apitele.types.UniqueGiftSymbol(name, sticker, rarity_per_mille)[source]¶
https://core.telegram.org/bots/api#uniquegiftsymbol
This object describes the symbol shown on the pattern of a unique gift.
- Parameters:
name (
str) – Name of the symbol.sticker (
Sticker) – The sticker that represents the unique gift.rarity_per_mille (
int) – The number of unique gifts that receive this model for every 1000 gifts upgraded.
- class apitele.types.Update(update_id, message=None, edited_message=None, channel_post=None, edited_channel_post=None, business_connection=None, business_message=None, edited_business_message=None, deleted_business_messages=None, message_reaction=None, message_reaction_count=None, inline_query=None, chosen_inline_result=None, callback_query=None, shipping_query=None, pre_checkout_query=None, purchased_paid_media=None, poll=None, poll_answer=None, my_chat_member=None, chat_member=None, chat_join_request=None, chat_boost=None, removed_chat_boost=None)[source]¶
https://core.telegram.org/bots/api#update
This object represents an incoming update. At most one of the optional parameters can be present in any given update.
- Parameters:
update_id (
int) – The update’s unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you’re using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.message (
Message, optional) – New incoming message of any kind - text, photo, sticker, etc.edited_message (
Message, optional) – New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.channel_post (
Message, optional) – New incoming channel post of any kind - text, photo, sticker, etc.edited_channel_post (
Message, optional) – New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.business_connection (
BusinessConnection, optional) – The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot.business_message (
Message, optional) – New non-service message from a connected business account.edited_business_message (
Message, optional) – New version of a message from a connected business account.deleted_business_messages (
BusinessMessagesDeleted, optional) – Messages were deleted from a connected business account.message_reaction (
MessageReactionUpdated, optional) – A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify"message_reaction"in the list of allowed_updates to receive these updates. The update isn’t received for reactions set by bots.message_reaction_count (
MessageReactionCountUpdated, optional) – Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify"message_reaction_count"in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.inline_query (
InlineQuery, optional) – New incoming inline query.chosen_inline_result (
ChosenInlineResult, optional) –The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.
callback_query (
CallbackQuery, optional) – New incoming callback query.shipping_query (
ShippingQuery, optional) – New incoming shipping query. Only for invoices with flexible price.pre_checkout_query (
PreCheckoutQuery, optional) – New incoming pre-checkout query. Contains full information about checkout.purchased_paid_media (
PaidMediaPurchased, optional) – A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat.poll (
Poll, optional) – New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot.poll_answer (
PollAnswer, optional) – A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.my_chat_member (
ChatMemberUpdated, optional) – The bot’s chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.chat_member (
ChatMemberUpdated, optional) – A chat member’s status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify"chat_member"in the list of allowed_updates to receive these updates.chat_join_request (
ChatJoinRequest, optional) – A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.chat_boost (
ChatBoostUpdated, optional) – A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.removed_chat_boost (
ChatBoostRemoved, optional) – A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.
- class apitele.types.User(id, is_bot, first_name, last_name=None, username=None, language_code=None, is_premium=None, added_to_attachment_menu=None, can_join_groups=None, can_read_all_group_messages=None, supports_inline_queries=None, can_connect_to_business=None, has_main_web_app=None)[source]¶
https://core.telegram.org/bots/api#user
This object represents a Telegram user or bot.
- Parameters:
id (
int) – Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.is_bot (
bool) –True, if this user is a bot.first_name (
str) – User’s or bot’s first name.last_name (
str, optional) – User’s or bot’s last name.username (
str, optional) – User’s or bot’s username.language_code (
str, optional) – IETF language tag of the user’s language.is_premium (
True, optional) –True, if this user is a Telegram Premium user.added_to_attachment_menu (
True, optional) –True, if this user added the bot to the attachment menu.can_join_groups (
bool, optional) –True, if the bot can be invited to groups. Returned only inget_me().can_read_all_group_messages (
bool, optional) –True, if privacy mode is disabled for the bot. Returned only inget_me().supports_inline_queries (
bool, optional) –True, if the bot supports inline queries. Returned only inget_me().can_connect_to_business (
bool, optional) –True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only inget_me().has_main_web_app (
bool, optional) –True, if the bot has a main Web App. Returned only inget_me().
- class apitele.types.UserChatBoosts(boosts)[source]¶
https://core.telegram.org/bots/api#userchatboosts
This object represents a list of boosts added to a chat by a user.
- Parameters:
boosts (
listofChatBoost) – The list of boosts added to the chat by the user.
- class apitele.types.UserProfilePhotos(total_count, photos)[source]¶
https://core.telegram.org/bots/api#userprofilephotos
This object represent a user’s profile pictures.
- Parameters:
total_count (
int) – Total number of profile pictures the target user has.photos (
listoflistofPhotoSize) – Requested profile pictures (in up to 4 sizes each).
https://core.telegram.org/bots/api#usersshared
This object contains information about the users whose identifiers were shared with the bot using a
KeyboardButtonRequestUsersbutton.- Parameters:
request_id (
int) – Identifier of the request.users (
listofSharedUser) – Information about users shared with the bot.
- class apitele.types.Venue(location, title, address, foursquare_id=None, foursquare_type=None, google_place_id=None, google_place_type=None)[source]¶
https://core.telegram.org/bots/api#venue
This object represents a venue.
- Parameters:
location (
Location) – Venue location. Can’t be a live location.title (
str) – Name of the venue.address (
str) – Address of the venue.foursquare_id (
str, optional) – Foursquare identifier of the venue.foursquare_type (
str, optional) – Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)google_place_id (
str, optional) – Google Places identifier of the venue.google_place_type (
str, optional) –Google Places type of the venue. (See supported types.)
- class apitele.types.Video(file_id, file_unique_id, width, height, duration, thumbnail=None, cover=None, start_timestamp=None, file_name=None, mime_type=None, file_size=None)[source]¶
https://core.telegram.org/bots/api#video
This object represents a video file.
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.width (
int) – Video width as defined by sender.height (
int) – Video height as defined by sender.duration (
int) – Duration of the video in seconds as defined by sender.thumbnail (
PhotoSize, optional) – Video thumbnail.cover (
listofPhotoSize, optional) – Available sizes of the cover of the video in the message.start_timestamp (
int, optional) – Timestamp in seconds from which the video will play in the message.file_name (
str, optional) – Original filename as defined by sender.mime_type (
str, optional) – MIME type of the file as defined by sender.file_size (
int, optional) – File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
- class apitele.types.VideoChatEnded(duration)[source]¶
https://core.telegram.org/bots/api#videochatended
This object represents a service message about a video chat ended in the chat.
- Parameters:
duration (
int) – Video chat duration in seconds.
- class apitele.types.VideoChatParticipantsInvited(users)[source]¶
https://core.telegram.org/bots/api#videochatparticipantsinvited
This object represents a service message about new members invited to a video chat.
- Parameters:
users (
listofUser) – New members that were invited to the video chat.
- class apitele.types.VideoChatScheduled(start_date)[source]¶
https://core.telegram.org/bots/api#videochatscheduled
This object represents a service message about a video chat scheduled in the chat.
- Parameters:
start_date (
int) – Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator.
- class apitele.types.VideoChatStarted[source]¶
https://core.telegram.org/bots/api#videochatstarted
This object represents a service message about a video chat started in the chat. Currently holds no information.
- class apitele.types.VideoNote(file_id, file_unique_id, length, duration, thumbnail=None, file_size=None)[source]¶
https://core.telegram.org/bots/api#videonote
This object represents a video message (available in Telegram apps as of v.4.0).
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.length (
int) – Video width and height (diameter of the video message) as defined by sender.duration (
int) – Duration of the video in seconds as defined by sender.thumbnail (
PhotoSize, optional) – Video thumbnail.file_size (
int, optional) – File size in bytes.
- class apitele.types.Voice(file_id, file_unique_id, duration, mime_type=None, file_size=None)[source]¶
https://core.telegram.org/bots/api#voice
This object represents a voice note.
- Parameters:
file_id (
str) – Identifier for this file, which can be used to download or reuse the file.file_unique_id (
str) – Unique identifier for this file, which is supposed to be the same over time and for different bots. Can’t be used to download or reuse the file.duration (
int) – Duration of the audio in seconds as defined by sender.mime_type (
str, optional) – MIME type of the file as defined by sender.file_size (
int, optional) – File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
- class apitele.types.WebAppData(data, button_text)[source]¶
https://core.telegram.org/bots/api#webappdata
Describes data sent from a Web App to the bot.
- Parameters:
data (
str) – The data. Be aware that a bad client can send arbitrary data in this field.button_text (
str) – Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field.
- class apitele.types.WebAppInfo(url)[source]¶
https://core.telegram.org/bots/api#webappinfo
Describes a Web App.
- Parameters:
url (
str) – An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps.
- class apitele.types.WriteAccessAllowed(from_request=None, web_app_name=None, from_attachment_menu=None)[source]¶
https://core.telegram.org/bots/api#writeaccessallowed
This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.
- Parameters:
from_request (
bool, optional) –True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess.web_app_name (
str, optional) – Name of the Web App, if the access was granted when the Web App was launched from a link.from_attachment_menu (
bool, optional) –True, if the access was granted when the bot was added to the attachment or side menu.