mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 08:14:14 +03:00
Remove BinaryWriter dependency on MessageContainer
This commit is contained in:
parent
833aeb86eb
commit
8a605f21e6
|
@ -1,5 +1,6 @@
|
|||
from . import TLObject, GzipPacked
|
||||
from ..extensions import BinaryWriter
|
||||
import struct
|
||||
|
||||
from . import TLObject
|
||||
|
||||
|
||||
class MessageContainer(TLObject):
|
||||
|
@ -11,14 +12,9 @@ class MessageContainer(TLObject):
|
|||
self.messages = messages
|
||||
|
||||
def to_bytes(self):
|
||||
# TODO Change this to delete the on_send from this class
|
||||
with BinaryWriter() as writer:
|
||||
writer.write_int(MessageContainer.constructor_id, signed=False)
|
||||
writer.write_int(len(self.messages))
|
||||
for m in self.messages:
|
||||
writer.write(m.to_bytes())
|
||||
|
||||
return writer.get_bytes()
|
||||
return struct.pack(
|
||||
'<Ii', MessageContainer.constructor_id, len(self.messages)
|
||||
) + b''.join(m.to_bytes() for m in self.messages)
|
||||
|
||||
@staticmethod
|
||||
def iter_read(reader):
|
||||
|
|
Loading…
Reference in New Issue
Block a user