from telethon.tl.mtproto_request import MTProtoRequest


class KeyboardButton(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    keyboardButton#a2fa4880 text:string = KeyboardButton"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0xa2fa4880

    def __init__(self, text):
        """
        :param text: Telegram type: «string».
        """
        super().__init__()

        self.text = text

    def on_send(self, writer):
        writer.write_int(KeyboardButton.constructor_id, signed=False)
        writer.tgwrite_string(self.text)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return KeyboardButton(None)

    def on_response(self, reader):
        self.text = reader.tgread_string()

    def __repr__(self):
        return 'keyboardButton#a2fa4880 text:string = KeyboardButton'

    def __str__(self):
        return '(keyboardButton (ID: 0xa2fa4880) = (text={}))'.format(str(self.text))
