garnet
garnet copied to clipboard
Todos
todo!
- Optimize Filter instances as they're something that gets created a lot in code. Possibly make filters immutable.
class Filter(NamedTuple): pass
or, simpler:
Filter = dataclass(frozen=True)(Filter)
States are just a type of filters.
- Smartish code pattern generation based on given states group definition.
no examples.
- Nicer way to connect existing handlers to interoperate in the cases like:
# mod1.py
baker: QueryBaker = ...
handler(...): mod2.baker.get_checked(...)
# mod2.py
baker: QueryBaker = ...
handler(...): mod1.baker.get_checked(...)
-
Introduce gettext and I18N data to users.
-
[long-term] make garnet a frontend to any telethon-like library and not just telethon.
-
Filter pipelines and stacks:
from garnet.filters import Pipeline, Stack
pp = Pipeline(user_exists, in_entry_state, is_allowed_cmd)
@router.message(pp.pop(1)) # will compose Stack().include (user_exists, is_allowed_cmd)
async def _(_): ...
stack = Stack(user_exists, in_entry_state, is_allowed_cmd)
@router.message(stack.include(0, 1)) # will drop is_allowed_cmd
async def _(_): ...