Available Methods¶
This page is about Hydrogram methods. All the methods listed here are bound to a Client
instance,
except for idle()
and compose()
, which are special functions that can be found in
the main package directly.
from hydrogram import Client
app = Client("my_account")
with app:
app.send_message("me", "hi")
Utilities¶
Start the client. |
|
Stop the Client. |
|
Start the client, idle the main script and finally stop the client. |
|
Restart the Client. |
|
Register an update handler. |
|
Remove a previously-registered update handler. |
|
Stop downloading or uploading a file. |
|
Export the current authorized session as a serialized string. |
|
Set the parse mode to be used globally by the client. |
Block the main script execution until a signal is received. |
|
Run multiple clients at once. |
Messages¶
Send text messages. |
|
Forward messages of any kind. |
|
Copy messages of any kind. |
|
Copy a media group by providing one of the message ids. |
|
Send photos. |
|
Send audio files. |
|
Send generic files. |
|
Send static .webp or animated .tgs stickers. |
|
Send video files. |
|
Send animation files (animation or H.264/MPEG-4 AVC video without sound). |
|
Send audio files. |
|
Send video messages. |
|
Send a group of photos or videos as an album. |
|
Send points on the map. |
|
Send information about a venue. |
|
Send phone contacts. |
|
Send any media stored on the Telegram servers using a file_id. |
|
Send a reaction to a message. |
|
Edit the text of messages. |
|
Edit the caption of media messages. |
|
Edit animation, audio, document, photo or video messages. |
|
Edit only the reply markup of messages sent by the bot. |
|
Edit the text of inline messages. |
|
Edit the caption of inline media messages. |
|
Edit inline animation, audio, document, photo or video messages. |
|
Edit only the reply markup of inline messages sent via the bot (for inline bots). |
|
Tell the other party that something is happening on your side. |
|
Delete messages, including service messages. |
|
Get one or more messages from a chat by using message identifiers. |
|
Get the media group a message belongs to. |
|
Get messages from a chat history. |
|
Get the total count of messages in a chat. |
|
Mark a chat's message history as read. |
|
Send a new poll. |
|
Vote a poll. |
|
Stop a poll which was sent by you. |
|
Retract your vote in a poll. |
|
Send a dice with a random value from 1 to 6. |
|
Search for text and media messages inside a specific chat. |
|
Get the count of messages resulting from a search inside a chat. |
|
Search messages globally from all of your chats. |
|
Get the count of messages resulting from a global search. |
|
Download the media from a message. |
|
Stream the media from a message chunk by chunk. |
|
Get the first discussion message of a channel post or a discussion thread in a group. |
|
Get the message replies of a discussion thread. |
|
Get the total count of replies in a discussion thread. |
|
Get information about custom emoji stickers by their identifiers. |
Chats¶
Join a group chat or channel. |
|
Leave a group chat or channel. |
|
Ban a user from a group, a supergroup or a channel. |
|
Unban a previously banned user in a supergroup or channel. |
|
Restrict a user in a supergroup. |
|
Promote or demote a user in a supergroup or a channel. |
|
Set a custom title (rank) to an administrator of a supergroup. |
|
Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds). |
|
Delete a chat photo. |
|
Change the title of a chat. |
|
Change the description of a supergroup or a channel. |
|
Set default chat permissions for all members. |
|
Pin a message in a group, channel or your own chat. |
|
Unpin a message in a group, channel or your own chat. |
|
Use this method to clear the list of pinned messages in a chat. |
|
Get up to date information about a chat. |
|
Get information about one member of a chat. |
|
Get the members list of a chat. |
|
Get the number of members in a chat. |
|
Get a user's dialogs sequentially. |
|
Get the total count of your dialogs. |
|
Set a channel or a supergroup username. |
|
Get nearby chats. |
|
Archive one or more chats. |
|
Unarchive one or more chats. |
|
Add new chat members to a group, supergroup or channel |
|
Create a new broadcast channel. |
|
Create a new basic group. |
|
Create a new supergroup. |
|
Delete a channel. |
|
Delete a supergroup. |
|
Delete all messages sent by a certain user in a supergroup. |
|
Set the slow mode interval for a chat. |
|
Mark a chat as unread. |
|
Get the actions taken by chat members and administrators in the last 48h. |
|
Get the number of members that are currently online in a chat. |
|
Get the list of "send_as" chats available. |
|
Set the default "send_as" chat for a chat. |
|
Set the chat protected content setting. |
|
Set new chat owner. |
Users¶
Get your own user identity. |
|
Get information about a user. |
|
Get a chat or a user profile photos sequentially. |
|
Get the total count of photos for a chat. |
|
Set a new profile photo or video (H.264/MPEG-4 AVC video, max 5 seconds). |
|
Delete your own profile photos. |
|
Set your own username. |
|
Update your profile details such as first name, last name and bio. |
|
Block a user. |
|
Unblock a user. |
|
Get the common chats you have with a user. |
|
Get the default emoji statuses. |
|
Set the emoji status. |
Invite Links¶
Get detailed information about a chat invite link. |
|
Generate a new primary invite link for a chat; any previously generated primary link is revoked. |
|
Create an additional invite link for a chat. |
|
Edit a non-primary invite link. |
|
Revoke a previously created invite link. |
|
Delete an already revoked invite link. |
|
Get the members who joined the chat with the invite link. |
|
Get the count of the members who joined the chat with the invite link. |
|
Get the invite links created by an administrator in a chat. |
|
Get the count of the invite links created by an administrator in a chat. |
|
Get the list of the administrators that have exported invite links in a chat. |
|
Get the pending join requests of a chat. |
|
Delete all revoked invite links of an administrator. |
|
Approve a chat join request. |
|
Approve all pending join requests in a chat. |
|
Decline a chat join request. |
|
Decline all pending join requests in a chat. |
Contacts¶
Add an existing Telegram user as contact, even without a phone number. |
|
Delete contacts from your Telegram address book. |
|
Import contacts to your Telegram address book. |
|
Get contacts from your Telegram address book. |
|
Get the total count of contacts from your Telegram address book. |
Password¶
Enable the Two-Step Verification security feature (Cloud Password) on your account. |
|
Change your Two-Step Verification password (Cloud Password) with a new one. |
|
Turn off the Two-Step Verification security feature (Cloud Password) on your account. |
Bots¶
Get bot results via inline queries. |
|
Send an inline bot result. |
|
Send answers to callback queries sent from inline keyboards. |
|
Send answers to an inline query. |
|
Request a callback answer from bots. |
|
Send a game. |
|
Set the score of the specified user in a game. |
|
Get data for high score tables. |
|
Set the list of the bot's commands. |
|
Get the current list of the bot's commands for the given scope and user language. |
|
Delete the list of the bot's commands for the given scope and user language. |
|
Change the default privileges requested by the bot when it's added as an administrator to groups or channels. |
|
Get the current default privileges of the bot. |
|
Change the bot's menu button in a private chat, or the default menu button. |
|
Get the current value of the bot's menu button in a private chat, or the default menu button. |
|
Set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. |
Advanced¶
Methods used only when dealing with the raw Telegram API. Learn more about how to use the raw API at Advanced Usage.
Invoke raw Telegram functions. |
|
Get the InputPeer of a known peer id. |
|
Upload a file onto Telegram servers, without actually sending the message to anyone. |