- Fix non-working inline in `.logs`
- Fix unit deletion via "action" attr
- Fix module load error, if invalid entity was specified in #meta developer
- Hopefully fix config
- Remove notification about setattr error in dispatcher
pull/1/head
hikariatama 2022-06-12 15:23:48 +00:00
parent 19ebbe85a0
commit 7e5b9ad58d
8 changed files with 17 additions and 11 deletions

View File

@ -434,13 +434,13 @@ class CommandDispatcher:
# of attributes
for placeholder in {"text", "raw_text"}:
try:
if not hasattr(event, placeholder):
setattr(event, placeholder, "")
if not hasattr(message, placeholder):
setattr(message, placeholder, "")
except UnicodeDecodeError:
logging.critical(
"Hikka issued error on updates\n"
"This is not your fault, please, report this issue in @hikka_talks along with info below:\n\n"
f"{type(event)=}, {event=}, {placeholder=}"
f"{type(message)=}, {message=}, {placeholder=}"
)
# Run watcher via ensure_future so in case user has a lot

View File

@ -72,7 +72,7 @@ class InlineManager(
"""Cleans outdated inline units"""
while True:
for unit_id, unit in self._units.copy().items():
if unit.get("ttl", time.time() + self._markup_ttl) < time.time():
if (unit.get("ttl") or (time.time() + self._markup_ttl)) < time.time():
del self._units[unit_id]
await asyncio.sleep(5)

View File

@ -264,7 +264,6 @@ class Events(InlineUnit):
)
return
del self._units[unit_id]
return result
if query.data in self._custom_map:

View File

@ -55,7 +55,7 @@ class Form(InlineUnit):
always_allow: Optional[List[list]] = None,
manual_security: Optional[bool] = False,
disable_security: Optional[bool] = False,
ttl: Optional[Union[int, bool]] = False,
ttl: Optional[int] = None,
on_unload: Optional[FunctionType] = None,
photo: Optional[str] = None,
gif: Optional[str] = None,

View File

@ -631,7 +631,6 @@ class HikkaConfigMod(loader.Module):
"🌘 <b>Loading configuration</b>",
message,
{"text": "🌘", "data": "empty"},
ttl=60 * 60,
)
await self.inline__configure(form, args)
return

View File

@ -51,7 +51,7 @@ class InlineStuffMod(loader.Module):
getattr(message, "out", False)
and getattr(message, "via_bot_id", False)
and message.via_bot_id == self.inline.bot_id
and "This message is gonna be deleted..."
and "This message will be deleted automatically"
in getattr(message, "raw_text", "")
):
await message.delete()

View File

@ -804,9 +804,17 @@ class LoaderMod(loader.Module):
},
]
try:
is_channel = isinstance(
await self._client.get_entity(developer),
Channel,
)
except Exception:
is_channel = False
developer = self.strings("developer").format(
utils.escape_html(developer)
if isinstance(await self._client.get_entity(developer), Channel)
if is_channel
else f"<code>{utils.escape_html(developer)}</code>"
)
else:

View File

@ -264,7 +264,7 @@ class TestMod(loader.Module):
"args": (False, 0),
},
],
[{"text": "🚫 Cancel", "callback": self.cancel}],
[{"text": "🚫 Cancel", "action": "close"}],
],
message=message,
):
@ -313,7 +313,7 @@ class TestMod(loader.Module):
"callback": self.logscmd,
"args": [True, lvl],
},
{"text": "🚫 Cancel", "callback": self.cancel},
{"text": "🚫 Cancel", "action": "close"},
],
}
if isinstance(message, Message):