Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions BoostsInfoBot/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
# UserChatShared
# BoostsInfoBot

Showing info about boosts
A bot that retrieves and displays the boost information for a chat.

## Functionality

On `/start`, the bot sends a reply keyboard with a *Request Channel* button. When the user selects
a channel, the bot calls `getUserChatBoosts` and replies with a formatted list of all active boosts
for that user in the selected chat, including the start and expiration dates of each boost.

## Arguments

| Position | Value | Sample | Description |
|----------|-------|--------|-------------|
| 1 | `BOT_TOKEN` | `1234567890:AABBccDDeeFF` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

| Command | Description |
|---------|-------------|
| `/start` | Sends the channel-request keyboard |

## Capabilities

- Reply keyboard with a `RequestChat` button configured for channels
- Retrieves user boost list via `getUserChatBoosts`
- Formats each boost with its add date and expiration date
- Handles `ChatShared` service messages to extract the target chat ID
- Runs via long polling

## Launch

Expand Down
53 changes: 51 additions & 2 deletions BusinessConnectionsBot/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,55 @@
# BusinessConnectionBotBot
# BusinessConnectionsBot

When bot connected or disconnected to the business chat, it will notify this chat
A comprehensive bot that demonstrates the Telegram Business Account API, including message
management, profile editing, star transfers, story posting, and gift listing.

## Functionality

The bot connects to a business account. When a business connection is established it maps the
business chat ID to the owner's personal chat so that management commands can be used in the
personal chat. Messages received via the business connection are forwarded to the owner.
Typing `PIN` or `UNPIN` in a business message pins or unpins it. A wide set of management commands
is available in the owner's PM.

## Arguments

| Position | Value | Description |
|----------|-------|-------------|
| 1 | `BOT_TOKEN` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

| Command | Description |
|---------|-------------|
| `/get_business_account_info` | Print account name, username, bio, and other details |
| `/set_business_account_name` | Set the account's first and last name (prompts for input) |
| `/set_business_account_username` | Set the account's username (prompts for input) |
| `/set_business_account_bio` | Set the account bio (auto-resets to the old value after 15 seconds) |
| `/set_business_account_profile_photo` | Set a private profile photo (send a photo in reply) |
| `/set_business_account_profile_photo_public` | Set a public profile photo (send a photo in reply) |
| `/get_business_account_star_balance` | Show the current star balance of the business account |
| `/transfer_business_account_stars` | Transfer stars from the business account to the bot |
| `/get_business_account_gifts` | List all gifts received by the business account |
| `/post_story` | Post a story with a link area (send a photo in reply) |
| `/delete_story` | Delete the most recently posted story |

## Capabilities

- `BusinessConnection` event handling: maps business chat IDs to personal owner chats
- Forwards business messages to the owner's PM
- PIN / UNPIN keyword detection to pin or unpin messages in the business chat
- Business message deletion tracking
- Mutex-protected concurrent access to the chat mapping
- Story creation with `InputStoryContentPhoto` and `StoryAreaTypeLink`
- Checklist content support
- Runs via long polling

## Launch

Expand Down
34 changes: 33 additions & 1 deletion ChatAvatarSetter/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
# ChatAvatarSetter

This bot will set the chat avatar based on the image sent to bot
A bot that updates a group or channel's avatar using a photo sent to the bot.

## Functionality

When the bot receives a photo message, it downloads the highest-resolution version of the photo
and sets it as the chat photo for the chat the message was sent from. If the operation fails (e.g.,
due to missing admin rights), the bot sends an error message back to the user.

## Arguments

| Position | Value | Description |
|----------|-------|-------------|
| 1 | `BOT_TOKEN` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

None.

## Capabilities

- Downloads the largest available photo size from the incoming message
- Calls `setChatPhoto` to apply the downloaded image as the chat's avatar
- Returns a user-facing error message if the update fails
- Runs via long polling

## Launch

```bash
../gradlew run --args="BOT_TOKEN"
```

> **Note:** The bot must be an administrator with *Change group info* permission in the target chat.
42 changes: 42 additions & 0 deletions ChecklistsBot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ChecklistsBot

A bot that handles Telegram premium checklist messages and tracks task completion events.

## Functionality

Listens for messages containing a checklist. When a checklist message is received, the bot sends
a formatted reply showing all tasks with their completion status. It also reacts to task-level
events: when a task is marked as done or a new task is added to an existing checklist, the bot
sends an update reply referencing the affected task.

## Arguments

| Position | Value | Description |
|----------|-------|-------------|
| 1 | `BOT_TOKEN` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

None.

## Capabilities

- Detects `ChecklistContent` messages (Telegram Premium feature)
- Formats checklist tasks with ✅ (completed) and ⬜ (pending) indicators
- Handles `ChecklistTasksDone` events — replies when a task is marked complete
- Handles `ChecklistTasksAdded` events — replies when new tasks are appended
- Uses rich text message building for formatted output
- Runs via long polling

## Launch

```bash
../gradlew run --args="BOT_TOKEN"
```
40 changes: 39 additions & 1 deletion CustomBot/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
# CustomBot

This bot basically have no any useful behaviour, but you may customize it as a playground
A bot that demonstrates custom middleware, custom subcontext data, and several utility features
of the TelegramBotAPI library.

## Functionality

Shows how to attach a logging middleware to every API request and how to store arbitrary data in
a per-update subcontext. Additionally demonstrates retrieving and sending a user's profile audio
playlist and querying the bot's own star balance.

## Arguments

| Position | Value | Description |
|----------|-------|-------------|
| 1 | `BOT_TOKEN` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

| Command | Description |
|---------|-------------|
| `/start` | Retrieves the sender's profile audio files and sends them as an audio media group |
| `/additional_command` | Demo command that accesses and prints custom subcontext data |
| `/getMyStarBalance` | Queries and replies with the bot's current Telegram Star balance |

## Capabilities

- Custom request middleware that logs every outgoing API call
- Custom `BehaviourContext` subcontext with arbitrary stored data
- Profile audio retrieval via `getUserProfilePhotos`-style API for audio
- Audio media group sending (batched uploads)
- Star balance query via `getStarTransactions`
- Channel direct-message configuration tracking via `ChatBoostUpdated` events
- Runs via long polling

## Launch

Expand Down
33 changes: 32 additions & 1 deletion DeepLinksBot/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
# DeepLinksBot

This bot will send you deeplink to this bot when you send some text message and react on the `start` button
A bot that generates and handles Telegram deep links.

## Functionality

Generates a deep link to the bot when the user sends any text message. When a deep link is followed
(i.e., the `/start` command is received with a payload), the bot confirms what payload was received.

## Arguments

| Position | Value | Description |
|----------|-------|-------------|
| 1 | `BOT_TOKEN` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

| Command | Description |
|---------|-------------|
| `/start` | Displays a help/welcome message; also handles deep-link payloads |

## Capabilities

- Requires a registered bot username (validates that `getMe` returns a username)
- Generates a `t.me/<username>?start=<payload>` deep link from any incoming text message
- Subscribes to deep-link follow events with `waitDeepLinks()` and confirms the received payload
- Runs via long polling

## Launch

Expand Down
35 changes: 33 additions & 2 deletions DraftsBot/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
# Drafts bot
# DraftsBot

The main purpose of this bot is just to answer "Oh, hi, " and add user mention here
A bot that demonstrates the message-draft flow API by progressively revealing text to the user.

## Functionality

On `/test_draft_flow`, the bot sends a series of draft text updates to the user, each building
on the previous one, before committing the final message. This illustrates how to use the draft
message API to stream partial content before finalising it.

## Arguments

| Position | Value | Description |
|----------|-------|-------------|
| 1 | `BOT_TOKEN` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

| Command | Description |
|---------|-------------|
| `/test_draft_flow` | Starts a draft-message flow that progressively reveals text |

## Capabilities

- Uses the `draftFlow` / `sendDraftMessage` API to emit incremental text updates
- Demonstrates the difference between draft (editable intermediate state) and final message
- Runs via long polling

## Launch

Expand Down
40 changes: 37 additions & 3 deletions FSMBot/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
# FSM
# FSMBot

This bot contains an example of working with FSM included in project
[MicroUtils](https://github.com/InsanusMokrassar/MicroUtils)
A demonstration of the Finite State Machine (FSM) pattern provided by the
[MicroUtils](https://github.com/InsanusMokrassar/MicroUtils) library.

## Functionality

Implements a simple two-state FSM. After `/start` is sent, the bot enters
`ExpectContentOrStopState` and re-sends every message it receives back to the user.
This continues until the user sends `/stop`, at which point the FSM transitions to
`StopState` and content forwarding ends.

## Arguments

| Position | Value | Description |
|----------|-------|-------------|
| 1 | `BOT_TOKEN` | Telegram bot token |

Optional arguments (any order after the token):

| Value | Description |
|-------|-------------|
| `debug` | Enable verbose debug logging |
| `testServer` | Connect to the Telegram test server instead of production |

## Bot Commands

| Command | Description |
|---------|-------------|
| `/start` | Starts the FSM loop — bot begins echoing content back to the user |
| `/stop` | Ends the FSM loop — bot stops echoing |

## Capabilities

- Two-state FSM: `ExpectContentOrStopState` → `StopState`
- `ExpectContentOrStopState` uses `expectContentOrCommands()` to filter messages
- Erroneous FSM states are caught and handled gracefully
- Runs via long polling

## Launch

Expand Down
Loading
Loading