Home > Software design >  get all chat members id pyrogram
get all chat members id pyrogram

Time:12-16

How can I get all members of chat ids? I tried app.get_chat_members, but i need only user id, and nothing else. Tried this:

    countingusers=app.get_chat_members(f"{link}")

CodePudding user response:

for member in countingusers: f=member.user.id

CodePudding user response:

app.get_chat_members() only returns 200 members at a time. If you want to iterate over all members, you can use app.iter_chat_members() instead. To get just the user_id's, you could use a list comprehension:

counting_users = [x.user.id for x in app.iter_chat_members(chat_id)]

Then your counting_users variable is a list of user_id's.

  • Related