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

Add official telegram test environment support #1320

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

mschurov
Copy link

@mschurov mschurov commented Feb 11, 2024

Add "/test/" into telegram api url for test environments.

From the docs:

https://core.telegram.org/bots/webapps


Using bots in the test environment
To log in to the test environment, use either of the following:

iOS: tap 10 times on the Settings icon > Accounts > Login to another account > Test.
Telegram Desktop: open ☰ Settings > Shift + Alt + Right click ‘Add Account’ and select ‘Test Server’.
macOS: click the Settings icon 10 times to open the Debug Menu, ⌘ + click ‘Add Account’ and log in via phone number.
The test environment is completely separate from the main environment, so you will need to create a new user account and a new bot with @Botfather.

After receiving your bot token, you can send requests to the Bot API in this format:

https://api.telegram.org/bot/test/METHOD_NAME
Note: When working with the test environment, you may use HTTP links without TLS to test your Web App. *****

mschurov and others added 8 commits July 9, 2023 22:33
https://core.telegram.org/bots/webapps
****
Using bots in the test environment
To log in to the test environment, use either of the following:

iOS: tap 10 times on the Settings icon > Accounts > Login to another account > Test.
Telegram Desktop: open ☰ Settings > Shift + Alt + Right click ‘Add Account’ and select ‘Test Server’.
macOS: click the Settings icon 10 times to open the Debug Menu, ⌘ + click ‘Add Account’ and log in via phone number.
The test environment is completely separate from the main environment, so you will need to create a new user account and a new bot with @Botfather.

After receiving your bot token, you can send requests to the Bot API in this format:

https://api.telegram.org/bot<token>/test/METHOD_NAME
Note: When working with the test environment, you may use HTTP links without TLS to test your Web App.
*****
A semicolon were missing in the Standalone reply code.
The reply signature changed and needs a BiConsumer<BaseAbilityBot, Update> instead of Consumer<Update> in the Ability reply
…ed from 'Boolean' to 'String' (according to TelegramBotAPI Official Documentation). (rubenlagus#1315)
@mschurov mschurov marked this pull request as ready for review February 11, 2024 17:57
@mschurov mschurov changed the title Dev Add official telegram test environment support Feb 11, 2024
rbondar and others added 5 commits February 17, 2024 11:24
* fix force=true for WriteAccessAllowed

* + test and fixtures on write access allowed
* Fix path for GetMyName method

* Add missing sticker methods from API 6.6

* Fix possible NPE in InputSticker validation

* Add ReplyParameters to SendInvoice API method

* Removed mysterious fields in SetChatTitle
@@ -279,6 +279,14 @@ private List<Update> getUpdatesFromServer() throws IOException {
}
}

private String getApiUrl() {

Choose a reason for hiding this comment

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

Why we need this method? It look like duplication of logic with getBaseUrl()

@@ -123,7 +120,11 @@ public final DefaultBotOptions getOptions() {
}

public String getBaseUrl() {
return options.getBaseUrl() + getBotToken() + "/";
String baseUrl = options.getBaseUrl() + getBotToken() + "/";
Copy link

@4repaXXX 4repaXXX Jun 23, 2024

Choose a reason for hiding this comment

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

Does not it better to allow user set url for http request on start? For example, using standard setBaseUrl, and just use everywhere method getBaseUrl(). And don't add implicit changes. What if in future telegram decide to change url again.

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

Successfully merging this pull request may close these issues.

None yet

10 participants