Replaces internal `message_id`'s text with `s`.
(self, s)
| 54 | return self._message_id |
| 55 | |
| 56 | def write(self, s): |
| 57 | """Replaces internal `message_id`'s text with `s`.""" |
| 58 | if not s: |
| 59 | s = "..." |
| 60 | s = s.replace('\r', '').strip() |
| 61 | if s == self.text: |
| 62 | return # avoid duplicate message Bot error |
| 63 | message_id = self.message_id |
| 64 | if message_id is None: |
| 65 | return |
| 66 | self.text = s |
| 67 | try: |
| 68 | future = self.submit( |
| 69 | self.session.post, self.API + '%s/editMessageText' % self.token, |
| 70 | data={'text': '`' + s + '`', 'chat_id': self.chat_id, |
| 71 | 'message_id': message_id, 'parse_mode': 'MarkdownV2'}) |
| 72 | except Exception as e: |
| 73 | tqdm_auto.write(str(e)) |
| 74 | else: |
| 75 | return future |
| 76 | |
| 77 | def delete(self): |
| 78 | """Deletes internal `message_id`.""" |
no test coverage detected