mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 21:03:45 +03:00
Add __str__ methods to TLMessage and MessageContainer
This commit is contained in:
parent
d7f917ebfc
commit
6759beac21
|
@ -16,6 +16,10 @@ class MessageContainer(TLObject):
|
||||||
'<Ii', MessageContainer.CONSTRUCTOR_ID, len(self.messages)
|
'<Ii', MessageContainer.CONSTRUCTOR_ID, len(self.messages)
|
||||||
) + b''.join(bytes(m) for m in self.messages)
|
) + b''.join(bytes(m) for m in self.messages)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return 'MessageContainer(messages=[{}])'\
|
||||||
|
.format(', '.join(str(m) for m in self.messages))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def iter_read(reader):
|
def iter_read(reader):
|
||||||
reader.read_int(signed=False) # code
|
reader.read_int(signed=False) # code
|
||||||
|
|
|
@ -15,3 +15,7 @@ class TLMessage(TLObject):
|
||||||
def __bytes__(self):
|
def __bytes__(self):
|
||||||
body = GzipPacked.gzip_if_smaller(self.request)
|
body = GzipPacked.gzip_if_smaller(self.request)
|
||||||
return struct.pack('<qii', self.msg_id, self.seq_no, len(body)) + body
|
return struct.pack('<qii', self.msg_id, self.seq_no, len(body)) + body
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return 'TLMessage(msg_id={}, seq_no={}, body={})'\
|
||||||
|
.format(self.msg_id, self.seq_no, self.request)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user