mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-25 00:04:30 +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)
|
||||
messages[chat_id] = await types.Message._parse(self, message, users, chats)
|
||||
|
||||
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
|
||||
|
||||
dialogs.append(types.Dialog._parse(self, dialog, messages, users, chats))
|
||||
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:
|
||||
included_chats.append(types.Chat._parse_dialog(client, peer, users, chats))
|
||||
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:
|
||||
excluded_chats.append(types.Chat._parse_dialog(client, peer, users, chats))
|
||||
try:
|
||||
excluded_chats.append(types.Chat._parse_dialog(client, peer, users, chats))
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
for peer in folder.pinned_peers:
|
||||
pinned_chats.append(types.Chat._parse_dialog(client, peer, users, chats))
|
||||
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