Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

Since this class has a large number of methods and attributes, below you can find a quick overview.

Sending Messages

`send_animation()` | Used for sending animations
`send_audio()` | Used for sending audio files
`send_chat_action()` | Used for sending chat actions
`send_contact()` | Used for sending contacts
`send_dice()` | Used for sending dice messages
`send_document()` | Used for sending documents
`send_game()` | Used for sending a game
`send_invoice()` | Used for sending an invoice
`send_location()` | Used for sending location
`send_media_group()` | Used for sending media grouped together
`send_message()` | Used for sending text messages
`send_photo()` | Used for sending photos
`send_poll()` | Used for sending polls
`send_sticker()` | Used for sending stickers
`send_venue()` | Used for sending venue locations.
`send_video()` | Used for sending videos
`send_video_note()` | Used for sending video notes
`send_voice()` | Used for sending voice messages
`copy_message()` | Used for copying the contents of an arbitrary message
`copy_messages()` | Used for copying the contents of an multiple arbitrary messages
`forward_message()` | Used for forwarding messages
`forward_messages()` | Used for forwarding multiple messages at once

Updating Messages

`answer_callback_query()` | Used for answering the callback query
`answer_inline_query()` | Used for answering the inline query
`answer_pre_checkout_query()` | Used for answering a pre checkout query
`answer_shipping_query()` | Used for answering a shipping query
`answer_web_app_query()` | Used for answering a web app query
`delete_message()` | Used for deleting messages.
`delete_messages()` | Used for deleting multiple messages as once.
`edit_message_caption()` | Used for editing captions
`edit_message_media()` | Used for editing the media on messages
`edit_message_live_location()` | Used for editing the location in live location messages
`edit_message_reply_markup()` | Used for editing the reply markup on messages
`edit_message_text()` | Used for editing text messages
`stop_poll()` | Used for stopping the running poll
`set_message_reaction()` | Used for setting reactions on messages

Chat Moderation and information

`ban_chat_member()` | Used for banning a member from the chat
`unban_chat_member()` | Used for unbanning a member from the chat
`ban_chat_sender_chat()` | Used for banning a channel in a channel or supergroup
`unban_chat_sender_chat()` | Used for unbanning a channel in a channel or supergroup
`restrict_chat_member()` | Used for restricting a chat member
`promote_chat_member()` | Used for promoting a chat member
`set_chat_administrator_custom_title()` | Used for assigning a custom admin title to an admin
`set_chat_permissions()` | Used for setting the permissions of a chat
`export_chat_invite_link()` | Used for creating a new primary invite link for a chat
`create_chat_invite_link()` | Used for creating an additional invite link for a chat
`edit_chat_invite_link()` | Used for editing a non-primary invite link
`revoke_chat_invite_link()` | Used for revoking an invite link created by the bot
`approve_chat_join_request()` | Used for approving a chat join request
`decline_chat_join_request()` | Used for declining a chat join request
`set_chat_photo()` | Used for setting a photo to a chat
`delete_chat_photo()` | Used for deleting a chat photo
`set_chat_title()` | Used for setting a chat title
`set_chat_description()` | Used for setting the description of a chat
`pin_chat_message()` | Used for pinning a message
`unpin_chat_message()` | Used for unpinning a message
`unpin_all_chat_messages()` | Used for unpinning all pinned chat messages
`get_user_profile_photos()` | Used for obtaining user’s profile pictures
`get_chat()` | Used for getting information about a chat
`get_chat_administrators()` | Used for getting the list of admins in a chat
`get_chat_member_count()` | Used for getting the number of members in a chat
`get_chat_member()` | Used for getting a member of a chat
`get_user_chat_boosts()` | Used for getting the list of boosts added to a chat
`leave_chat()` | Used for leaving a chat

Bot settings

`set_my_commands()` | Used for setting the list of commands
`delete_my_commands()` | Used for deleting the list of commands
`get_my_commands()` | Used for obtaining the list of commands
`get_my_default_administrator_rights()` | Used for obtaining the default administrator rights for the bot
`set_my_default_administrator_rights()` | Used for setting the default administrator rights for the bot
`get_chat_menu_button()` | Used for obtaining the menu button of a private chat or the default menu button
`set_chat_menu_button()` | Used for setting the menu button of a private chat or the default menu button
`set_my_description()` | Used for setting the description of the bot
`get_my_description()` | Used for obtaining the description of the bot
`set_my_short_description()` | Used for setting the short description of the bot
`get_my_short_description()` | Used for obtaining the short description of the bot
`set_my_name()` | Used for setting the name of the bot
`get_my_name()` | Used for obtaining the name of the bot

Stickerset management

`add_sticker_to_set()` | Used for adding a sticker to a set
`delete_sticker_from_set()` | Used for deleting a sticker from a set
`create_new_sticker_set()` | Used for creating a new sticker set
`delete_sticker_set()` | Used for deleting a sticker set made by a bot
`set_chat_sticker_set()` | Used for setting a sticker set of a chat
`delete_chat_sticker_set()` | Used for deleting the set sticker set of a chat
`set_sticker_position_in_set()` | Used for moving a sticker’s position in the set
`set_sticker_set_title()` | Used for setting the title of a sticker set
`set_sticker_emoji_list()` | Used for setting the emoji list of a sticker
`set_sticker_keywords()` | Used for setting the keywords of a sticker
`set_sticker_mask_position()` | Used for setting the mask position of a mask sticker
`set_sticker_set_thumbnail()` | Used for setting the thumbnail of a sticker set
`set_custom_emoji_sticker_set_thumbnail()` | Used for setting the thumbnail of a custom emoji sticker set
`get_sticker_set()` | Used for getting a sticker set
`upload_sticker_file()` | Used for uploading a sticker file
`get_custom_emoji_stickers()` | Used for getting custom emoji files based on their IDs

Games

`get_game_high_scores()` | Used for getting the game high scores
`set_game_score()` | Used for setting the game score

Getting updates

`get_updates()` | Used for getting updates using long polling
`get_webhook_info()` | Used for getting current webhook status
`set_webhook()` | Used for setting a webhook to receive updates
`delete_webhook()` | Used for removing webhook integration

Forum topic management

`close_forum_topic()` | Used for closing a forum topic
`close_general_forum_topic()` | Used for closing the general forum topic
`create_forum_topic()` | Used to create a topic
`delete_forum_topic()` | Used for deleting a forum topic
`edit_forum_topic()` | Used to edit a topic
`edit_general_forum_topic()` | Used to edit the general topic
`get_forum_topic_icon_stickers()` | Used to get custom emojis to use as topic icons
`hide_general_forum_topic()` | Used to hide the general topic
`unhide_general_forum_topic()` | Used to unhide the general topic
`reopen_forum_topic()` | Used to reopen a topic
`reopen_general_forum_topic()` | Used to reopen the general topic
`unpin_all_forum_topic_messages()` | Used to unpin all messages in a forum topic
`unpin_all_general_forum_topic_messages()` | Used to unpin all messages in the general forum topic

Miscellaneous

`create_invoice_link()` | Used to generate an HTTP link for an invoice
`close()` | Used for closing server instance when switching to another local server
`log_out()` | Used for logging out from cloud Bot API server
`get_file()` | Used for getting basic info about a file
`get_me()` | Used for getting basic information about the bot

Properties

`base_file_url` | Telegram Bot API file URL
`base_url` | Telegram Bot API service URL
`bot` | The user instance of the bot as returned by `get_me()`
`can_join_groups` | Whether the bot can join groups
`can_read_all_group_messages` | Whether the bot can read all incoming group messages
`id` | The user id of the bot
`name` | The username of the bot, with leading `@`
`first_name` | The first name of the bot
`last_name` | The last name of the bot
`local_mode` | Whether the bot is running in local mode
`username` | The username of the bot, without leading `@`
`link` | The t.me link of the bot
`private_key` | Deserialized private key for decryption of telegram passport data
`supports_inline_queries` | Whether the bot supports inline queries
`token` | Bot’s unique authentication token