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

[FEATURE] Native support for TGs test environment #3355

Open
Bibo-Joshi opened this issue Nov 9, 2022 · 3 comments
Open

[FEATURE] Native support for TGs test environment #3355

Bibo-Joshi opened this issue Nov 9, 2022 · 3 comments

Comments

@Bibo-Joshi
Copy link
Member

Bibo-Joshi commented Nov 9, 2022

By now, TGs dedicated test environment is more prominently documented. Adding native support for it in PTB could be a desribale feature.

⚠️ Current status

This feature is currently not on any roadmap, since it doesn't seem to be widely used. If you would like for PTB to have this feature, please react with a 👍 to the comment. If we see a large number of requests, this issue will likely get put on a roadmap.

Edit: One can trick PTB into using the test env by setting token='<token>/test'. But this hack is not guaranteed to keep working in future versions of PTB …

Open Questions

We should check how the url returned by get_file behave, i.e. if they are still https://api.telegram.org/file/bot<Token>/… or if they are e.g. https://api.telegram.org/file/bot<token>/test/….

Implementation options

Just quickly listing two options that come to my mind

A test_env flag

That would work via ApplicationBuilder().token(…).test_env(True) or Bot(…, test_env=True) . This would be non-breaking. However, if may not play nicely with custom base_file_url depending on what we find out about file urls.

Allow custom insertion of token into base(_file)_url

That could either work by requesting the user to pass something like base_url = 'api.telegram.org/bot{token}/' (this would be a breaking change) or by allowing the user to pass a Callable[[str], str] that accepts the token and returns the (file_)url (this could be implemented in a non-breaking manner)

@Nickelza
Copy link

It's currently the only way to test topics without having 200 members in a test group

@harshil21
Copy link
Member

It's currently the only way to test topics without having 200 members in a test group

As of Telegram 9.3 (Dec 30, 2022), we can now make a group of any size into forums.

@Bibo-Joshi
Copy link
Member Author

For future reference: A first draft PR was already made in #3972 and if we ever decide to go ahead with this, a PR may possibly build up on that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants