get_history_count()¶
-
Client.
get_history_count
()¶ Get the total count of messages in a chat.
Note
Due to Telegram latest internal changes, the server can’t reliably find anymore the total count of messages a private or a basic group chat has with a single method call. To overcome this limitation, Pyrogram has to iterate over all the messages. Channels and supergroups are not affected by this limitation.
- Parameters
chat_id (
int
|str
) – Unique identifier (int) or username (str) of the target chat.- Returns
int
– On success, the chat history count is returned.
Example
app.get_history_count("pyrogramchat")