mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Make get_chat_members work with basic groups
This commit is contained in:
parent
3b29a602d0
commit
e3128fca9d
1 changed files with 38 additions and 25 deletions
|
|
@ -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…
Reference in a new issue