MTPyroger/compiler/api/template/combinator.txt
餅喵 4d933b80f9
Fix TL schema naming conflicts (#690)
* Avoid variable conflicts with Telegram TL schema

* Fix game button with no data attached to button

* Update combinator.txt

* Update compiler.py

* Update tl_object.py

Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
2021-08-28 10:01:12 +02:00

36 lines
733 B
Plaintext

{notice}
from io import BytesIO
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
from pyrogram.raw.core import TLObject
from pyrogram import raw
from typing import List, Union, Any
{warning}
class {name}(TLObject): # type: ignore
"""{docstring}
"""
__slots__: List[str] = [{slots}]
ID = {id}
QUALNAME = "{qualname}"
def __init__(self{arguments}) -> None:
{fields}
@staticmethod
def read(b: BytesIO, *args: Any) -> "{name}":
{read_types}
return {name}({return_arguments})
def write(self) -> bytes:
b = BytesIO()
b.write(Int(self.ID, False))
{write_types}
return b.getvalue()