async Client.get_chat_members()

Get the members list of a chat.

A chat can be either a basic group, a supergroup or a channel. Requires administrator rights in channels.

Usable by Users Bots
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat.

  • query (str, optional) – Query string to filter members based on their display names and usernames. Only applicable to supergroups and channels. Defaults to “” (empty string). A query string is applicable only for SEARCH, BANNED and RESTRICTED filters only.

  • limit (int, optional) – Limits the number of members to be retrieved.

  • filter (ChatMembersFilter, optional) – Filter used to select the kind of members you want to retrieve. Only applicable for supergroups and channels.


Generator – On success, a generator yielding ChatMember objects is returned.


from hydrogram import enums

# Get members
async for member in app.get_chat_members(chat_id):

# Get administrators
administrators = []
async for m in app.get_chat_members(
    chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS

# Get bots
bots = []
async for m in app.get_chat_members(chat_id, filter=enums.ChatMembersFilter.BOTS):