Conversation
When require_mention=true is enabled in a group and a user @mentions the bot in a reply to a voice/audio message, the bot now downloads and transcribes that replied-to voice note and injects it as context into the message (e.g. '[Replying to voice message: "..."]'). Previously, the bot would only see the @mention text and had no visibility into the voice message being replied to. This made it impossible to assign tasks by replying to a voice note with @botName. Changes: - gateway/platforms/base.py: add reply_to_audio_path field to MessageEvent - gateway/platforms/telegram.py: add _enrich_event_with_replied_audio() async helper; called in _handle_text_message and _handle_media_message to download replied-to voice/audio before dispatch - gateway/run.py: transcribe reply_to_audio_path via STT pipeline and prepend as [Replying to voice message: "..."] context block Fixes: users unable to assign tasks to bots by replying to voice notes with @botName in groups where require_mention=true
Author
|
@teknium1 could you take a look when you have a moment? Small, additive change — three new lines of state plumbing plus an STT call on a new code path (replied-to voice notes). No behavior changes for existing flows. Happy to adjust scope or split if preferred. |
Collaborator
|
Thanks for the focused Telegram/STT contribution. This is an automated hermes-sweeper review; the requested behavior is already implemented on current
Closing as implemented on main. |
19 tasks
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.
Problem
When
require_mention=trueis set for a Telegram group, users cannot use voice messages to give commands to bots. If they send a voice note and then reply to it with@BotName do this, the bot sees the @mention but has no visibility into the voice message content — it can't transcribe it.This made it impossible to use voice for task assignment in groups with mention gating enabled.
Solution
When a message that triggers the bot is itself a reply to a voice/audio message, download and transcribe that voice note via the STT pipeline, and inject it as context:
Changes
gateway/platforms/base.py: addreply_to_audio_path: Optional[str]field toMessageEventgateway/platforms/telegram.py: add_enrich_event_with_replied_audio()async helper that downloads replied-to voice/audio; called in_handle_text_messageand_handle_media_messagegateway/run.py: transcribereply_to_audio_pathvia the existing STT pipeline and prepend as[Replying to voice message: "..."]context blockBehavior
.ogg(voice notes) and.mp3/.m4a(audio files)cache_audio_from_bytesand_enrich_message_with_transcriptioninfrastructure — no new dependencies