Text Structurer Quote & Voice Fix Update 🎙️
This update improves the .fix Text Structurer command by adding support for Telegram reply quotes and voice-based inputs. It also adds safety checks around empty Gemini requests and ensures source voice messages are deleted only after successful processing.
✨ New Features
- Reply Quote Support for
.fix: The structurer now extracts text from Telegram reply quotes, includingquote_text,quoteText, and nested reply quote objects. - Voice-to-Structured-Text via
.fix: Replying to a voice message, audio file, or video note with.fixnow transcribes the media and rewrites it into a clean, structured text. - Safe Source Voice Deletion: Original voice/audio/video-note messages are deleted only after transcription, AI rewriting, and final message edit complete successfully.
- Temporary Processing Status: When
.fixis used on voice media, the trigger message is first changed to a processing status, then replaced with the final structured text.
🔧 Text Structurer Improvements
- Centralized Text Extraction: Added helper logic to safely extract normal text, captions, and quoted reply text from Pyrogram/Kurigram message objects.
- Transcribable Media Detection: Added detection for
voice,audio, andvideo_notemessages insidetext_struct.py. - Media Download & Cleanup:
.fixnow downloads replied voice media intodata/ts_fix_*, sends it to Gemini transcription, and removes the temporary file afterward. - Edit Success Tracking:
_apply_edit()now returns whether the final AI-generated edit actually succeeded, allowing safe follow-up actions like deleting the source media.
🛡️ Stability & Protection
- Empty Gemini Request Guard: Gemini calls are now skipped when both prompt text and media are empty, preventing repeated
400 INVALID_ARGUMENT: Request has empty inputfallback spam. - Fallback Safety Preserved: If transcription or AI rewriting fails, the original voice message is not deleted.
- Quote Fallback Logic:
.fixnow tries quote text first, then falls back to full message text/caption. - Reduced Log Noise: Empty requests now produce a single warning instead of cycling through every Gemini fallback model.
🗂️ Changed Files
-
modules/text_struct.py- Added quote extraction helpers.
- Added voice/audio/video-note handling for
.fix. - Added media transcription flow.
- Added safe source media deletion after successful final edit.
- Updated
_apply_edit()to return success state.
-
core/services.py- Added empty prompt/media guard before Gemini fallback execution.
- Updated content building to avoid sending empty text parts to Gemini.
Full Changelog: v2.2.0...v2.2.1