From 8b047073538dc07168d60e100533e37a696c5f8b Mon Sep 17 00:00:00 2001 From: hikariatama Date: Sun, 14 Aug 2022 21:38:42 +0000 Subject: [PATCH] Fix tags error in aiogram --- hikka/inline/form.py | 2 +- hikka/inline/list.py | 8 +++++--- hikka/inline/utils.py | 4 ++-- hikka/modules/updater.py | 23 ++++++++--------------- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/hikka/inline/form.py b/hikka/inline/form.py index 1007ec3..0e820bf 100644 --- a/hikka/inline/form.py +++ b/hikka/inline/form.py @@ -122,7 +122,7 @@ class Form(InlineUnit): logger.error("Invalid type for `text`") return False - text = self._sanitise_text(text) + text = self.sanitise_text(text) if not isinstance(silent, bool): logger.error("Invalid type for `silent`") diff --git a/hikka/inline/list.py b/hikka/inline/list.py index e2100c1..af55103 100644 --- a/hikka/inline/list.py +++ b/hikka/inline/list.py @@ -236,9 +236,11 @@ class List(InlineUnit): try: await self.bot.edit_message_text( inline_message_id=call.inline_message_id, - text=self._units[unit_id]["strings"][ - self._units[unit_id]["current_index"] - ], + text=self.sanitise_text( + self._units[unit_id]["strings"][ + self._units[unit_id]["current_index"] + ] + ), reply_markup=self._list_markup(unit_id), ) await call.answer() diff --git a/hikka/inline/utils.py b/hikka/inline/utils.py index 521a9e3..9776e27 100644 --- a/hikka/inline/utils.py +++ b/hikka/inline/utils.py @@ -255,7 +255,7 @@ class Utils(InlineUnit): return reply_markup - def _sanitise_text(self, text: str) -> str: + def sanitise_text(self, text: str) -> str: """Replaces all animated emojis in text with normal ones, bc aiogram doesn't support them""" return re.sub(r"", "", text) @@ -313,7 +313,7 @@ class Utils(InlineUnit): audio = {"url": audio} if isinstance(text, str): - text = self._sanitise_text(text) + text = self.sanitise_text(text) media_params = [ photo is None, diff --git a/hikka/modules/updater.py b/hikka/modules/updater.py index 511494c..e883a9a 100755 --- a/hikka/modules/updater.py +++ b/hikka/modules/updater.py @@ -74,16 +74,12 @@ class UpdaterMod(loader.Module): "origin_cfg_doc": "Git origin URL, for where to update from", "btn_restart": "🔄 Restart", "btn_update": "🧭 Update", - "restart_confirm": ( - " Are you sure you" - " want to restart?" - ), + "restart_confirm": "❓ Are you sure you want to restart?", "secure_boot_confirm": ( - " Are you sure you" - " want to restart in secure boot mode?" + "❓ Are you sure you want to restart in secure boot mode?" ), "update_confirm": ( - " Are you sure you" + "❓ Are you sure you" " want to update?\n\n{} ⤑ {}' @@ -145,16 +141,13 @@ class UpdaterMod(loader.Module): "origin_cfg_doc": "Ссылка, из которой будут загружаться обновления", "btn_restart": "🔄 Перезагрузиться", "btn_update": "🧭 Обновиться", - "restart_confirm": ( - " Ты уверен, что" - " хочешь перезагрузиться?" - ), + "restart_confirm": "❓ Ты уверен, что хочешь перезагрузиться?", "secure_boot_confirm": ( - " Ты уверен, что" + "❓ Ты уверен, что" " хочешь перезагрузиться в режиме безопасной загрузки?" ), "update_confirm": ( - " Ты уверен, что" + "❓ Ты уверен, что" " хочешь обновиться??\n\n{} ⤑ {}' @@ -566,7 +559,7 @@ class UpdaterMod(loader.Module): await self.inline.bot.edit_message_text( inline_message_id=ms, - text=msg, + text=self.inline.sanitise_text(msg), ) async def full_restart_complete(self, secure_boot: bool = False): @@ -599,7 +592,7 @@ class UpdaterMod(loader.Module): await self.inline.bot.edit_message_text( inline_message_id=ms, - text=msg, + text=self.inline.sanitise_text(msg), )