From d9f58b5a41321c5382f041f6c532c20a4007b445 Mon Sep 17 00:00:00 2001 From: Snek <97262062+sn3kdev@users.noreply.github.com> Date: Wed, 27 Nov 2024 22:56:48 +0200 Subject: [PATCH] Add blockquotes to text decorations --- aiogram/utils/text_decorations.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aiogram/utils/text_decorations.py b/aiogram/utils/text_decorations.py index b7a8ae86..00686f7a 100644 --- a/aiogram/utils/text_decorations.py +++ b/aiogram/utils/text_decorations.py @@ -137,6 +137,10 @@ class TextDecoration(ABC): def underline(self, value: str) -> str: # pragma: no cover pass + @abstractmethod + def underline(self, value: str) -> str: # pragma: no cover + pass + @abstractmethod def strikethrough(self, value: str) -> str: # pragma: no cover pass @@ -145,6 +149,10 @@ class TextDecoration(ABC): def quote(self, value: str) -> str: # pragma: no cover pass + @abstractmethod + def blockquote(self, value: str) -> str: #pragma: no cover + return f"
{value}
" + @abstractmethod def custom_emoji(self, value: str, custom_emoji_id: str) -> str: # pragma: no cover pass @@ -178,6 +186,9 @@ class HtmlDecoration(TextDecoration): def strikethrough(self, value: str) -> str: return f"{value}" + def blockquote(self, value: str) -> str: + return f"
{value}
" + def quote(self, value: str) -> str: return html.escape(value, quote=False) @@ -215,6 +226,9 @@ class MarkdownDecoration(TextDecoration): def strikethrough(self, value: str) -> str: return f"~{value}~" + def blockquote(self, value: str) -> str: + return f">{value}" + def quote(self, value: str) -> str: return re.sub(pattern=self.MARKDOWN_QUOTE_PATTERN, repl=r"\\\1", string=value)