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,43 @@
# HelloBot
The main purpose of this bot is just to answer "Oh, hi, " and add user mention here
HelloBot is a small long-polling example that greets the chat or sender when a
message addresses the bot by username.
## Launch
## Trigger and replies
There are no slash commands. The bot handles a content message only when its
text contains the bot's full username. This is a case-sensitive substring
check; messages without text or without the username are ignored.
- In a private chat, it replies with a MarkdownV2 text mention of the user.
- In a group or supergroup, it greets the group and links its title to a public
username or invite link when one is available.
- For a message sent to a group on behalf of a channel, it greets the sender
channel instead.
- In a channel, it greets the channel and includes the sender chat when Telegram
supplies one.
- In a business chat, it mentions the underlying private-chat user.
Every received update is also printed to standard output for demonstration and
debugging.
## Setup
1. Create a bot with BotFather and keep its token private.
2. Add the bot to each chat where it should respond. Explicit username mentions
work with Telegram's normal group privacy mode.
3. For channel posts, make the bot a channel administrator and allow it to post
messages. Admin access may also make a private group invite link available;
otherwise the group reply falls back to an unlinked title.
## Run
From the repository root, pass the token as the first positional argument:
```bash
../gradlew run --args="BOT_TOKEN"
./gradlew :HelloBot:run --args="BOT_TOKEN"
```
The token is required. Additional command-line arguments are ignored. The bot
runs until the process is stopped and uses long polling, so no webhook setup is
needed.

View File

@@ -18,7 +18,13 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
/**
* The main purpose of this bot is just to answer "Oh, hi, " and add user mention here
* Starts HelloBot with long polling and logs every received update.
*
* Content messages are handled when their text contains the bot's full
* username. The reply varies for private, group, channel, and business chats.
*
* @param args the bot token at index `0`; any remaining arguments are ignored
* @throws NoSuchElementException when no bot token is supplied
*/
@OptIn(PreviewFeature::class)
suspend fun main(vararg args: String) {