-
Hi the naive approach is at the beginning of each command handler function ( for example echo func ), I check the subscription of the user and initial the staticData then at the end of that function, I update that staticData and store it on my DB. but the better approach is to extract those two features and do them when a new update received and add them to context of command handler function. as I read your source code, I should somehow override Dispatcher and add my objects to its CallBackContext but I can't figure out how should I do this in a very good programmatically way ... Can someone help me? my other question is, how it is possible to do sth like bellow:
and access it in handler function:
PTB-version: 13.1 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Thanks to @Bibo-Joshi, I could write answers as follow ... 1- for the last question, we could wrap our handlerFunction with functools as bellow:
2- for checking the subscription of users and write code for doing entrance stuff, we could write typeHandler. plz keep in mind that in this approach the group related to typeHandler should be lower than otherHandlers, because it should run before others ;)
for more info, check out these links |
Beta Was this translation helpful? Give feedback.
Thanks to @Bibo-Joshi, I could write answers as follow ...
1- for the last question, we could wrap our handlerFunction with functools as bellow:
2- for checking the subscription of users and write code for doing entrance stuff, we could write typeHandler. plz keep in mind that in this approach the group related to typeHandler should be lower than otherHandlers, because it should run before others ;)