Introduction¶
Telegram bot plugin for DeepSeek Harness (DSH). It is built on hi-wenw/dsh-telegram-channel and incorporates some mechanisms from the Hermes agent’s Telegram gateway. The plugin allows DSH local sessions, topics, and media to be managed directly through the Telegram interface.
The DSH philosophy emphasizes “everything is a plugin.” This tool aims to provide DSH users with a Telegram-based client entry point, supporting session isolation, topic management, and message filtering.
Core Features¶
- Per-chat/topic sessions: Each topic (forum or DM topic) is an independent session, and bot replies are automatically sent to the same topic.
- Topics handling: Supports
message_thread_id, correctly handles the General topic (ID 1), and creating, editing, and deleting topics. The plugin automatically renames topics to the session title. - DM Topics: Supports Bot API 9.4, creates topics in one-to-one chats, with each topic acting as an independent session, and supports a root-level DM lobby mode.
- Group gating: Provides fine-grained access control, including
require_mention(mention-triggered),allowed_chats,allowed_topics,free_response_chats/topics(free-response mode),guest_mode, andignored_threads. - Media in/out: Supports sending and receiving photos, videos, voice messages, files, and stickers. Uses the
MEDIA:/pathtag when sending files. - Commands: Provides
/new(create a session),/reset(reset),/stop(stop and unbind),/sessions(list sessions),/last(view the previous context),/model(switch model),/status(view current binding),/unbind(unbind), and/help(help). - Status indicator: Displays online/offline status via the
setMyShortDescriptioninterface. - Tool-call filter: Built-in filtering mechanism to prevent
<tool_calls>tags from leaking into Telegram messages. - Polling resilience: Implements exponential backoff retry for 409 conflict errors from the Telegram API.
- Choice/clarify: Supports option selection via inline buttons triggered by
ask_user_question. - Bilingual support: Supports Russian and English, switchable via the
DSH_TELEGRAM_LANGenvironment variable.
Installation and Activation¶
Before installing, make sure the following prerequisites are met: Node.js version ≥ 22, the DSH Web environment is configured with a model, and a bot has been created via @BotFather.
Add the plugin using the official installation command:
dsh plugin --profile web add github:todayer/todayer-dsh-telegram-bridge
Configuration¶
The plugin configuration file is located at ~/.dsh/telegram.env.
Required configuration:
DSH_TELEGRAM_TOKEN=123456789:AA... # 从 @BotFather 获取的 Token
DSH_TELEGRAM_ALLOWED_USER_IDS=123456789 # 允许使用的用户 ID(从 @userinfobot 获取)
Optional configuration:
DSH_TELEGRAM_LANG=ru # 语言设置:ru | en
DSH_TELEGRAM_REQUIRE_MENTION=false # 是否仅允许被提及时触发
DSH_TELEGRAM_ALLOWED_CHATS= # 允许聊天的列表
DSH_TELEGRAM_ALLOWED_TOPICS= # 允许的话题列表
DSH_TELEGRAM_FREE_RESPONSE_CHATS= # 自由响应聊天列表
DSH_TELEGRAM_FREE_RESPONSE_TOPICS= # 自由响应话题列表
DSH_TELEGRAM_GUEST_MODE=false # 访客模式
DSH_TELEGRAM_IGNORED_THREADS= # 忽略的线程 ID 列表
DSH_TELEGRAM_DM_TOPICS=[{"chatId":1212123,"topics":[{"name":"General"}]}] # DM 话题配置(JSON 格式)
DSH_TELEGRAM_STATUS_INDICATOR=1 # 状态指示开关
DSH_TELEGRAM_STATUS_ONLINE=🟢 Online # 在线状态文本
DSH_TELEGRAM_STATUS_OFFLINE=🔴 Offline # 离线状态文本
After configuring, place the environment variables into the EnvironmentFile of dsh.service and restart the service:
sudo systemctl restart dsh.service
Commands¶
| Command | Description |
|---|---|
/start |
Welcome message or help |
/sessions |
List workspaces and bound sessions |
/new |
Create a new session (forced new) |
/reset |
Reset the current session (alias for /new) |
/last |
View the previous conversation turn of the currently bound session |
/model |
Switch the model used by the current session |
/status |
View the current session binding status |
/stop |
Stop and unbind the current session |
/unbind |
Unbind the current session without deleting it |
/help |
View the full command list |
Notes¶
- The plugin runs with the permissions of the current DSH process. Check the source code and license before installing.
- Dependencies include Node ≥ 22 and model configuration in the DSH Web environment.
- The base logic is derived from
hi-wenw/dsh-telegram-channel, and it extends the Telegram gateway mechanisms of the Hermes agent.