-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added methods to quickly reply to a message with Markdown or HTML #827
Conversation
Codecov Report
@@ Coverage Diff @@
## master #827 +/- ##
==========================================
- Coverage 91.83% 91.67% -0.16%
==========================================
Files 103 103
Lines 4052 4061 +9
Branches 639 639
==========================================
+ Hits 3721 3723 +2
- Misses 193 197 +4
- Partials 138 141 +3
|
I edited the docstring and merged master. But it's still missing tests for these new methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's still missing tests for these new methods.
Please add using monkeypatch. See test_message::test_reply_text for example
@JosXa what is the status for this? |
Tests added as discussed |
Sorry, I keep committing files from other branches... Fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small docstring improvements and please restore the dict in test_message to the state it was.
Other than that it looks good to me.
telegram/message.py
Outdated
def reply_markdown(self, *args, **kwargs): | ||
"""Shortcut for:: | ||
|
||
bot.sendMessage(update.message.chat_id, parse_mode=ParseMode.MARKDOWN, *args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the snake_case names in docs. (send_message)
telegram/message.py
Outdated
def reply_html(self, *args, **kwargs): | ||
"""Shortcut for:: | ||
|
||
bot.sendMessage(update.message.chat_id, parse_mode=ParseMode.HTML, *args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
tests/test_message.py
Outdated
{'forward_from_chat': Chat(-23, 'channel'), | ||
'forward_from_message_id': 101, | ||
'forward_date': datetime.now()}, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reset the dict to the way it was.
# Conflicts: # telegram/utils/helpers.py
The code itself LGTM. However, I think it's over-engineering and only bloats the code. Though if the other maintainers find it suitable for ptb, I won't object. |
@jh0ker thinks it a good idea to have this in the library. merging. |
I had problems mergin urllib3, so this PR closes #725.
@Eldinnie Indentation adjusted as per your request.
Tests are probably gonna have to wait until pytest stops messing up my workflow...