-
Notifications
You must be signed in to change notification settings - Fork 44
V20 username wrapper #48
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
Conversation
…wrapper # Conflicts: # ptbcontrib/username_to_chat_api/usernametochatapi.py
Also fixed a wrong error raising
Bibo-Joshi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Also improve example
| if "wrapper" not in application.bot_data: | ||
| wrapper: UsernameToChatAPI = UsernameToChatAPI("https://localhost:1234/", | ||
| "RationalGymsGripOverseas", application.bot) | ||
| application.bot_data["wrapper"] = wrapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm, stupid question again: why do this here and not just directly in the main with application.bot_data["wapper"] = UsernameToChatApi(…)? The main advantage of using a custom context class would be that you e.g. have it directly accessible via context.wrapper - for that I would do something like
class CustomContext(CallbackContext[insert type vars here]):
@property
def wrapper(self) -> UsernameToChatAPI:
return self.bot_data["wrapper"]also revampp the customcontext example
| def __init__(self, application: Application): | ||
| super().__init__(application=application) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for init now :) yes, I'm pick 🙆♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grmpf you could have said that earlier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though it was obvious 😬
No description provided.