from ....tl.mtproto_request import MTProtoRequest


class StartBotRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates"""

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

    def __init__(self, bot, peer, random_id, start_param):
        """
        :param bot: Telegram type: «InputUser».
        :param peer: Telegram type: «InputPeer».
        :param random_id: Telegram type: «long».
        :param start_param: Telegram type: «string».

        :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, UpdatesTg, UpdateShortSentMessage.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.bot = bot
        self.peer = peer
        self.random_id = random_id
        self.start_param = start_param

    def on_send(self, writer):
        writer.write_int(StartBotRequest.constructor_id, signed=False)
        self.bot.on_send(writer)
        self.peer.on_send(writer)
        writer.write_long(self.random_id)
        writer.tgwrite_string(self.start_param)

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

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates'

    def __str__(self):
        return '(messages.startBot (ID: 0xe6df7378) = (bot={}, peer={}, random_id={}, start_param={}))'.format(str(self.bot), str(self.peer), str(self.random_id), str(self.start_param))
