Skip to content

Improve search indexing and force-sub flow; refactor admin checks and caching - #19

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

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

Conversation

@SasukeXDev

Copy link
Copy Markdown
Owner

Motivation

  • Improve full-text search reliability and performance by adding a normalized searchable title and appropriate index.
  • Make the force-subscription flow more robust by resolving channel/join links (including private channels), caching them, and providing clearer join buttons.
  • Replace the previous admin filter with an explicit async permission check to simplify handler logic and ensure prompt user feedback.

Description

  • Database: added search_title field on content documents (lowercased title), created an index for it, and imported ASCENDING in bot/helper/bot_database.py.
  • Search: made search pagination bounds-safe using safe_page, built regex to search search_title and tags (using $elemMatch), and applied optional Telegram.AUTH_CHANNEL filtering in search_content.
  • Force-sub flow: implemented link resolution & caching in bot/telegram/services.py with _resolve_channel_join_link, _prune_force_sub_links, and FORCE_SUB_LINK_CACHE, and updated send_force_sub_prompt to resolve join links and fallback messaging when links cannot be generated.
  • Subscription check: widened non-subscribed statuses to include ChatMemberStatus.RESTRICTED and updated calls to send_force_sub_prompt to accept client plus message everywhere it is used.
  • Keyboards: changed force_sub_keyboard signature to join_links, improved button labels for single vs multiple channels, and updated the retry button label.
  • Start/plugins: replaced the admin_filter with an async helper ensure_admin that replies when unauthorized, adjusted handler signatures to accept client where needed, removed the old aggregated admin guard handler, and added ensure_admin checks to admin commands (/stats, /users, /broadcast).

Testing

  • Ran unit tests for search and pagination logic and they passed.
  • Ran integration-like tests for force-sub link resolution and keyboard generation and they passed.
  • Ran handler-level smoke tests for /start, search, and admin commands and they passed.

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:56pm

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