Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Extend Support for Convenience Types in Bot Methods #4580

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
Bibo-Joshi opened this issue Nov 28, 2024 · 1 comment · Fixed by #4616
Closed

Extend Support for Convenience Types in Bot Methods #4580

Bibo-Joshi opened this issue Nov 28, 2024 · 1 comment · Fixed by #4616
Labels
⚙️ bot-api affected functionality: bot-api 🔌 enhancement pr description: enhancement ⚙️ tests affected functionality: tests ⚙️ type-hinting affected functionality: type-hinting

Comments

@Bibo-Joshi
Copy link
Member

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

In test_official we currently allow convenience input types only for send_* methods:

# 2) HANDLING OTHER TYPES:
# Special case for send_* methods where we accept more types than the official API:
elif ptb_param.name in PTCE.ADDITIONAL_TYPES and obj.__name__.startswith("send"):
log("Checking that `%s` has an additional argument!\n", ptb_param.name)
mapped_type = mapped_type | PTCE.ADDITIONAL_TYPES[ptb_param.name]

ADDITIONAL_TYPES = {
"photo": PhotoSize,
"video": Video,
"video_note": VideoNote,
"audio": Audio,
"document": Document,
"animation": Animation,
"voice": Voice,
"sticker": Sticker,
}

Removing the obj.__name__.startswith("send") reveals that there are a few more parameters that could use convenience types.

Describe the solution you'd like

  • Set up the "additional types" excetpions in test_official such that they can either be defined globally or per method, remove the obj.__name__ check
  • add support for convenience types where possible

Describe alternatives you've considered

No response

Additional context

No response

@Bibo-Joshi Bibo-Joshi added ⚙️ bot-api affected functionality: bot-api ⚙️ tests affected functionality: tests ⚙️ type-hinting affected functionality: type-hinting 🔌 enhancement pr description: enhancement labels Nov 28, 2024
@cuevasrja
Copy link
Contributor

Hi, my class group and I want to work in this Issue.

Group:
@Jeam-zx
@Migueldsc12
@AnyaMarcanito
@henryg311
@cuevasrja

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
⚙️ bot-api affected functionality: bot-api 🔌 enhancement pr description: enhancement ⚙️ tests affected functionality: tests ⚙️ type-hinting affected functionality: type-hinting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants