update readmes

This commit is contained in:
2026-08-21 15:51:06 +06:00
parent 016400a821
commit ce48393895
104 changed files with 2615 additions and 333 deletions

View File

@@ -1,9 +1,37 @@
# DeepLinksBot
This bot will send you deeplink to this bot when you send some text message and react on the `start` button
An example long-polling bot that creates deep links to itself and demonstrates two
ways to consume their payloads with the TelegramBotAPI behaviour builder.
## Launch
## Behavior
- On startup, the bot fetches and prints its own account details. It stops if the
account has no username, because a username is required to build a deep link.
- `/start` without arguments returns a short usage hint.
- A text message containing no bot-command entity is used as the payload of a new
deep link, which the bot returns to the sender.
- A `/start <payload>` deep link is observed by both an `onDeepLink` trigger and a
`waitDeepLinks` waiter. Their replies identify which API received the payload.
- The waiter also prints the registered command handlers for demonstration and
debugging purposes.
Messages containing a bot command are excluded from link generation. The bot has
no persistence and runs until the process is stopped.
## Requirements
- A Telegram bot token supplied as the first command-line argument.
- A username configured for the bot account.
- No special administrator permissions; the bot only needs to receive messages
and send replies in the chat where it is used.
## Run
From the repository root:
```bash
../gradlew run --args="BOT_TOKEN"
./gradlew :DeepLinksBot:run --args="BOT_TOKEN"
```
Replace `BOT_TOKEN` with the token for the bot. Additional command-line arguments
are ignored. Omitting the token causes startup to fail before polling begins.

View File

@@ -10,7 +10,14 @@ import dev.inmo.tgbotapi.extensions.utils.formatting.makeTelegramDeepLink
import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
/**
* This bot will send you deeplink to this bot when you send some text message and react on the `start` button
* Runs a long-polling bot that turns non-command text into a deep link to itself
* and acknowledges payloads received through `/start`.
*
* The bot account must have a username so that its deep links can be constructed.
*
* @param args the bot token as the first argument; any remaining arguments are ignored
* @throws NoSuchElementException when no bot token is supplied
* @throws IllegalStateException when the bot account has no username
*/
suspend fun main(vararg args: String) {
val botToken = args.first()