Update to layer 76

This commit is contained in:
Lonami Exo
2018-04-28 11:49:43 +02:00
parent 3008ada98d
commit 08dbc42718
4 changed files with 55 additions and 23 deletions

View File

@@ -26,7 +26,7 @@ from .tl.types import (
FileLocationUnavailable, InputMediaUploadedDocument, ChannelFull,
InputMediaUploadedPhoto, DocumentAttributeFilename, photos,
TopPeer, InputNotifyPeer, InputMessageID, InputFileLocation,
InputDocumentFileLocation, PhotoSizeEmpty
InputDocumentFileLocation, PhotoSizeEmpty, InputDialogPeer
)
from .tl.types.contacts import ResolvedPeer
@@ -182,6 +182,24 @@ def get_input_user(entity):
_raise_cast_fail(entity, 'InputUser')
def get_input_dialog(dialog):
"""Similar to :meth:`get_input_peer`, but for dialogs"""
try:
if dialog.SUBCLASS_OF_ID == 0xa21c9795: # crc32(b'InputDialogPeer')
return dialog
if dialog.SUBCLASS_OF_ID == 0xc91c90b6: # crc32(b'InputPeer')
return InputDialogPeer(dialog)
except AttributeError:
_raise_cast_fail(dialog, 'InputDialogPeer')
try:
return InputDialogPeer(get_input_peer(dialog))
except TypeError:
pass
_raise_cast_fail(dialog, 'InputDialogPeer')
def get_input_document(document):
"""Similar to :meth:`get_input_peer`, but for documents"""
try: