Use the refactored types in get_chat_member(s)

This commit is contained in:
Dan 2018-12-16 17:58:05 +01:00
parent 66cd896a99
commit 31b046e5cc
2 changed files with 10 additions and 5 deletions

View File

@ -17,7 +17,8 @@
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from pyrogram.api import functions, types, errors
from ...ext import BaseClient, utils
from ...ext import BaseClient
import pyrogram
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:
return member
else:
@ -64,7 +65,8 @@ class GetChatMember(BaseClient):
)
)
return utils.parse_chat_members(
return pyrogram.ChatMembers.parse(
self,
types.channels.ChannelParticipants(
count=1,
participants=[r.participant],

View File

@ -18,6 +18,7 @@
from pyrogram.api import functions, types
from ...ext import BaseClient, utils
import pyrogram
class Filters:
@ -83,7 +84,8 @@ class GetChatMembers(BaseClient):
peer = self.resolve_peer(chat_id)
if isinstance(peer, types.InputPeerChat):
return utils.parse_chat_members(
return pyrogram.ChatMembers.parse(
self,
self.send(
functions.messages.GetFullChat(
peer.chat_id
@ -108,7 +110,8 @@ class GetChatMembers(BaseClient):
else:
raise ValueError("Invalid filter \"{}\"".format(filter))
return utils.parse_chat_members(
return pyrogram.ChatMembers.parse(
self,
self.send(
functions.channels.GetParticipants(
channel=peer,