-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[FEATURE] Customization of context logic #2068
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
Comments
This subclass should act as the initializer for every library-generated |
Hi @Bibo-Joshi . |
There are the docs, and there is the code. If you check both out (they are tightly integrated anyway), you should be good to go. We cant really help you unless you ask a specific technical question :) |
I think what @Poolitzer is trying to say is that tackling this issue should probably be done by someone who is familiar with the latest releases at least from a user point of view and it might be a bit much for a first time contribution. Ofc that depends on your motivation ;) |
@Bibo-Joshi as per discussion on the PTB telegram group: I mentioned the possibility of replacing
with
Are there any specific downsides with this? You're right, it "implies that we're supporting custom stuff, but that would not yet been properly implemented and tested", however I've grepped through the sources and couldn't find any places that rely on user_data/chat_data/bot_data being a And we can still implement & test this :) |
Hey. Maybe I didn't properly explain myself or we talked past each other. PS: Please delete one of your replies - having the same comment twice does not add any value to the discussion ;) |
closed by #2262 |
Is your feature request related to a problem? Please describe.
CallbackContext
introduced in v12 is a very central thing in the library and at some point people will wanna customize it, especially when usingcollect_additional_context
in custom handlers. Also when we get typing (Type hinting #1920, due to v13), type checkers will complain setting custom attributes.context
, has two shortcomings:Describe the solution you'd like
BasePersistence.get_data()
to return custom classes, defaulting todict()
. That way users can solve both of the above mentioned problems on their own (same forget_conversations
). For most classes this should still be compatible with the changes introduced in Refactor Bot persistence #1994, but advanced users can useset/replace_bot()
manually anyway …CallbackContext
toUpdater/Dispatcher
that will be used instead ofCallbackContext
. We should documentCC.from_*()
for that.bot/user/chat_data
, 1 forcontext
) should be passable toUpdater/Dispatcher
in a clean way. I.e. probably add a single parameter to pass it as tuple/dict/custom class or maybe add it to theDefaults
class, although I'm not sure that's a good idea(update: Update, context: CustomCallbackContext)
instead of(update: Update, context: CallbackContext)
Describe alternatives you've considered
Additional context
Reference for devs: @JosXa @tsnoam and I had a brief discussion about some of these ideas in dev chat on 2020-08-25.
The text was updated successfully, but these errors were encountered: