fix(gateway): register Telegram commands for groups and DM#28516
Merged
Conversation
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)
23 tasks
Contributor
🔎 Lint report:
|
| 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.
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.
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
BotCommandScopeChatfor forum supergroups; usechat.is_forumso the General topic gets commands too.Authorship preserved via cherry-pick. Follow-up commit fixes test fixture (
nameis a derived property, not settable;telegram_menu_commandspatched at correct module path;BotCommandScopeChatmock tracks chat_id). 5/5 forum-commands tests passing.