mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 11:23:46 +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)
|
||||
) + 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
|
||||
def iter_read(reader):
|
||||
reader.read_int(signed=False) # code
|
||||
|
|
|
@ -15,3 +15,7 @@ class TLMessage(TLObject):
|
|||
def __bytes__(self):
|
||||
body = GzipPacked.gzip_if_smaller(self.request)
|
||||
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