Skip to content

Commit c948517

Browse files
committed
feat(formatting): add markdown formatting and set it as default
1 parent 3733151 commit c948517

12 files changed

Lines changed: 1736 additions & 177 deletions

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ OPENCODE_MODEL_ID=big-pickle
5454
# Hide tool call service messages (default: false)
5555
# HIDE_TOOL_CALL_MESSAGES=false
5656

57+
# Assistant message formatting mode (default: markdown)
58+
# markdown = convert assistant replies to Telegram MarkdownV2
59+
# raw = show assistant replies as plain text
60+
# MESSAGE_FORMAT_MODE=markdown
61+
5762
# Code File Settings (optional)
5863
# Maximum file size in KB to send as document (default: 100)
5964
# CODE_FILE_MAX_SIZE_KB=100

AGENTS.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,28 +257,30 @@ OPENCODE_MODEL_ID=big-pickle
257257
# SESSIONS_LIST_LIMIT=10
258258
# PROJECTS_LIST_LIMIT=10
259259
# BOT_LOCALE=en # en or ru
260+
# MESSAGE_FORMAT_MODE=markdown # markdown or raw
260261

261262
# File output options (optional)
262263
# CODE_FILE_MAX_SIZE_KB=100
263264
```
264265

265266
### Environment variables reference
266267

267-
| Variable | Description | Required | Default |
268-
| -------------------------- | --------------------------------- | -------- | ----------------------- |
269-
| `TELEGRAM_BOT_TOKEN` | Bot token from @BotFather | Yes | - |
270-
| `TELEGRAM_ALLOWED_USER_ID` | Allowed Telegram user ID | Yes | - |
271-
| `TELEGRAM_PROXY_URL` | Proxy URL for Telegram API | No | - |
272-
| `OPENCODE_MODEL_PROVIDER` | Default model provider | Yes | - |
273-
| `OPENCODE_MODEL_ID` | Default model ID | Yes | - |
274-
| `OPENCODE_API_URL` | OpenCode API URL | No | `http://localhost:4096` |
275-
| `OPENCODE_SERVER_USERNAME` | OpenCode auth username | No | `opencode` |
276-
| `OPENCODE_SERVER_PASSWORD` | OpenCode auth password | No | empty |
277-
| `LOG_LEVEL` | Logging level | No | `info` |
278-
| `SESSIONS_LIST_LIMIT` | Max sessions shown in `/sessions` | No | `10` |
279-
| `PROJECTS_LIST_LIMIT` | Max projects shown in `/projects` | No | `10` |
280-
| `BOT_LOCALE` | Bot locale (`en` or `ru`) | No | `en` |
281-
| `CODE_FILE_MAX_SIZE_KB` | Max code file size to send | No | `100` |
268+
| Variable | Description | Required | Default |
269+
| -------------------------- | --------------------------------------------------- | -------- | ----------------------- |
270+
| `TELEGRAM_BOT_TOKEN` | Bot token from @BotFather | Yes | - |
271+
| `TELEGRAM_ALLOWED_USER_ID` | Allowed Telegram user ID | Yes | - |
272+
| `TELEGRAM_PROXY_URL` | Proxy URL for Telegram API | No | - |
273+
| `OPENCODE_MODEL_PROVIDER` | Default model provider | Yes | - |
274+
| `OPENCODE_MODEL_ID` | Default model ID | Yes | - |
275+
| `OPENCODE_API_URL` | OpenCode API URL | No | `http://localhost:4096` |
276+
| `OPENCODE_SERVER_USERNAME` | OpenCode auth username | No | `opencode` |
277+
| `OPENCODE_SERVER_PASSWORD` | OpenCode auth password | No | empty |
278+
| `LOG_LEVEL` | Logging level | No | `info` |
279+
| `SESSIONS_LIST_LIMIT` | Max sessions shown in `/sessions` | No | `10` |
280+
| `PROJECTS_LIST_LIMIT` | Max projects shown in `/projects` | No | `10` |
281+
| `BOT_LOCALE` | Bot locale (`en` or `ru`) | No | `en` |
282+
| `MESSAGE_FORMAT_MODE` | Assistant message format mode (`markdown` or `raw`) | No | `markdown` |
283+
| `CODE_FILE_MAX_SIZE_KB` | Max code file size to send | No | `100` |
282284

283285
## OpenCode SDK quick reference
284286

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Quick start: `npx @grinev/opencode-telegram-bot`
2828
- **Voice prompts** — send voice/audio messages, transcribe them via a Whisper-compatible API, then forward recognized text to OpenCode
2929
- **Context control** — compact context when it gets too large, right from the chat
3030
- **Input flow control** — when an interactive flow is active, the bot accepts only relevant input to keep context consistent and avoid accidental actions
31+
- **Configurable reply formatting** — assistant replies use Telegram MarkdownV2 by default, with optional raw mode (`MESSAGE_FORMAT_MODE=markdown|raw`)
3132
- **Security** — strict user ID whitelist; no one else can access your bot, even if they find it
3233
- **Localization** — English and Russian UI (`BOT_LOCALE=en|ru`)
3334

@@ -134,6 +135,7 @@ When installed via npm, the configuration wizard handles the initial setup. The
134135
| `SERVICE_MESSAGES_INTERVAL_SEC` | Service messages interval (thinking + tool calls); keep `>=2` to avoid Telegram rate limits, `0` = immediate | No | `5` |
135136
| `HIDE_THINKING_MESSAGES` | Hide `💭 Thinking...` service messages | No | `false` |
136137
| `HIDE_TOOL_CALL_MESSAGES` | Hide tool-call service messages (`💻 bash ...`, `📖 read ...`, etc.) | No | `false` |
138+
| `MESSAGE_FORMAT_MODE` | Assistant reply formatting mode: `markdown` (Telegram MarkdownV2) or `raw` | No | `markdown` |
137139
| `CODE_FILE_MAX_SIZE_KB` | Max file size (KB) to send as document | No | `100` |
138140
| `STT_API_URL` | Whisper-compatible API base URL (enables voice/audio transcription) | No ||
139141
| `STT_API_KEY` | API key for your STT provider | No ||

0 commit comments

Comments
 (0)