2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-31 22:35:36 +00:00

Add API compiler

This commit is contained in:
Dan
2017-12-05 12:16:39 +01:00
parent 45ee7aa8b1
commit 28704b9326
7 changed files with 1543 additions and 0 deletions

View File

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