update examples for ktgbotapi 38.0.0

This commit is contained in:
InsanusMokrassar committed 2026-11-26 12:28:56 +06:00
1 parent d0da6c851b
commit 97b4391495
86 files changed
+888 -370

No files matched your search

+4 -5
View File
@@ -4,7 +4,8 @@ A long-polling example that prints information about the bot and lets Telegram u
## Behavior
At startup, the application prints the results of `getMe` and `getChat` for the bot itself to standard output. It then handles two commands:
At startup, the application prints the `BotFullInfo` returned by `getMe`, including active usernames and bot settings.
It passes that object's `id` to `getChat` to print the bot's chat profile. It then handles two commands:
- `/setMyProfilePhoto` replies with `ok, send me new photo` and waits for the first photo sent in the same chat. It streams draft progress messages while downloading the photo to a temporary file, uploads it as a static bot profile photo, and replies when the change is complete. The photo may come from any user in that chat; it is not restricted to the user who sent the command.
- `/removeMyProfilePhoto` removes the bot's current profile photo and confirms success. On failure, it prints the exception and sends a generic error reply.
@@ -24,13 +25,13 @@ There is no `/start` handler, and ordinary messages are ignored unless the bot i
The first argument is always the required bot token. Optional arguments can follow it in any order:
- `debug` enables formatted default KSLog output.
- `testServer` makes the behavior and long-polling client use Telegram's Bot API test environment. The initial `getMe` and `getChat` diagnostics currently use a separate default-server client.
- `testServer` runs the startup diagnostics and polling against Telegram's Bot API test environment.
Other arguments are ignored. Argument matching is case-sensitive.
## Launch
The intended command from the repository root is:
Run from the repository root:
```bash
./gradlew :MyBot:run --args="<BOT_TOKEN>"
@@ -41,5 +42,3 @@ For example, to enable both optional modes:
```bash
./gradlew :MyBot:run --args="<BOT_TOKEN> debug testServer"
```
> **Known issue:** `MyBot/build.gradle` still declares the old `GetMeBotKt` main class, while the current source produces `MyBotKt`. Consequently, the `run` task cannot start until that build setting is corrected. It is left unchanged here because this example update is documentation-only.