def send(self, message: Message): message.to_chat(chat_id=self.chat_id) send_func = self._send if self._should_send_new_message( ) else self._edit try: send_func(message) except: # If the message could not be sent properly, discard it to start with a new one self.new() raise
def _send_to(self, api_message: Message, chat_id: int): api_message.to_chat(chat_id=chat_id) self.api.send_message(api_message)