mirror of https://github.com/coddrago/Heroku
1.2.13
- Add `@loader.tag("only_commands")` for watchers. Captures only userbot commands - Add `@loader.tag("editable")` for watchers. Captures only messages, which can be edited - Replace token obtainment mechanism with callback instead of inlinepull/1/head
parent
eb33b70939
commit
f7eb19b3f0
|
@ -9,6 +9,9 @@
|
|||
- Add `@loader.tag("out")` for watchers. Captures only outgoing events
|
||||
- Add `@loader.tag("in")` for watchers. Captures only incoming events
|
||||
- Add `@loader.tag("only_messages")` for watchers. Captures only messages (not service events)
|
||||
- Add `@loader.tag("only_commands")` for watchers. Captures only userbot commands
|
||||
- Add `@loader.tag("editable")` for watchers. Captures only messages, which can be edited
|
||||
- Replace token obtainment mechanism with callback instead of inline
|
||||
- Do not cut off prefix in `message.message`, `message.text` and `message.raw_text`
|
||||
- Partially rework events processing and dispatching
|
||||
- Attempt to fix cached entities mixing up
|
||||
|
|
|
@ -416,14 +416,29 @@ class CommandDispatcher:
|
|||
or whitelist_modules
|
||||
and f"{str(utils.get_chat_id(message))}.{func.__self__.__module__}"
|
||||
not in whitelist_modules
|
||||
or getattr(func, "no_commands", False)
|
||||
and await self._handle_command(event, watcher=True)
|
||||
or getattr(func, "out", False)
|
||||
and not getattr(message, "out", True)
|
||||
or getattr(func, "in", False)
|
||||
and getattr(message, "out", True)
|
||||
or getattr(func, "only_messages", False)
|
||||
and not isinstance(message, types.Message)
|
||||
or (
|
||||
getattr(func, "no_commands", False)
|
||||
and await self._handle_command(event, watcher=True)
|
||||
)
|
||||
or (
|
||||
getattr(func, "only_commands", False)
|
||||
and not await self._handle_command(event, watcher=True)
|
||||
)
|
||||
or (getattr(func, "out", False) and not getattr(message, "out", True))
|
||||
or (getattr(func, "in", False) and getattr(message, "out", True))
|
||||
or (
|
||||
getattr(func, "only_messages", False)
|
||||
and not isinstance(message, types.Message)
|
||||
)
|
||||
or (
|
||||
getattr(func, "editable", False)
|
||||
and (
|
||||
getattr(message, "fwd_from", False)
|
||||
or not getattr(message, "out", False)
|
||||
or getattr(message, "sticker", False)
|
||||
or getattr(message, "via_bot_id", False)
|
||||
)
|
||||
)
|
||||
):
|
||||
logging.debug(f"Ignored watcher of module {modname}")
|
||||
continue
|
||||
|
|
|
@ -392,9 +392,11 @@ def tag(*tags, **kwarg_tags):
|
|||
Tag function (esp. watchers) with some tags
|
||||
Currently available tags:
|
||||
• `no_commands` - Ignore all userbot commands in watcher
|
||||
• `only_commands` - Capture only userbot commands in watcher
|
||||
• `out` - Capture only outgoing events
|
||||
• `in` - Capture only incoming events
|
||||
• `only_messages` - Capture only messages (not join events)
|
||||
• `editable` - Capture only messages, which can be edited (no forwards etc.)
|
||||
|
||||
Usage example:
|
||||
|
||||
|
|
|
@ -651,10 +651,10 @@ class LoaderMod(loader.Module):
|
|||
self.set(
|
||||
"token",
|
||||
(
|
||||
await self._client.inline_query(
|
||||
"@hikkamods_bot", "#get_hikka_token"
|
||||
)
|
||||
)[0].title,
|
||||
await (await self._client.get_messages("@hikka_ub", ids=[10]))[
|
||||
0
|
||||
].click(0)
|
||||
).message,
|
||||
)
|
||||
|
||||
res = await utils.run_sync(
|
||||
|
|
Loading…
Reference in New Issue