Skip to content

Harden force-sub checks, admin gating, and search behavior - #18

Open
SasukeXDev wants to merge 2 commits into
codex/build-production-ready-telegram-botfrom
codex/enhance-telegram-bot-functionality
Open

SasukeXDev wants to merge 2 commits into
codex/build-production-ready-telegram-botfrom
codex/enhance-telegram-bot-functionality

Conversation

@SasukeXDev

Copy link
Copy Markdown
Owner

Motivation

  • Ensure force-sub flow is explicit and reliable with clear join buttons and a robust re-check path so users cannot bypass membership gating.
  • Prevent non-admins from invoking sensitive commands by adding explicit runtime admin verification to /stats, /users, and /broadcast.
  • Improve search accuracy and scalability by normalizing searchable titles, adding an index, bounding pagination, and scoping results to configured auth channels.

Description

  • Updated force-sub UI in bot/telegram/keyboards.py to show a unified 📢 Join Channel button, numbered join buttons when multiple channels are configured, and changed retry button text to ✅ Check / Try Again for clarity.
  • Hardened membership checks in bot/telegram/services.py by treating ChatMemberStatus.RESTRICTED as not subscribed and updating the prompt text to reference the combined Check / Try Again wording.
  • Enforced subscription validation on search pagination callbacks in bot/telegram/plugins/start.py so callback navigation requires verified membership before showing pages.
  • Replaced brittle filter-only admin gating with an explicit runtime ensure_admin helper in bot/telegram/plugins/start.py, and applied it to /stats, /users, and /broadcast handlers to return ❌ Admin only command. for unauthorized users.
  • Improved search storage and queries in bot/helper/bot_database.py by adding search_title (lowercased) to content documents, creating an index for it, constraining searches to AUTH_CHANNEL IDs when configured, and sanitizing page numbers with safe_page.

Testing

  • Ran python -m compileall bot and confirmed all modules compile successfully.
  • Performed an inline-keyboard smoke check using a small Python snippet that exercised force_sub_keyboard for single and multi-channel inputs and verified button labels and ordering (succeeded).
  • Verified basic import/behavior of changed modules via local static checks; note that full end-to-end Telegram interactions (real join verification, callbacks, and media delivery) require live bot credentials and runtime connectivity and were not executed in this environment.

Codex Task

@vercel

vercel Bot commented Apr 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hub360 Ready Ready Preview, Comment Apr 17, 2026 6:30pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant