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,
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
PhotoSizeEmpty, MessageService
PhotoSizeEmpty, MessageService, ChatParticipants
)
from .tl.types.messages import DialogsSlice
from .extensions import markdown, html
@ -1278,6 +1278,11 @@ class TelegramClient(TelegramBareClient):
elif isinstance(entity, InputPeerChat):
# TODO We *could* apply the `filter` here ourselves
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:
_total[0] = len(full.full_chat.participants.participants)