Skip to content
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

[3.x] Change msg.html_text behaviour #874

Closed
Olegt0rr opened this issue Apr 3, 2022 · 0 comments · Fixed by #884
Closed

[3.x] Change msg.html_text behaviour #874

Olegt0rr opened this issue Apr 3, 2022 · 0 comments · Fixed by #884
Labels
3.x Issue or PR for stable 3.x version breaking This breaks backwards-compatibility enhancement Make it better!

Comments

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Apr 3, 2022

Description

Every time when I use message.html_text in my projects, I use construct like this:

text = message.html_text if (message.text or message.caption) else None

cause with current behavior, calling html_text on None will raise an error TypeError: This message doesn't have any text.

With try I also should use code like this:

try:
    text = message.html_text
except TypeError:
    text = None

Describe the solution you'd like

I'd like to make it return None instead of raising an error.
This way it will be more similar to basic message and caption params behaviour. If it's empty - return None.

@Olegt0rr Olegt0rr added enhancement Make it better! breaking This breaks backwards-compatibility 3.x Issue or PR for stable 3.x version labels Apr 3, 2022
@JrooTJunior JrooTJunior linked a pull request Apr 11, 2022 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issue or PR for stable 3.x version breaking This breaks backwards-compatibility enhancement Make it better!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants