Fix live photo identification - #1857
Conversation
❌ Changelog is required!You need to add a brief description of the changes to the Changes file should be named like The content of the file should be a brief description of the changes in Possible categories are: |
| ).as_(self._bot) | ||
|
|
||
| raise TypeError("This type of message can't be copied.") | ||
| match (self.content_type): |
There was a problem hiding this comment.
These changes are not related to the original problem, so they should not be changed here.
Another point is that this change reduces performance because instead of directly checking the attributes, it determines the content type and then falls back to the logic.
At the same time, when directly checking attributes, it tells type checkers that the checked attribute is not None, so it unwraps the "Optional" layer from the type, and when the attribute is passed to an API method, it clearly remains as required/passed, but when you don't check, it remains optional and is incompatible with API calls where these attributes remain required.
Description
content_typeproperty identification for a live photo message.ifblocks tomatchstatement oncontent_typeproperty.Fixes #1841
Type of change
Checklist: