Skip to content

fix: register bot commands on all scopes so groups get a "/" menu - #99

Open
zellwk wants to merge 2 commits into
six-ddc:mainfrom
zellwk:pr/command-scopes
Open

zellwk wants to merge 2 commits into
six-ddc:mainfrom
zellwk:pr/command-scopes

Conversation

@zellwk

@zellwk zellwk commented Aug 16, 2026

Copy link
Copy Markdown

Problem

set_my_commands is only ever called for the default scope, and
delete_my_commands only clears that one.

Telegram resolves a chat's command list from the most specific scope that
matches, so:

  • a stale all_private_chats list — left by BotFather or an earlier version —
    keeps overriding the default list in private chats, and nothing in ccbot
    clears it;
  • all_group_chats is never written at all, so a bot used from a group shows
    no "/" menu. Forum topics are where this bites hardest, since that menu is
    the only discoverable way to reach the forwarded Claude Code commands.

Change

post_init now clears each scope that may hold a stale list, then registers
the full command list on the default, private and group scopes. Both calls
tolerate a rejected scope so one failure cannot stop startup.

Also adds five Claude Code commands to CC_COMMANDS — /agents, /context,
/status, /tasks and /recap — each verified present in Claude Code
2.1.233. Menu names are limited to lowercase letters, digits and underscores,
so hyphenated commands can't be listed as-is.

Verification

pytest (258 passed), pyright src/ccbot/ clean, ruff format --check clean.

This registration has been running against a forum-topic supergroup for the
past few days, where the "/" menu previously did not appear at all.

Related

zellwk and others added 2 commits August 16, 2026 12:05
/agents, /context, /status, /tasks and /recap, each verified present in
Claude Code 2.1.233.

Menu names are limited to lowercase letters, digits and underscores, so
hyphenated commands cannot be listed here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
set_my_commands was only ever called for the default scope. A narrower scope
wins over the default one, so a stale all_private_chats list left by an
earlier setup keeps hiding the real menu, and all_group_chats was never
written at all — a bot used from a group, and forum topics in particular,
shows no "/" menu.

Clear each scope that may hold a stale list, then register the full command
list on the default, private and group scopes. Both calls tolerate failure so
one rejected scope cannot stop startup.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant