get_chat_members_count()

Client.get_chat_members_count()

Get the number of members in a chat.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. You can also use chat public link in form of t.me/<username> (str).

  • join_request (bool, optional) – If True, the count will include the number of users who sent a join request to the chat.

Returns:

int – On success, the chat members count is returned.

Raises:

ValueError – In case a chat id belongs to user.

Example

count = await app.get_chat_members_count(chat_id)
print(count)