Skip to content

fix(gateway): register Telegram commands for groups and DM#28516

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704
May 19, 2026
Merged

fix(gateway): register Telegram commands for groups and DM#28516
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #27014 (@chromalinx). Register Telegram bot commands across default, private, and group scopes so the slash-command menu is available outside DMs. Lazily register BotCommandScopeChat for forum supergroups; use chat.is_forum so the General topic gets commands too.

Authorship preserved via cherry-pick. Follow-up commit fixes test fixture (name is a derived property, not settable; telegram_menu_commands patched at correct module path; BotCommandScopeChat mock tracks chat_id). 5/5 forum-commands tests passing.

chromalinx and others added 2 commits May 18, 2026 22:32
Register Telegram bot commands across default, private, and group scopes so
the slash-command menu is available outside DMs.

Changes from review feedback:
- Add asyncio.Lock to prevent race condition in _ensure_forum_commands
- Extract MAX_COMMANDS_PER_SCOPE constant (30) to avoid magic number
- Upgrade error logging from debug->warning in forum registration
- Add tests covering lazy forum registration and concurrent safety
- Remove /start handler from this PR (separate feature)

Fixes review: needs_work (race, magic number, log levels, missing tests)
@teknium1 teknium1 merged commit efc3740 into main May 19, 2026
@teknium1 teknium1 deleted the hermes/hermes-6063e704 branch May 19, 2026 05:34
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-6063e704 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8923 on HEAD, 8920 on base (🆕 +3)

🆕 New issues (2):

Rule Count
unresolved-attribute 1
unresolved-import 1
First entries
gateway/platforms/telegram.py:4221: [unresolved-attribute] unresolved-attribute: Attribute `set_my_commands` is not defined on `None` in union `Unknown | None`
tests/gateway/test_telegram_forum_commands.py:7: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`

✅ Fixed issues: none

Unchanged: 4671 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants