Fix confusing names "MtProtoRequest" and ".confirmed" (#176)

This also fixes the annoyingly confusing message:
"Odd msg_seqno expected (relevant message), but even received."
This commit is contained in:
Lonami Exo
2017-07-24 16:54:48 +02:00
parent 773376ee21
commit 160a3699ac
6 changed files with 26 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ from .network import authenticator, MtProtoSender, TcpTransport
from .utils import get_appropriated_part_size
# For sending and receiving requests
from .tl import MTProtoRequest, JsonSession
from .tl import TLObject, JsonSession
from .tl.all_tlobjects import layer
from .tl.functions import (InitConnectionRequest, InvokeWithLayerRequest)
@@ -265,8 +265,8 @@ class TelegramBareClient:
If 'updates' is not None, all read update object will be put
in such list. Otherwise, update objects will be ignored.
"""
if not isinstance(request, MTProtoRequest):
raise ValueError('You can only invoke MtProtoRequests')
if not isinstance(request, TLObject) and not request.content_related:
raise ValueError('You can only invoke requests, not types!')
if not self._sender:
raise ValueError('You must be connected to invoke requests!')