feat(telegram): handle /start natively instead of forwarding to agent#798
Open
lezama wants to merge 1 commit intochenhg5:mainfrom
Open
feat(telegram): handle /start natively instead of forwarding to agent#798lezama wants to merge 1 commit intochenhg5:mainfrom
lezama wants to merge 1 commit intochenhg5:mainfrom
Conversation
`/start` is a Telegram protocol convention — clients send it automatically when a user first opens a bot or taps the Start button. Without a native handler the message fell through to the default branch in `handleSlashCommand` and got forwarded verbatim to the agent. For Claude Code agents specifically this breaks first contact: the CLI interprets a leading `/` as a slash-command request and replies "Unknown command: /start. Did you mean /stats?" instead of greeting the user. End user sees the bot welcome them with autocomplete suggestions on every fresh chat. Add a `cmdStart` handler (alongside cmdHelp / cmdVersion / etc.) and a `MsgWelcome` i18n entry covering the same five locales as the rest of the file. The handler names the project (`e.name`) and points users to /help — behavior consistent with telegraf, python-telegram-bot, aiogram, etc. No-op improvement on platforms where /start has no protocol meaning. Closes chenhg5#797
chenhg5
approved these changes
Apr 27, 2026
Owner
chenhg5
left a comment
There was a problem hiding this comment.
Review Summary
Clean, minimal fix for Telegram's /start protocol convention. Closes #797.
✅ Good:
-
Root cause:
/startwas falling through to the agent, and Claude Code's CLI rejected it as "Unknown command: /start. Did you mean /stats?" -
Fix: New
cmdStartmethod mirrorscmdHelpshape. Returns a localized welcome message with the project name. -
i18n:
MsgWelcomewith all 5 languages (EN, zh-CN, zh-TW, ja, es). -
Minimal diff: +26 lines, 2 files. No unnecessary changes.
-
Comment: Clear docstring explaining the Telegram
/startprotocol and why this is needed.
LGTM. CI green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #797.
What
Add a native handler for the
/startslash command. Previously cc-connect fell through to the agent for any unrecognized slash command, including Telegram's/startprotocol convention — and Claude Code's CLI then rejected the literal/starttext with an autocomplete prompt.Changes
core/i18n.go— newMsgWelcomekey + EN/zh/zh-TW/ja/es translations.core/engine.go— newcmdStartmethod (mirrorscmdHelpshape) and acase "start"branch inhandleSlashCommand's switch.Total diff: +26 lines, 2 files.
Behavior before
Behavior after
The welcome names the project (
e.name) so the user knows which agent they're connected to. Tone matches the existing English copy elsewhere incore/i18n.go.Why /start specifically
/startis a Telegram protocol convention — Telegram clients send it automatically when a user first opens a bot, taps the Start button, or/start@botin a group. Every Telegram bot framework I'm aware of (telegraf, python-telegram-bot, aiogram, etc.) reserves/startfor a native welcome handler. cc-connect already auto-registers a Telegram bot menu on startup, so this completes the convention./helpis in a similar spot — but cc-connect already had a native/help, so it's unaffected./startwas the gap.On platforms where
/starthas no protocol meaning (Slack, Discord, Feishu, etc.) this is a no-op improvement: instead of "Unknown command. Forwarding to agent." → "Unknown command: /start. Did you mean /stats?", the user gets a proper welcome.Tests
go test ./core/... -count=1— three pre-existing failures (TestProcessInteractiveEvents_AppendsReplyFooterWhenEnabled,TestProcessInteractiveEvents_ReplyFooterPrefersSessionRuntimeState,TestResolveLocalDirPath_AcceptsSubdir) reproduce onmainwithout my changes; everything else passes. Build is clean.Repro / verification
[[projects]]with[projects.agent].type = "claudecode"and a[[projects.platforms]]of typetelegram./start).Discovered while testing https://github.com/Automattic/intelligence end-to-end (cc-connect bridges its Claude Code runtime to Telegram).