-
Notifications
You must be signed in to change notification settings - Fork 8
Implement TELEGRAM_ALLOWED_TOPICS for forum topic filtering #1101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #1100
This case study investigates adding support for allowed Telegram topics (inside chats) in addition to the existing allowed chats feature. Key findings: - Topic IDs are relative to their parent chat, not globally unique - General topic always has id=1 - Other topics get IDs from the messageActionTopicCreate service message - Implementation requires chat:topic pairs format Documents included: - README.md: Overview and current implementation analysis - analysis.md: Problem statement and proposed solutions - telegram-api-reference.md: API documentation reference - implementation-plan.md: Step-by-step implementation guide Fixes #1100 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 65ede6c.
🤖 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. |
- Add TELEGRAM_ALLOWED_TOPICS config using Links Notation format "chatId topicId" - Add parseLinks() and formatLinks() methods to lino library - Add isTopicAuthorized() function with authorization logic: - If chat is in TELEGRAM_ALLOWED_CHATS, all topics allowed - If specific topic is in TELEGRAM_ALLOWED_TOPICS, only that topic works - Update /help command to: - Always be allowed (bypass authorization for diagnostics) - Show topic ID in diagnostic information - Show configuration hint when in unauthorized topic - Update /solve, /hive, /limits, /version to use isTopicAuthorized() - Update dry-run output to show allowed topics configuration - Update case study documentation with new format and logic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add buildAuthErrorMessage helper function - Compact verbose logging patterns - Simplify command handlers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 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. |
Summary
This PR implements support for filtering bot commands by Telegram forum topics, in addition to the existing chat filtering. Users can now configure specific topics within supergroups where the bot should respond to commands.
Changes
TELEGRAM_ALLOWED_TOPICSconfiguration using Links Notation formatchatId topicIdparseLinks()andformatLinks()methods to lino library for parsing topic pairsisTopicAuthorized()function with authorization logic:TELEGRAM_ALLOWED_CHATS, all topics in that chat are allowedTELEGRAM_ALLOWED_TOPICS, only that topic works/helpcommand to:/solve,/hive,/limits,/versionto useisTopicAuthorized()Configuration Format
Uses Links Notation with space-separated
chatId topicIdpairs:Authorization Logic
TELEGRAM_ALLOWED_CHATS: All topics in that chat are allowedTELEGRAM_ALLOWED_TOPICS: Only that specific topic works/helpcommand: Always allowed (to show chat and topic IDs for configuration)This design is backward compatible - existing deployments work unchanged.
Test Plan
parseLinks()method with various input formatsFixes #1100
🤖 Generated with Claude Code