Fix bot commands not responding and enable markdown rendering#48
Draft
fyaz05 wants to merge 2 commits into
Draft
Fix bot commands not responding and enable markdown rendering#48fyaz05 wants to merge 2 commits into
fyaz05 wants to merge 2 commits into
Conversation
- Replace Pyrogram with Pytdbot for Telegram API operations - Refactor database from single file to modular mixin-based decomposition - Add comprehensive rate limiter with exponential backoff and head-of-line blocking avoidance - Add new utility modules: compat, filters, media_helpers, telegram_helpers, metrics, file_record - Add unit tests for core functionality (22 tests) - Add CI pipeline with ruff, pytest, pyright - Add API and Architecture documentation - Update Dockerfile with uv package manager and health checks - Improve error handling and graceful shutdown - Remove FloodWait exception handling (Pytdbot uses error-return types) - Add CORS middleware and metrics endpoint - Clean up repository structure and update .gitignore Co-Authored-By: Mimo 2.5 Pro
- Add message_patch.py to fix is_outgoing=True messages being filtered - Set default_parse_mode='markdown' in StreamBot client for proper formatting - Import message_patch before Client initialization
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Comment on lines
+11
to
+22
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/setup-uv@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - run: uv sync | ||
| - run: uv run ruff check Thunder/ | ||
| - run: uv run ruff format --check Thunder/ | ||
|
|
||
| test: |
Comment on lines
+23
to
+33
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/setup-uv@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - run: uv sync | ||
| - run: uv run pytest tests/ -v --tb=short | ||
|
|
||
| typecheck: |
Comment on lines
+34
to
+42
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: astral-sh/setup-uv@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - run: uv sync | ||
| - run: uv run pyright Thunder/ --level basic |
| class BitlyPlugin(ShortenerPlugin): | ||
| @classmethod | ||
| def matches(cls, domain: str) -> bool: | ||
| return "bitly.com" in domain |
| class OuoIoPlugin(ShortenerPlugin): | ||
| @classmethod | ||
| def matches(cls, domain: str) -> bool: | ||
| return "ouo.io" in domain |
| except (InvalidHash, FileNotFound) as e: | ||
| raise web.HTTPNotFound(text="Resource not found") from e | ||
| except RateLimited as e: | ||
| raise web.HTTPTooManyRequests(text=str(e)) from e |
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.
Summary
Fixes two issues:
is_outgoing=Truemessages by default, causing command handlers to never triggerChanges
Thunder/message_patch.py (new)
Client.__init__to addMessageTexttoallow_outgoing_message_typesThunder/bot/init.py
message_patchbefore Client initializationdefault_parse_mode="markdown"on StreamBot client for proper message formattingTesting
The bot now correctly:
/start,/help,/pingand other commands@fyaz05 can click here to continue refining the PR