mirror of https://github.com/coddrago/Heroku
Deepsource fixes
parent
ea24b1afc9
commit
8f4ba2c170
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"> [цель - пользователь или чат] [правило - команда или'
|
||||
|
|
|
@ -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">✌️</emoji><emoji'
|
||||
' document_id="5195050806105087456">✌️</emoji><emoji'
|
||||
' document_id="5195457642587233944">✌️</emoji><b>'
|
||||
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">✌️</emoji><emoji'
|
||||
' document_id="5195050806105087456">✌️</emoji><emoji'
|
||||
' document_id="5195457642587233944">✌️</emoji><b>'
|
||||
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"
|
||||
),
|
||||
)
|
||||
|
|
|
@ -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__
|
||||
):
|
||||
|
|
Loading…
Reference in New Issue