mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Fix get_chat_member always returning self for basic groups
This commit is contained in:
parent
d95bbdf445
commit
89e6f4137b
@ -47,26 +47,30 @@ class GetChatMember(BaseClient):
|
|||||||
Raises:
|
Raises:
|
||||||
RPCError: In case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
chat_id = self.resolve_peer(chat_id)
|
chat = self.resolve_peer(chat_id)
|
||||||
user_id = self.resolve_peer(user_id)
|
user = self.resolve_peer(user_id)
|
||||||
|
|
||||||
if isinstance(chat_id, types.InputPeerChat):
|
if isinstance(chat, types.InputPeerChat):
|
||||||
full_chat = self.send(
|
full_chat = self.send(
|
||||||
functions.messages.GetFullChat(
|
functions.messages.GetFullChat(
|
||||||
chat_id=chat_id.chat_id
|
chat_id=chat.chat_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for member in pyrogram.ChatMembers._parse(self, full_chat).chat_members:
|
for member in pyrogram.ChatMembers._parse(self, full_chat).chat_members:
|
||||||
if member.user.is_self:
|
if isinstance(user, types.InputPeerSelf):
|
||||||
return member
|
if member.user.is_self:
|
||||||
|
return member
|
||||||
|
else:
|
||||||
|
if member.user.id == user.user_id:
|
||||||
|
return member
|
||||||
else:
|
else:
|
||||||
raise UserNotParticipant
|
raise UserNotParticipant
|
||||||
elif isinstance(chat_id, types.InputPeerChannel):
|
elif isinstance(chat, types.InputPeerChannel):
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.channels.GetParticipant(
|
functions.channels.GetParticipant(
|
||||||
channel=chat_id,
|
channel=chat,
|
||||||
user_id=user_id
|
user_id=user
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user