Part of v1.2.11 update

Check changelogs for more info
pull/1/head
hikariatama 2022-07-16 21:56:43 +00:00
parent 08443aa775
commit 1f6c44e903
4 changed files with 20 additions and 17 deletions

View File

@ -22,6 +22,8 @@
- Fix back button in `.config <lib>`
- New `.e` error format
- Ignore folder creation error
- Fix unload error in module without commands
- Rework aiogram media processing on edit
## 🌑 Hikka 1.2.10

View File

@ -910,11 +910,7 @@ class Modules:
for mod in self.modules:
self.send_config_one(mod, skip_hook)
def send_config_one(
self,
mod: "Module",
skip_hook: bool = False
):
def send_config_one(self, mod: "Module", skip_hook: bool = False):
"""Send config to single instance"""
with contextlib.suppress(AttributeError):
_hikka_client_id_logging_tag = copy.copy(self.client.tg_id)
@ -974,12 +970,7 @@ class Modules:
self.inline = inline_manager
try:
await asyncio.gather(
*[
self.send_ready_one(mod)
for mod in self.modules
]
)
await asyncio.gather(*[self.send_ready_one(mod) for mod in self.modules])
except Exception as e:
logger.exception(f"Failed to send mod init complete signal due to {e}")
@ -1139,7 +1130,11 @@ class Modules:
getattr(module, method).stop()
logger.debug(f"Stopped loop in {module=}, {method=}")
to_remove += module.commands.values()
to_remove += (
module.commands
if isinstance(getattr(module, "commands", None), dict)
else {}
).values()
if hasattr(module, "watcher"):
to_remove += [module.watcher]

View File

@ -55,6 +55,7 @@ class HikkaException:
tb: traceback.TracebackException,
) -> "HikkaException":
def to_hashable(dictionary: dict) -> dict:
dictionary = dictionary.copy()
for key, value in dictionary.items():
if isinstance(value, dict):
if (
@ -92,11 +93,16 @@ class HikkaException:
)
filename, lineno, name = next(
re.search(line_regex, line).groups()
for line in full_stack.splitlines()
if re.search(line_regex, line)
(
re.search(line_regex, line).groups()
for line in full_stack.splitlines()
if re.search(line_regex, line)
),
(None, None, None),
)
line = next(
(line for line in full_stack.splitlines() if line.startswith(" ")), ""
)
line = next(line for line in full_stack.splitlines() if line.startswith(" "))
full_stack = "\n".join(
[

View File

@ -114,7 +114,7 @@ class HikkaBackupMod(loader.Module):
await call.delete()
return
self.set("period", value)
self.set("period", value * 60 * 60)
self.set("last_backup", round(time.time()))
await call.answer(self.strings("saved"), show_alert=True)