mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Use the refactored types in get_chat_member(s)
This commit is contained in:
parent
66cd896a99
commit
31b046e5cc
@ -17,7 +17,8 @@
|
|||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.api import functions, types, errors
|
from pyrogram.api import functions, types, errors
|
||||||
from ...ext import BaseClient, utils
|
from ...ext import BaseClient
|
||||||
|
import pyrogram
|
||||||
|
|
||||||
|
|
||||||
class GetChatMember(BaseClient):
|
class GetChatMember(BaseClient):
|
||||||
@ -51,7 +52,7 @@ class GetChatMember(BaseClient):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for member in utils.parse_chat_members(full_chat).chat_members:
|
for member in pyrogram.ChatMembers.parse(self, full_chat).chat_members:
|
||||||
if member.user.id == user_id.user_id:
|
if member.user.id == user_id.user_id:
|
||||||
return member
|
return member
|
||||||
else:
|
else:
|
||||||
@ -64,7 +65,8 @@ class GetChatMember(BaseClient):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return utils.parse_chat_members(
|
return pyrogram.ChatMembers.parse(
|
||||||
|
self,
|
||||||
types.channels.ChannelParticipants(
|
types.channels.ChannelParticipants(
|
||||||
count=1,
|
count=1,
|
||||||
participants=[r.participant],
|
participants=[r.participant],
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
from ...ext import BaseClient, utils
|
from ...ext import BaseClient, utils
|
||||||
|
import pyrogram
|
||||||
|
|
||||||
|
|
||||||
class Filters:
|
class Filters:
|
||||||
@ -83,7 +84,8 @@ class GetChatMembers(BaseClient):
|
|||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
if isinstance(peer, types.InputPeerChat):
|
if isinstance(peer, types.InputPeerChat):
|
||||||
return utils.parse_chat_members(
|
return pyrogram.ChatMembers.parse(
|
||||||
|
self,
|
||||||
self.send(
|
self.send(
|
||||||
functions.messages.GetFullChat(
|
functions.messages.GetFullChat(
|
||||||
peer.chat_id
|
peer.chat_id
|
||||||
@ -108,7 +110,8 @@ class GetChatMembers(BaseClient):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Invalid filter \"{}\"".format(filter))
|
raise ValueError("Invalid filter \"{}\"".format(filter))
|
||||||
|
|
||||||
return utils.parse_chat_members(
|
return pyrogram.ChatMembers.parse(
|
||||||
|
self,
|
||||||
self.send(
|
self.send(
|
||||||
functions.channels.GetParticipants(
|
functions.channels.GetParticipants(
|
||||||
channel=peer,
|
channel=peer,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user