Comments (2)
Идея:
Мы можем иметь не один стек диалогов, а много. Пусть у каждого стека будет свой ID.
Дальше. Каждый диалог будет id стека аттачить в callback data. За счет этого мы понимаем к какому стеку относится клик.
Каждый стек пусть имеет свой текущий стейт как в FSMContext. Но он будет применяться только для кликов в рамках стека.
Так же пусть будет дефолтный стек без ID. Он будет юзать обычный стейт. Это позволит обрабатывать в рамках него сообщения и прочие события.
Соответственно диалог может лежать в любом стеке так же как сейчас и ничего не заметит. Надо только поправить генерацию callback_data и отрезаение префикса при обработке.
Так же надо пропатчить FSMContext, чтобы он мог работать и айди стека.
Что это дает?
Мы сможем иметь на экране больше одной клавы и все будут полностью функциональными. Со всеми переключениями, открытиями новых диалогов и т.п.
from aiogram_dialog.
Объекты
Контекст открытого диалога:
- Intent ID
- Stack ID
- Intent Data
- User Data
- Widget Data
Стек:
- Последовательность Intent ID
Сторадж:
- Получить контекст прокси по Intent ID
- Получить стек по Stack ID
Сценарии
Нажатие на кнопку
- Из callback data достали IntentID
- Достали контекст диалога (IntentID + UserID + ChatID)
- Достали стек (StackID + UserID + ChatID)
Ввод сообщения
- Достали дефолтный стек
- Получили последний IntentID
- Достали контекст диалога
Запуск диалога
- В текущем стеке или новом
- Данные
- Стейт
- Настрока изменения стека
from aiogram_dialog.
Related Issues (20)
- Error in 2.0.0b12 HOT 1
- AttributeError: 'ManagerImpl' object has no attribute 'data' HOT 1
- Bug: Issue with the find method in Widget Case HOT 1
- ListGroup id HOT 1
- Window events
- ManagerRadio unchecked all HOT 1
- How to use old windows after restarting HOT 4
- show_mode in SwitchTo Widged
- Implementing Multiple Dynamic Counter Widgets with Text Parameters in aiogram-dialog HOT 1
- ShowMode in manager.start() doesn't work as expected by some users HOT 2
- Updating the examples.
- Launching a dialog with the transmission of dynamic data for the status of the checkbox buttons HOT 1
- Start calendar widget with scope Year HOT 1
- Calendar bug while selected date less than 1970 HOT 2
- How i can store data in state using FSMContext HOT 4
- Using payments HOT 1
- Coverage report falied on Jinja widgets HOT 1
- Handling InaccessibleMessage in get_media_id Function
- Best solution for creating different count of buttons
- LinkPreview widget HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiogram_dialog.