Fix invalid access to .participants on chat forbidden result

This commit is contained in:
Lonami Exo 2018-03-27 17:15:22 +02:00
parent 7b94530bfc
commit 302a823c88

View File

@ -83,7 +83,7 @@ from .tl.types import (
InputMessageEntityMentionName, DocumentAttributeVideo, InputMessageEntityMentionName, DocumentAttributeVideo,
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates, UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize, MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
PhotoSizeEmpty, MessageService PhotoSizeEmpty, MessageService, ChatParticipants
) )
from .tl.types.messages import DialogsSlice from .tl.types.messages import DialogsSlice
from .extensions import markdown, html from .extensions import markdown, html
@ -1278,6 +1278,11 @@ class TelegramClient(TelegramBareClient):
elif isinstance(entity, InputPeerChat): elif isinstance(entity, InputPeerChat):
# TODO We *could* apply the `filter` here ourselves # TODO We *could* apply the `filter` here ourselves
full = self(GetFullChatRequest(entity.chat_id)) full = self(GetFullChatRequest(entity.chat_id))
if not isinstance(full.full_chat.participants, ChatParticipants):
# ChatParticipantsForbidden won't have ``.participants``
_total[0] = 0
return
if _total: if _total:
_total[0] = len(full.full_chat.participants.participants) _total[0] = len(full.full_chat.participants.participants)