-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: full support middleware #16
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For support middlewares in handlers we need packs middlewares independently of telebot.
feat: #15 support middlewares
This wrapper storages fsm context inside, that gives possible provides context to handlers. feat: #15 support middlewares
This change allows you to change the behavior of fsm context retrieval without using many pointers. feat: #15 support middlewares
feat: #15 support middlewares
Closed
problem [ 3 ]name will NewGroup
|
problem [ 2 ]leave it as it is for now problem [ 1 ]the same will not be changed, as the semantics of ContextMaker may be affected. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
enhancement
New feature or request
expirement
some expiremental functional
tests
some tests changes
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main problem was where the fsm handler was converted to telebot. Initially there was no way to bind middlewares.
Now the mechanism of fsm context delivery to handlers has changed. This is done via wrapperContext.
See Manager.adapt, Manager.forEndpoint, Manager.handle and wrap_tele_context.go for details.
There may be slight performance sags since type assertions are now used.
The external API has remained the same.
Problems
[ 1 ] fsm internal key
May be change fsmInternalKey to same with middleware.ContexKey, it will additional support.
[ 2 ] Manager.adapt & Manager.HandlerAdapter
Methods do something same, but first have 'optimistic' branch to extract FSM Context from telebot context.
But in bad variant it also allocates new FSM context.
[ 3 ] Sub group manager method name
Now it names 'Child'. Thinked rename to NewGroup, but it breake prev. semantic.
Though it's more likely that it doesn't break, - but fixes the originally intended semantics.