mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +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,
|
limit: int = 200,
|
||||||
query: str = "",
|
query: str = "",
|
||||||
filter: str = Filters.ALL):
|
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()
|
filter = filter.lower()
|
||||||
|
|
||||||
if filter == Filters.ALL:
|
if filter == Filters.ALL:
|
||||||
@ -56,7 +67,7 @@ class GetChatMembers(BaseClient):
|
|||||||
return utils.parse_chat_members(
|
return utils.parse_chat_members(
|
||||||
self.send(
|
self.send(
|
||||||
functions.channels.GetParticipants(
|
functions.channels.GetParticipants(
|
||||||
channel=self.resolve_peer(chat_id),
|
channel=peer,
|
||||||
filter=filter,
|
filter=filter,
|
||||||
offset=offset,
|
offset=offset,
|
||||||
limit=limit,
|
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