feat: add TELEGRAM_ALLOWED_TOPICS for forum topic filtering#1101
feat: add TELEGRAM_ALLOWED_TOPICS for forum topic filtering#1101
Conversation
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Lets add these, also If we have access to topic, but not to chat, only topic is working, if we have acces also to chat - that means all topics allowed in the chat, so no need for And everything will be backward compatible. Links syntax allows omitting |
|
🤖 AI Work Session Started Starting automated work session at 2026-01-11T01:32:52.762Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
Lino arguments and lenv do not use Also lots of changes were made previously, so we need to get fresh version of the code, and resolve conflicts. We need to ensure these changes will not break anything, they are tested, traced, and enabled only when new additional ENV variable is used or corresponding CLI option. So the end result is that we will be able to allow full chat as previously, of if we don't want full chat, we just allow specific topics in it. Also we need to ensure all changes are correct, consistent, validated, tested, logged and fully meet all discussed requirements (check issue description and all comments in issue and in pull request). Ensure all CI/CD checks pass. |
|
🤖 AI Work Session Started Starting automated work session at 2026-03-29T11:19:09.033Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
Add support for filtering bot commands by Telegram forum topics using Links Notation format. Users can configure specific topics within supergroups where the bot should respond. - Add parseLinks/formatLinks to lino.lib.mjs for chatId:topicId pairs - Add --allowedTopics CLI option and TELEGRAM_ALLOWED_TOPICS env var - Add isTopicAuthorized() with hierarchical auth: chat > topic - Update /help to always work and show topic ID for diagnostics - Update all command handlers to use topic-level authorization - Add 19 tests covering parsing, formatting, and authorization logic Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ab686fb to
e7ce2dd
Compare
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (5602KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
|
Resolve conflicts. And double-triple check all previously discussed requirements. We need to ensure all changes are correct, consistent, validated, tested, logged and fully meet all discussed requirements (check issue description and all comments in issue and in pull request). Ensure all CI/CD checks pass. |
|
🤖 AI Work Session Started Starting automated work session at 2026-03-31T22:36:17.708Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
Merge latest main into issue-1100-45539e9d3099, resolving conflicts in telegram-bot.mjs and telegram-merge-command.lib.mjs. Integrates start/stop command support (issue #1081) with topic authorization (issue #1100) by adding isChatStopped and getStoppedChatRejectMessage to sharedCommandOpts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add missing chatId declarations before isChatStopped checks in /solve and /hive handlers (caused no-undef ESLint errors after merge) - Fix /solve_queue hint text to use unescaped underscore (fixes pre-existing test failure from main) - Add JSDoc entries for isChatStopped/getStoppedChatRejectMessage in merge command - Condense comments to keep telegram-bot.mjs under 1500 line limit Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:Claude Opus 4.6:
Total input tokens: 70.7K + 5.1M cached Claude Haiku 4.5:
Total input tokens: 77.4K + 1.9M cached 🤖 Models used:
📎 Log file uploaded as Gist (3627KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Adds support for filtering bot commands by Telegram forum topics, in addition to existing chat filtering. Users can configure specific topics within supergroups where the bot should respond.
Changes
parseLinks()andformatLinks()to lino library for parsing chatId:topicId pairs in Links Notation--allowedTopicsCLI option andTELEGRAM_ALLOWED_TOPICSenvironment variableisTopicAuthorized()function with hierarchical authorization:TELEGRAM_ALLOWED_CHATS→ all topics allowedTELEGRAM_ALLOWED_TOPICS→ only that topic works/helpcommand to always be allowed (no auth check) and show topic ID in diagnostics/solve,/hive,/limits,/version,/accept_invites,/merge,/solve_queue,/top) to use topic-level authorizationConfiguration Format
Uses Links Notation with space-separated
chatId topicIdpairs:Or nested format:
Backward Compatibility
TELEGRAM_ALLOWED_TOPICSis set)TELEGRAM_ALLOWED_CHATSis configured, all topics in allowed chats remain accessible/helpalways works in any chat/topic to show IDs for configurationTest Plan
Fixes #1100
🤖 Generated with Claude Code