Skip to content

[ENHANCEMENT] Improve callback signature of shortcuts #2238

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

Closed
Poolitzer opened this issue Dec 8, 2020 · 1 comment · Fixed by #2240
Closed

[ENHANCEMENT] Improve callback signature of shortcuts #2238

Poolitzer opened this issue Dec 8, 2020 · 1 comment · Fixed by #2240
Labels
⚙️ documentation affected functionality: documentation 📋 help-wanted work status: help-wanted 🛠 refactor change type: refactor ⚙️ type-hinting affected functionality: type-hinting

Comments

@Poolitzer
Copy link
Member

We just pass kwargs and args to the underlying function call currently for maintenance easiness. This however means that type hinting/suggestions from IDEs don't live up to their full potential. One of ptb greatest feature are our shortcuts, sparing the developers a lot of time writing out user or chat ids etc. We should spend some time improving this part of our library in my opinion.

If we want to implement this feature, at least testing for it would be a requirement, so whenever we change the underlying functions or add new shortcuts, the test tells us that we have to change the type hints/docs/etc.

@Poolitzer Poolitzer added enhancement 📋 help-wanted work status: help-wanted ⚙️ documentation affected functionality: documentation ⚙️ type-hinting affected functionality: type-hinting 🛠 refactor change type: refactor labels Dec 8, 2020
@Bibo-Joshi
Copy link
Member

iirc, inspect.getfullargspec also gives type annotation info, that should also be compared.
Also I vote for not documenting the parameters at the shortcuts, as that is probably hard to test, easy to forget and really has no added benifit. We can just link to the corresponding bot methods documentation, if we want to be helpful.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
⚙️ documentation affected functionality: documentation 📋 help-wanted work status: help-wanted 🛠 refactor change type: refactor ⚙️ type-hinting affected functionality: type-hinting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants