Repository navigation
telegram: add delete() when leave=False - #1189
Conversation
Add an option for delete bar message with the deleteMessage method in Bot API.
|
Ideally this would be used when |
Codecov Report
@@ Coverage Diff @@
## master #1189 +/- ##
=======================================
Coverage 89.88% 89.88%
=======================================
Files 26 26
Lines 1710 1710
Branches 284 284
=======================================
Hits 1537 1537
Misses 128 128
Partials 45 45 |
| if self.disable: | ||
| return | ||
| super(tqdm_telegram, self).close() | ||
| if not (self.leave or (self.leave is None and self.pos == 0)): |
There was a problem hiding this comment.
borrowing usual leave=None|False|True logic here.
Potential future issue is if people want different behaviour for terminal & telegram outputs (leave one but not the other). They'd have to override the close() method. Don't think we need to explicitly support/worry about that case for now.
What do you think?
There was a problem hiding this comment.
I think the leave variable is perfect, it fits our needs, and yes the default behaviour would be leave = False. In the meantime we don't worry about that case for terminal and telegram outputs. When the close() method is called just delete the message from telegram and stop the bar from terminal.
delete() when leave=False
- also misc minor tidy
d5758df to
c36a011
Compare

Add an option for delete bar message with the deleteMessage method in Bot API.