mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 13:29:47 +00:00
Added ability to both read and write vectors*
This change affects the BinaryReader and BinaryWriter Note that it only allows to write vectors of **TLObjects**, not any other type
This commit is contained in:
@@ -128,6 +128,14 @@ class BinaryReader:
|
||||
result.on_response(self)
|
||||
return result
|
||||
|
||||
def tgread_vector(self):
|
||||
"""Reads a vector (a list) of Telegram objects"""
|
||||
if 0x1cb5c415 != self.read_int(signed=False):
|
||||
raise ValueError('Invalid constructor code, vector was expected')
|
||||
|
||||
count = self.read_int()
|
||||
return [self.tgread_object() for _ in range(count)]
|
||||
|
||||
# endregion
|
||||
|
||||
def close(self):
|
||||
|
Reference in New Issue
Block a user