diff --git a/CHANGES.rst b/CHANGES.rst index d0a80500..2ab30aa9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,54 @@ Changelog .. towncrier release notes start +3.0.0b1 (2021-12-12) +===================== + +Features +-------- + +- Added new custom operation for MagicFilter named :code:`as_` + + Now you can use it to get magic filter result as handler argument + + .. code-block:: python + + from aiogram import F + + ... + + @router.message(F.text.regexp(r"^(\d+)$").as_("digits")) + async def any_digits_handler(message: Message, digits: Match[str]): + await message.answer(html.quote(str(digits))) + + + @router.message(F.photo[-1].as_("photo")) + async def download_photos_handler(message: Message, photo: PhotoSize, bot: Bot): + content = await bot.download(photo) + `#759 `_ + + +Bugfixes +-------- + +- Fixed: Missing :code:`ChatMemberHandler` import in :code:`aiogram/dispatcher/handler` + `#751 `_ + + +Misc +---- + +- Check :code:`destiny` in case of no :code:`with_destiny` enabled in RedisStorage key builder + `#776 `_ +- Added full support of `Bot API 5.5 `_ + `#777 `_ +- Stop using feature from #336. From now settings of client-session should be placed as initializer arguments instead of changing instance attributes. + `#778 `_ +- Make TelegramAPIServer files wrapper in local mode bi-directional (server-client, client-server) + Now you can convert local path to server path and server path to local path. + `#779 `_ + + 3.0.0a18 (2021-11-10) ====================== diff --git a/CHANGES/751.bugfix b/CHANGES/751.bugfix deleted file mode 100644 index 7040b812..00000000 --- a/CHANGES/751.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fixed: Missing :code:`ChatMemberHandler` import in :code:`aiogram/dispatcher/handler` diff --git a/CHANGES/759.feature b/CHANGES/759.feature deleted file mode 100644 index da4a0d99..00000000 --- a/CHANGES/759.feature +++ /dev/null @@ -1,13 +0,0 @@ -Added new custom operation for MagicFilter named :code:`as_` - -Now you can use it to get magic filter result as handler argument - -.. code-block:: python - - from aiogram import F - - ... - - @router.message(F.text.regexp(r"^(\d+)$").as_("digits")) - async def any_digits_handler(message: Message, digits: Match[str]): - await message.answer(html.quote(str(digits))) diff --git a/CHANGES/776.misc b/CHANGES/776.misc deleted file mode 100644 index 2dd825f5..00000000 --- a/CHANGES/776.misc +++ /dev/null @@ -1 +0,0 @@ -Check :code:`destiny` in case of no :code:`with_destiny` enabled in RedisStorage key builder diff --git a/CHANGES/777.misc b/CHANGES/777.misc deleted file mode 100644 index 59c5cbc8..00000000 --- a/CHANGES/777.misc +++ /dev/null @@ -1 +0,0 @@ -Added full support of `Bot API 5.5 `_ diff --git a/CHANGES/778.misc b/CHANGES/778.misc deleted file mode 100644 index 7fe2f8dd..00000000 --- a/CHANGES/778.misc +++ /dev/null @@ -1 +0,0 @@ -Stop using feature from #336. From now settings of client-session should be placed as initializer arguments instead of changing instance attributes. diff --git a/CHANGES/779.misc b/CHANGES/779.misc deleted file mode 100644 index 7ff24c3e..00000000 --- a/CHANGES/779.misc +++ /dev/null @@ -1,2 +0,0 @@ -Make TelegramAPIServer files wrapper in local mode bi-directional (server-client, client-server) -Now you can convert local path to server path and server path to local path. diff --git a/README.rst b/README.rst index 4633118c..9341b65a 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,6 @@ -####### -aiogram -####### +#################### +aiogram |beta badge| +#################### .. danger:: This version still in development! @@ -78,3 +78,7 @@ Features - `English language `_ - `Russian language `_ + + +.. |beta badge| image:: https://img.shields.io/badge/-beta-orange + :alt: Beta badge diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 320acd7e..a820ee6c 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -36,5 +36,5 @@ __all__ = ( "md", ) -__version__ = "3.0.0a19" +__version__ = "3.0.0b1" __api_version__ = "5.5" diff --git a/docs/api/session/aiohttp.rst b/docs/api/session/aiohttp.rst index 3a595d1b..7dd9713b 100644 --- a/docs/api/session/aiohttp.rst +++ b/docs/api/session/aiohttp.rst @@ -17,7 +17,7 @@ Usage example from aiogram.session.aiohttp import AiohttpSession session = AiohttpSession() - Bot('42:token', session=session) + bot = Bot('42:token', session=session) Proxy requests in AiohttpSession @@ -33,7 +33,7 @@ Binding session to bot: from aiogram.client.session.aiohttp import AiohttpSession session = AiohttpSession(proxy="protocol://host:port/") - Bot(token="bot token", session=session) + bot = Bot(token="bot token", session=session) .. note:: diff --git a/docs/api/session/custom_server.rst b/docs/api/session/custom_server.rst index fe2b86f4..23126551 100644 --- a/docs/api/session/custom_server.rst +++ b/docs/api/session/custom_server.rst @@ -8,6 +8,7 @@ For example, if you want to use self-hosted API server: .. code-block:: python3 - session = AiohttpSession() - session.api = TelegramAPIServer.from_base('http://localhost:8082') + session = AiohttpSession( + api=TelegramAPIServer.from_base('http://localhost:8082') + ) bot = Bot(..., session=session) diff --git a/docs/dispatcher/middlewares.rst b/docs/dispatcher/middlewares.rst index af20d01e..55875eb2 100644 --- a/docs/dispatcher/middlewares.rst +++ b/docs/dispatcher/middlewares.rst @@ -65,10 +65,10 @@ Class-based .. code-block:: python from aiogram import BaseMiddleware - from aiogram.api.types import Message + from aiogram.types import Message - class CounterMiddleware(BaseMiddleware[Message]): + class CounterMiddleware(BaseMiddleware): def __init__(self) -> None: self.counter = 0 diff --git a/examples/multibot.py b/examples/multibot.py index 573b1f1d..82c31715 100644 --- a/examples/multibot.py +++ b/examples/multibot.py @@ -28,6 +28,8 @@ MAIN_BOT_PATH = "/webhook/main" OTHER_BOTS_PATH = "/webhook/bot/{bot_token}" REDIS_DSN = "redis://127.0.0.1:6479" +OTHER_BOTS_URL = f"{BASE_URL}{OTHER_BOTS_PATH}" + def is_bot_token(value: str) -> Union[bool, Dict[str, Any]]: try: @@ -45,7 +47,7 @@ async def command_add_bot(message: Message, command: CommandObject, bot: Bot): except TelegramUnauthorizedError: return message.answer("Invalid token") await new_bot.delete_webhook(drop_pending_updates=True) - await new_bot.set_webhook(f"{BASE_URL}{OTHER_BOTS_PATH}") + await new_bot.set_webhook(OTHER_BOTS_URL.format(bot_token=command.args)) await message.answer(f"Bot @{bot_user.username} successful added") diff --git a/pyproject.toml b/pyproject.toml index a36de2e6..eee84868 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aiogram" -version = "3.0.0-alpha.19" +version = "3.0.0-beta.1" description = "Modern and fully asynchronous framework for Telegram Bot API" authors = [ "Alex Root Junior ",