diff --git a/hikka/inline/bot_pm.py b/hikka/inline/bot_pm.py
index 6512208..aeff499 100644
--- a/hikka/inline/bot_pm.py
+++ b/hikka/inline/bot_pm.py
@@ -8,8 +8,7 @@
import logging
-from aiogram.types import Message as AiogramMessage
-from typing import Optional, Union
+from typing import Union
from .types import InlineUnit
diff --git a/hikka/inline/core.py b/hikka/inline/core.py
index daa07f7..d518afe 100644
--- a/hikka/inline/core.py
+++ b/hikka/inline/core.py
@@ -127,7 +127,9 @@ class InlineManager(
except YouBlockedUserError:
await self._client(UnblockRequest(id=self.bot_username))
try:
- m = await self._client.send_message(self.bot_username, "/start hikka init")
+ m = await self._client.send_message(
+ self.bot_username, "/start hikka init"
+ )
except Exception:
logger.critical("Can't unblock users bot", exc_info=True)
return False
diff --git a/hikka/inline/events.py b/hikka/inline/events.py
index 417bcc2..345f171 100644
--- a/hikka/inline/events.py
+++ b/hikka/inline/events.py
@@ -6,7 +6,6 @@
# 🔒 Licensed under the GNU AGPLv3
# 🌐 https://www.gnu.org/licenses/agpl-3.0.html
-import functools
import inspect
import logging
import re
diff --git a/hikka/loader.py b/hikka/loader.py
index 37241b5..9131d98 100644
--- a/hikka/loader.py
+++ b/hikka/loader.py
@@ -444,7 +444,7 @@ def tag(*tags, **kwarg_tags):
@loader.tag("no_commands", "out")
@loader.tag("no_commands", out=True)
@loader.tag(only_messages=True)
- @loader.tag("only_messages", "only_pm", regex=r"^\. ?hikka$", from_id=659800858)
+ @loader.tag("only_messages", "only_pm", regex=r"^[.] ?hikka$", from_id=659800858)
💡 These tags can be used directly in `@loader.watcher`:
@loader.watcher("no_commands", out=True)
diff --git a/hikka/modules/hikka_security.py b/hikka/modules/hikka_security.py
index f2914cf..443ea38 100755
--- a/hikka/modules/hikka_security.py
+++ b/hikka/modules/hikka_security.py
@@ -838,6 +838,8 @@ class HikkaSecurityMod(loader.Module):
if duration is not None:
return duration * quantifier
+ return 0
+
def _convert_time(self, duration: int) -> str:
return (
(
@@ -1090,26 +1092,25 @@ class HikkaSecurityMod(loader.Module):
),
)
return
- elif args == "chat":
- if message.is_private:
- await utils.answer(message, self.strings("no_target"))
- return
- target = await self._client.get_entity(message.peer_id)
-
- if not self._client.dispatcher.security.remove_rules("chat", target.id):
- await utils.answer(message, self.strings("no_rules"))
- return
-
- await utils.answer(
- message,
- self.strings("rules_removed").format(
- utils.get_entity_url(target),
- utils.escape_html(get_display_name(target)),
- ),
- )
+ if message.is_private:
+ await utils.answer(message, self.strings("no_target"))
return
+ target = await self._client.get_entity(message.peer_id)
+
+ if not self._client.dispatcher.security.remove_rules("chat", target.id):
+ await utils.answer(message, self.strings("no_rules"))
+ return
+
+ await utils.answer(
+ message,
+ self.strings("rules_removed").format(
+ utils.get_entity_url(target),
+ utils.escape_html(get_display_name(target)),
+ ),
+ )
+
@loader.command(
ru_doc=(
'<"user"/"chat"> [цель - пользователь или чат] [правило - команда или'
diff --git a/hikka/modules/updater.py b/hikka/modules/updater.py
index e0b4089..f1e91cd 100755
--- a/hikka/modules/updater.py
+++ b/hikka/modules/updater.py
@@ -248,7 +248,9 @@ class UpdaterMod(loader.Module):
msg_obj,
self.strings("restarting_caption").format(
utils.get_platform_emoji()
- if self._client.hikka_me.premium and CUSTOM_EMOJIS and isinstance(msg_obj, Message)
+ if self._client.hikka_me.premium
+ and CUSTOM_EMOJIS
+ and isinstance(msg_obj, Message)
else "Hikka"
)
if "LAVHOST" not in os.environ
@@ -257,7 +259,9 @@ class UpdaterMod(loader.Module):
' document_id="5193117564015747203">✌️✌️✌️'
- if self._client.hikka_me.premium and CUSTOM_EMOJIS and isinstance(msg_obj, Message)
+ if self._client.hikka_me.premium
+ and CUSTOM_EMOJIS
+ and isinstance(msg_obj, Message)
else "lavHost"
),
)
@@ -392,7 +396,9 @@ class UpdaterMod(loader.Module):
' document_id="5193117564015747203">✌️✌️✌️'
- if self._client.hikka_me.premium and CUSTOM_EMOJIS and isinstance(msg_obj, Message)
+ if self._client.hikka_me.premium
+ and CUSTOM_EMOJIS
+ and isinstance(msg_obj, Message)
else "lavHost"
),
)
diff --git a/hikka/security.py b/hikka/security.py
index 23a022d..832ab89 100755
--- a/hikka/security.py
+++ b/hikka/security.py
@@ -328,7 +328,8 @@ class SecurityManager:
if info["rule_type"] == "command" and info["rule"] == cmd:
logger.debug(f"tsec match for user {cmd}")
return True
- elif (
+
+ if (
info["rule_type"] == "module"
and info["rule"] == func.__self__.__class__.__name__
):
@@ -343,7 +344,8 @@ class SecurityManager:
if info["rule_type"] == "command" and info["rule"] == cmd:
logger.debug(f"tsec match for {cmd}")
return True
- elif (
+
+ if (
info["rule_type"] == "module"
and info["rule"] == func.__self__.__class__.__name__
):