Minor bug fixes

pull/1/head
hikari.ftg 2022-04-03 10:45:08 +00:00
parent 94a7bdc221
commit 15bc667860
9 changed files with 17 additions and 41 deletions

View File

@ -158,10 +158,13 @@ class InlineManager(Gallery, Form, BotInteractions, Events, TokenObtainment):
) )
for stack_entry in inspect.stack() for stack_entry in inspect.stack()
if hasattr(stack_entry, "function") if hasattr(stack_entry, "function")
and stack_entry.function.endswith("cmd") and (
stack_entry.function.endswith("cmd")
or stack_entry.function.endswith("_inline_handler")
)
) )
except Exception: except Exception:
logger.exception("Can't parse security mask in form") logger.debug("Can't parse security mask in form", exc_info=True)
return None return None
async def _register_manager( async def _register_manager(

View File

@ -53,12 +53,6 @@ class HelpMod(loader.Module):
lambda: "Plain module bullet" lambda: "Plain module bullet"
) )
def get(self, *args) -> dict:
return self._db.get(self.strings["name"], *args)
def set(self, *args) -> None:
return self._db.set(self.strings["name"], *args)
async def helphidecmd(self, message: Message) -> None: async def helphidecmd(self, message: Message) -> None:
"""<module or modules> - Hide module(-s) from help """<module or modules> - Hide module(-s) from help
*Split modules by spaces""" *Split modules by spaces"""

View File

@ -38,12 +38,6 @@ class HikkaConfigMod(loader.Module):
"option_saved": "🎚 <b>Configuring option </b><code>{}</code><b> of mod </b><code>{}</code><b> saved!</b>\n<b>Current: </b><code>{}</code>", "option_saved": "🎚 <b>Configuring option </b><code>{}</code><b> of mod </b><code>{}</code><b> saved!</b>\n<b>Current: </b><code>{}</code>",
} }
def get(self, *args) -> dict:
return self._db.get(self.strings["name"], *args)
def set(self, *args) -> None:
return self._db.set(self.strings["name"], *args)
async def client_ready(self, client, db) -> None: async def client_ready(self, client, db) -> None:
self._db = db self._db = db
self._client = client self._client = client

View File

@ -32,12 +32,6 @@ class HikkaInfoMod(loader.Module):
strings = {"name": "HikkaInfo"} strings = {"name": "HikkaInfo"}
def get(self, *args) -> dict:
return self._db.get(self.strings["name"], *args)
def set(self, *args) -> None:
return self._db.set(self.strings["name"], *args)
async def client_ready(self, client, db) -> None: async def client_ready(self, client, db) -> None:
self._db = db self._db = db
self._client = client self._client = client

View File

@ -89,12 +89,6 @@ class HikkaSecurityMod(loader.Module):
"restart": "<i>🔄 Restart may be required to commit changes</i>", "restart": "<i>🔄 Restart may be required to commit changes</i>",
} }
def get(self, *args) -> dict:
return self._db.get(self.strings["name"], *args)
def set(self, *args) -> None:
return self._db.set(self.strings["name"], *args)
async def client_ready(self, client, db) -> None: async def client_ready(self, client, db) -> None:
self._db = db self._db = db
self._client = client self._client = client
@ -232,7 +226,6 @@ class HikkaSecurityMod(loader.Module):
def _perms_map(perms: int, is_inline: bool) -> dict: def _perms_map(perms: int, is_inline: bool) -> dict:
return ( return (
{ {
"owner": bool(perms & OWNER),
"sudo": bool(perms & SUDO), "sudo": bool(perms & SUDO),
"support": bool(perms & SUPPORT), "support": bool(perms & SUPPORT),
"group_owner": bool(perms & GROUP_OWNER), "group_owner": bool(perms & GROUP_OWNER),
@ -250,7 +243,6 @@ class HikkaSecurityMod(loader.Module):
} }
if not is_inline if not is_inline
else { else {
"owner": bool(perms & OWNER),
"sudo": bool(perms & SUDO), "sudo": bool(perms & SUDO),
"support": bool(perms & SUPPORT), "support": bool(perms & SUPPORT),
"everyone": bool(perms & EVERYONE), "everyone": bool(perms & EVERYONE),

View File

@ -245,7 +245,9 @@ class HikkaSettingsMod(loader.Module):
await call.delete() await call.delete()
async def inline__update( async def inline__update(
self, call: CallbackQuery, confirm_required: bool = False self,
call: CallbackQuery,
confirm_required: bool = False,
) -> None: ) -> None:
if confirm_required: if confirm_required:
await call.edit( await call.edit(
@ -265,7 +267,9 @@ class HikkaSettingsMod(loader.Module):
await self.allmodules.commands["update"](m) await self.allmodules.commands["update"](m)
async def inline__restart( async def inline__restart(
self, call: CallbackQuery, confirm_required: bool = False self,
call: CallbackQuery,
confirm_required: bool = False,
) -> None: ) -> None:
if confirm_required: if confirm_required:
await call.edit( await call.edit(

View File

@ -54,6 +54,8 @@ class InlineStuffMod(loader.Module):
id_ = re.search(r"#id: ([a-zA-Z0-9]+)", message.raw_text).group(1) id_ = re.search(r"#id: ([a-zA-Z0-9]+)", message.raw_text).group(1)
await message.delete()
m = await message.respond("👩‍🎤 <b>Opening gallery... wait</b>") m = await message.respond("👩‍🎤 <b>Opening gallery... wait</b>")
await self.inline.gallery( await self.inline.gallery(
@ -62,8 +64,6 @@ class InlineStuffMod(loader.Module):
caption=self.inline._custom_map[id_].get("caption", ""), caption=self.inline._custom_map[id_].get("caption", ""),
) )
await message.delete()
async def _check_bot(self, username: str) -> bool: async def _check_bot(self, username: str) -> bool:
async with self._client.conversation("@BotFather", exclusive=False) as conv: async with self._client.conversation("@BotFather", exclusive=False) as conv:
try: try:

View File

@ -57,15 +57,7 @@ if "OKTETO" in os.environ:
class QuickstartMod(loader.Module): class QuickstartMod(loader.Module):
"""Notifies user about userbot installation""" """Notifies user about userbot installation"""
strings = { strings = {"name": "Quickstart"}
"name": "Quickstart"
}
def get(self, *args) -> dict:
return self._db.get(self.strings["name"], *args)
def set(self, *args) -> None:
return self._db.set(self.strings["name"], *args)
async def client_ready(self, client, db) -> None: async def client_ready(self, client, db) -> None:
self._me = (await client.get_me()).id self._me = (await client.get_me()).id

View File

@ -249,6 +249,9 @@ class SecurityManager:
if user in self._db.get(main.__name__, "blacklist_users", []): if user in self._db.get(main.__name__, "blacklist_users", []):
return False return False
if message is None: # In case of checking inline query security map
return bool(config & EVERYONE)
if f_group_member and message.is_group or f_pm and message.is_private: if f_group_member and message.is_group or f_pm and message.is_private:
return True return True