Upcoming aiogram-forms@1.2.0 update — menu module

On the last day of August, let me make a lazy teaser for the upcoming aiogram-forms update. Meet the new module - the menu!

It's still under active development, so some APIs may change; however, the general idea stays the same.

As short and simple as possible: import, create the subclass we need, register it in the dispatcher.

from aiogram_forms.menus import Menu, MenuItem, actions

class MainMenu(Menu):
    order_status = MenuItem('📫 Check order status', action=actions.ShowForm('order-status'))
    settings = MenuItem('🔧 Settings', action=actions.ShowMenu('settings'))
    about = MenuItem('ℹ️ About', action=actions.Custom(send_about_message))

    async def title(cls) -> str:
        return '🏠 Home'

class SettingsMenu(Menu):

class CheckOrderStatusForm(Form):

async def command_menu_handler(message: types.Message, manager: Manager) -> None:
    await manager.show('main')

As I indicated in the roadmap, the menu module will become available with version 1.2.0, which will presumably be released in September. In addition to the new module, updates include optimizations, fixes and a redesign of the manager.