def replier(update):
     nonlocal work
     nonlocal last_time
     captcha_ret = captcha(update)
     if isinstance(captcha_ret, NewCaptcha):
         if captcha_ret.msg_id not in doned:
             sleep(3)
             client.send(
                 GetBotCallbackAnswer(peer=captcha_ret.peer,
                                      msg_id=captcha_ret.msg_id,
                                      data=captcha_ret.data))
             doned.append(captcha_ret.msg_id)
             return None
     elif captcha_ret == 'posts_end':
         if time() - last_time > 30:
             last_time = time()
             work.stop()
             sleep(300)
             work = Work()
             work.start()
     elif isinstance(captcha_ret, NewBonus):
         sleep(3)
         client.send(
             GetBotCallbackAnswer(
                 msg_id=captcha_ret.msg_id,
                 peer=captcha_ret.peer,
                 data=captcha_ret.data,
             ))
    def press_inline_button(
        self,
        chat_id: Union[int, str],
        on_message: Union[int, Message],
        callback_data,
        retries=0,
    ) -> Optional[BotCallbackAnswer]:
        if isinstance(on_message, Message):
            mid = on_message.message_id
        elif isinstance(on_message, int):
            mid = on_message
        else:
            raise ValueError("Invalid argument `on_message`")

        request = GetBotCallbackAnswer(
            peer=self.resolve_peer(chat_id),
            msg_id=mid,
            data=bytes(callback_data, "utf-8"),
        )

        if retries > 0:
            return self.session.send(request, retries=retries)
        else:
            # noinspection PyProtectedMember
            self.session._send(request, wait_response=False)
            return None