4545 PasswordHashInvalid , FloodWait , PeerIdInvalid , FilePartMissing ,
4646 ChatAdminRequired , FirstnameInvalid , PhoneNumberBanned ,
4747 VolumeLocNotFound , UserMigrate )
48- from pyrogram .api .types import (
49- User , Chat , Channel ,
50- InputPeerEmpty , InputPeerSelf ,
51- InputPeerUser , InputPeerChat , InputPeerChannel
52- )
5348from pyrogram .crypto import AES
5449from pyrogram .session import Auth , Session
5550from pyrogram .session .internals import MsgId
@@ -447,7 +442,7 @@ def authorize_user(self):
447442
448443 def fetch_peers (self , entities : list ):
449444 for entity in entities :
450- if isinstance (entity , User ):
445+ if isinstance (entity , types . User ):
451446 user_id = entity .id
452447
453448 if user_id in self .peers_by_id :
@@ -461,7 +456,7 @@ def fetch_peers(self, entities: list):
461456 username = entity .username
462457 phone = entity .phone
463458
464- input_peer = InputPeerUser (
459+ input_peer = types . InputPeerUser (
465460 user_id = user_id ,
466461 access_hash = access_hash
467462 )
@@ -474,20 +469,20 @@ def fetch_peers(self, entities: list):
474469 if phone is not None :
475470 self .peers_by_phone [phone ] = input_peer
476471
477- if isinstance (entity , Chat ):
472+ if isinstance (entity , types . Chat ):
478473 chat_id = entity .id
479474 peer_id = - chat_id
480475
481476 if peer_id in self .peers_by_id :
482477 continue
483478
484- input_peer = InputPeerChat (
479+ input_peer = types . InputPeerChat (
485480 chat_id = chat_id
486481 )
487482
488483 self .peers_by_id [peer_id ] = input_peer
489484
490- if isinstance (entity , Channel ):
485+ if isinstance (entity , types . Channel ):
491486 channel_id = entity .id
492487 peer_id = int ("-100" + str (channel_id ))
493488
@@ -501,7 +496,7 @@ def fetch_peers(self, entities: list):
501496
502497 username = entity .username
503498
504- input_peer = InputPeerChannel (
499+ input_peer = types . InputPeerChannel (
505500 channel_id = channel_id ,
506501 access_hash = access_hash
507502 )
@@ -651,8 +646,9 @@ def updates_worker(self):
651646 )
652647 )
653648
654- updates .users += diff .users
655- updates .chats += diff .chats
649+ if not isinstance (diff , types .updates .ChannelDifferenceEmpty ):
650+ updates .users += diff .users
651+ updates .chats += diff .chats
656652
657653 if channel_id and pts :
658654 if channel_id not in self .channels_pts :
@@ -879,7 +875,7 @@ def parse_dialogs(d):
879875
880876 dialogs = self .send (
881877 functions .messages .GetDialogs (
882- 0 , 0 , InputPeerEmpty (),
878+ 0 , 0 , types . InputPeerEmpty (),
883879 self .DIALOGS_AT_ONCE , True
884880 )
885881 )
@@ -925,7 +921,7 @@ def resolve_peer(self, peer_id: int or str):
925921 """
926922 if type (peer_id ) is str :
927923 if peer_id in ("self" , "me" ):
928- return InputPeerSelf ()
924+ return types . InputPeerSelf ()
929925
930926 match = self .INVITE_LINK_RE .match (peer_id )
931927
@@ -981,7 +977,7 @@ def get_me(self):
981977 """
982978 return self .send (
983979 functions .users .GetFullUser (
984- InputPeerSelf ()
980+ types . InputPeerSelf ()
985981 )
986982 )
987983
@@ -2438,7 +2434,7 @@ def join_chat(self, chat_id: str):
24382434 )
24392435 )
24402436
2441- channel = InputPeerChannel (
2437+ channel = types . InputPeerChannel (
24422438 channel_id = resolved_peer .chats [0 ].id ,
24432439 access_hash = resolved_peer .chats [0 ].access_hash
24442440 )
0 commit comments