-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix of Bot.copy_message #2651
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
Fix of Bot.copy_message #2651
Conversation
When you pass "" as a caption to this method, the caption is not sent to the Telegram API, because the if on line 5299 does not allow it to insert it in the dict of data to be sent to the Telegram API
|
Hm. How does this result in unwanted behavior? Can you delete an existing caption this way? |
Yes, this change allows you to remove the caption |
|
Ah. Great catch. Can you write a test verifying that it works now? |
|
Yes, now I try |
|
Oh no. Thats fine, I believed you that your change was working in the first place :D I asked for a unitest, can you do that? We have them in the |
|
Sorry, can you explain better? 😅 |
|
What pool means is that we have automated unit tests, which life in the |
|
Ok, thanks for the help |
Is this correct? https://pastebin.com/Af9fPsfH Result: tests/test_bot.py::TestBot::test_copy_message[Test-True] PASSED [ 16%] ================================================== 6 passed in 2.22s ================================================== |
Bibo-Joshi
left a comment
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.
looks good except for the failing pre-commit test :) I you like to, we could add another test in the style of test_copy_message_without_reply, which actually checks the result on the copied message instad of just checking that we pass the correct parameters to TG, but IMO that's optional.
|
Thanks for the contribution! |
When you pass "" as a caption to this method, the caption is not sent to the Telegram API, because the if on line 5299 does not allow it to insert it in the dict of data to be sent to the Telegram API