Closed
Description
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
.