From 405b05bda9131a10d71705a06be2bd2daa978f4f Mon Sep 17 00:00:00 2001 From: RootShinobi <111008396+RootShinobi@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:46:29 +0200 Subject: [PATCH] update readme --- README.md | 6 ++---- aiogram_i18n/__init__.py | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4cd11dc..375f7bf 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ To use FluentCompileCore: To use FluentRuntimeCore: ```pip install fluent.runtime``` - ```python import asyncio from contextlib import suppress @@ -21,14 +20,13 @@ from aiogram.enums import ParseMode from aiogram.filters import CommandStart from aiogram.types import Message -from aiogram_i18n import I18nContext, LazyProxy, I18nMiddleware +from aiogram_i18n import I18nContext, LazyProxy, I18nMiddleware, LazyFilter from aiogram_i18n.cores.fluent_runtime_core import FluentRuntimeCore from aiogram_i18n.types import ( ReplyKeyboardMarkup, KeyboardButton # you should import mutable objects from here if you want to use LazyProxy in them ) - router = Router(name=__name__) rkb = ReplyKeyboardMarkup( keyboard=[ @@ -46,7 +44,7 @@ async def cmd_start(message: Message, i18n: I18nContext) -> Any: ) -@router.message(F.text == LazyProxy("help")) +@router.message(LazyFilter("help")) # or LazyProxy("help") or F.text == LazyProxy("help") async def cmd_help(message: Message) -> Any: return message.reply(text="-- " + message.text + " --") diff --git a/aiogram_i18n/__init__.py b/aiogram_i18n/__init__.py index d9ac71c..afe0eb3 100644 --- a/aiogram_i18n/__init__.py +++ b/aiogram_i18n/__init__.py @@ -1,6 +1,6 @@ from .__meta__ import __version__ from .context import I18nContext -from .lazy import LazyFactory, LazyProxy +from .lazy import LazyFactory, LazyProxy, LazyFilter from .middleware import I18nMiddleware L = LazyFactory() @@ -9,6 +9,7 @@ "__version__", "I18nContext", "LazyProxy", + "LazyFilter", "I18nMiddleware", "L", )