mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Replace TLObject.on_send with the new .to_bytes()
This also replaces some int.to_bytes() calls with a faster struct.pack (up to x4 faster). This approach is also around x3 faster than creating a BinaryWriter just to serialize a TLObject as bytes.
This commit is contained in:
@@ -110,7 +110,7 @@ class BinaryWriter:
|
||||
|
||||
def tgwrite_object(self, tlobject):
|
||||
"""Writes a Telegram object"""
|
||||
tlobject.on_send(self)
|
||||
self.write(tlobject.to_bytes())
|
||||
|
||||
def tgwrite_vector(self, vector):
|
||||
"""Writes a vector of Telegram objects"""
|
||||
|
Reference in New Issue
Block a user