← Back to PRs

#6457: fix(telegram): register commands for group scope + preserve topic thread params

by dae-sun open 2026-02-01 17:36 View on GitHub →
channel: telegram
### Problem - Telegram forum topics can show "This command is not available" for slash commands unless bot commands are registered for group scope. - Some auth/diagnostic command responses could be sent without `message_thread_id` and land in the General topic. ### Fix - Register Telegram bot commands with both default scope and `all_group_chats` scope via `setMyCommands`. - Ensure auth/diagnostic `sendMessage` responses in `resolveTelegramCommandAuth` include correct forum topic thread params (omitting General topic id=1 as required). - Ensure plugin-command "Command not found" message also preserves topic thread params. ### Tests - Updated `src/telegram/bot-native-commands.test.ts` to assert `setMyCommands` is called with `all_group_chats` scope. - Ran: `pnpm vitest run src/telegram/bot-native-commands.test.ts` <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates Telegram native command handling in two ways: (1) it registers bot commands for both the default scope and the `all_group_chats` scope to avoid Telegram forum-topic clients showing “This command is not available”, and (2) it preserves forum topic routing (via `message_thread_id`, omitting General topic id=1) for auth/diagnostic and “Command not found” replies so responses stay in the invoking topic. The changes are localized to `src/telegram/bot-native-commands.ts`, with a small test update in `src/telegram/bot-native-commands.test.ts` to cover the added group-scope registration behavior. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge, with one functional follow-up needed to keep command scopes consistent when disabling commands. - Changes are small and targeted (adding thread params to a few sendMessage calls and registering commands in an additional Telegram scope). Main risk is behavioral inconsistency: group-scoped commands may remain registered if native commands are later disabled, since the disable path only clears the default scope. - src/telegram/bot-native-commands.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs