mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-14 05:26:36 +03:00
Move MessageContainer.on_send inside its .to_bytes
This commit is contained in:
parent
6df9fc558e
commit
795cb98909
|
@ -14,7 +14,9 @@ class MessageContainer(TLObject):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.requests = requests
|
self.requests = requests
|
||||||
|
|
||||||
def on_send(self, writer):
|
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(MessageContainer.constructor_id, signed=False)
|
||||||
writer.write_int(len(self.requests))
|
writer.write_int(len(self.requests))
|
||||||
for x in self.requests:
|
for x in self.requests:
|
||||||
|
@ -28,11 +30,6 @@ class MessageContainer(TLObject):
|
||||||
packet = GzipPacked.gzip_if_smaller(x)
|
packet = GzipPacked.gzip_if_smaller(x)
|
||||||
writer.write_int(len(packet))
|
writer.write_int(len(packet))
|
||||||
writer.write(packet)
|
writer.write(packet)
|
||||||
|
|
||||||
def to_bytes(self):
|
|
||||||
# TODO Change this to delete the on_send from this class
|
|
||||||
with BinaryWriter() as writer:
|
|
||||||
self.on_send(writer)
|
|
||||||
return writer.get_bytes()
|
return writer.get_bytes()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue
Block a user