Skip to content

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

Open
BingqingLyu wants to merge 4 commits intomainfrom
fork-pr-6457-fix-telegram-forum-commands-scope
Open

fix(telegram): register commands for group scope + preserve topic thread params#1
BingqingLyu wants to merge 4 commits intomainfrom
fork-pr-6457-fix-telegram-forum-commands-scope

Conversation

@BingqingLyu
Copy link
Copy Markdown
Owner

@BingqingLyu BingqingLyu commented Apr 27, 2026

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 Overview

Greptile Summary

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.

Confidence Score: 4/5

  • 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

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

Context used:

  • Context from dashboard - CLAUDE.md (source)
  • Context from dashboard - AGENTS.md (source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants