Skip to content
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

V20 username wrapper #48

Merged
merged 12 commits into from
May 24, 2022
Merged

V20 username wrapper #48

merged 12 commits into from
May 24, 2022

Conversation

Poolitzer
Copy link
Member

No description provided.

@Poolitzer Poolitzer mentioned this pull request May 22, 2022
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

ptbcontrib/username_to_chat_api/usernametochatapi.py Outdated Show resolved Hide resolved
ptbcontrib/username_to_chat_api/requirements.txt Outdated Show resolved Hide resolved
ptbcontrib/username_to_chat_api/README.md Outdated Show resolved Hide resolved
Poolitzer and others added 2 commits May 22, 2022 17:53
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Also improve example
Comment on lines 43 to 46
if "wrapper" not in application.bot_data:
wrapper: UsernameToChatAPI = UsernameToChatAPI("https://localhost:1234/",
"RationalGymsGripOverseas", application.bot)
application.bot_data["wrapper"] = wrapper
Copy link
Member

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
Comment on lines 41 to 42
def __init__(self, application: Application):
super().__init__(application=application)
Copy link
Member

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 🙆‍♂️

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though it was obvious 😬

@Bibo-Joshi Bibo-Joshi merged commit 91bf513 into v20-updates May 24, 2022
@Bibo-Joshi Bibo-Joshi deleted the v20_username_wrapper branch May 24, 2022 05:54
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants