mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Ignore KeyError in get_dialogs and get_folders
This commit is contained in:
parent
fc33b39e4b
commit
aba1ac387b
@ -76,7 +76,11 @@ class GetDialogs:
|
||||
continue
|
||||
|
||||
chat_id = utils.get_peer_id(message.peer_id)
|
||||
|
||||
try:
|
||||
messages[chat_id] = await types.Message._parse(self, message, users, chats)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
dialogs = []
|
||||
|
||||
@ -84,7 +88,10 @@ class GetDialogs:
|
||||
if not isinstance(dialog, raw.types.Dialog):
|
||||
continue
|
||||
|
||||
try:
|
||||
dialogs.append(types.Dialog._parse(self, dialog, messages, users, chats))
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if not dialogs:
|
||||
return
|
||||
|
@ -117,14 +117,23 @@ class Folder(Object):
|
||||
pinned_chats = []
|
||||
|
||||
for peer in folder.include_peers:
|
||||
try:
|
||||
included_chats.append(types.Chat._parse_dialog(client, peer, users, chats))
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if getattr(folder, "exclude_peers", None):
|
||||
for peer in folder.exclude_peers:
|
||||
try:
|
||||
excluded_chats.append(types.Chat._parse_dialog(client, peer, users, chats))
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
for peer in folder.pinned_peers:
|
||||
try:
|
||||
pinned_chats.append(types.Chat._parse_dialog(client, peer, users, chats))
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return Folder(
|
||||
id=folder.id,
|
||||
|
Loading…
Reference in New Issue
Block a user