pyrogram/compiler/api/template/mtproto.txt
Dan c7b1d6f70a Take into account that flags:# could be not always the first argument
For instance, in Layer 91, Poll's flags:# is at the second position.
This mess also happened in the past (thanks tg devs) and eventually will
be fixed again with the next Layer update, but from now on Pyrogram
will be able to correctly generate code even in such cases.
2019-01-05 15:40:40 +01:00

28 lines
483 B
Plaintext

{notice}
from io import BytesIO
from pyrogram.api.core import *
class {class_name}(Object):
"""{docstring_args}
"""
ID = {object_id}
def __init__(self{arguments}):
{fields}
@staticmethod
def read(b: BytesIO, *args) -> "{class_name}":
{read_types}
return {class_name}({return_arguments})
def write(self) -> bytes:
b = BytesIO()
b.write(Int(self.ID, False))
{write_types}
return b.getvalue()