* Rework middlewares, separate management to `MiddlewareManager` class

* Rework middlewares

* Added changes description for redis

* Added changes description for redis

* Fixed tests with Redis // aioredis replacement

* Changed msg.<html/md>_text attributes behaviour

* Added changelog for spoilers

* Added possibility to get command magic result as handler arguments
This commit is contained in:
Alex Root Junior 2022-04-16 19:07:32 +03:00 committed by GitHub
parent 930bca0876
commit 286cf39c8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 1380 additions and 804 deletions

View file

@ -71,7 +71,7 @@ if TYPE_CHECKING:
from .voice_chat_started import VoiceChatStarted
class Message(TelegramObject):
class _BaseMessage(TelegramObject):
"""
This object represents a message.
@ -195,6 +195,8 @@ class Message(TelegramObject):
reply_markup: Optional[InlineKeyboardMarkup] = None
"""*Optional*. Inline keyboard attached to the message. :code:`login_url` buttons are represented as ordinary :code:`url` buttons."""
class Message(_BaseMessage):
@property
def content_type(self) -> str:
if self.text:
@ -265,11 +267,8 @@ class Message(TelegramObject):
return ContentType.UNKNOWN
def _unparse_entities(self, text_decoration: TextDecoration) -> str:
text = self.text or self.caption
if text is None:
raise TypeError("This message doesn't have any text.")
entities = self.entities or self.caption_entities
text = self.text or self.caption or ""
entities = self.entities or self.caption_entities or []
return text_decoration.unparse(text=text, entities=entities)
@property