mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Make get_chat_members work with basic groups
This commit is contained in:
parent
3b29a602d0
commit
e3128fca9d
@ -36,6 +36,17 @@ class GetChatMembers(BaseClient):
|
||||
limit: int = 200,
|
||||
query: str = "",
|
||||
filter: str = Filters.ALL):
|
||||
peer = self.resolve_peer(chat_id)
|
||||
|
||||
if isinstance(peer, types.InputPeerChat):
|
||||
return utils.parse_chat_members(
|
||||
self.send(
|
||||
functions.messages.GetFullChat(
|
||||
peer.chat_id
|
||||
)
|
||||
)
|
||||
)
|
||||
elif isinstance(peer, types.InputPeerChannel):
|
||||
filter = filter.lower()
|
||||
|
||||
if filter == Filters.ALL:
|
||||
@ -56,7 +67,7 @@ class GetChatMembers(BaseClient):
|
||||
return utils.parse_chat_members(
|
||||
self.send(
|
||||
functions.channels.GetParticipants(
|
||||
channel=self.resolve_peer(chat_id),
|
||||
channel=peer,
|
||||
filter=filter,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
@ -64,3 +75,5 @@ class GetChatMembers(BaseClient):
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
raise ValueError("The chat_id \"{}\" belongs to a user".format(chat_id))
|
||||
|
Loading…
x
Reference in New Issue
Block a user