fix(telegram): add channel_post and edited_channel_post handlers#3683
Open
Bartok9 wants to merge 2 commits intoNousResearch:mainfrom
Open
fix(telegram): add channel_post and edited_channel_post handlers#3683Bartok9 wants to merge 2 commits intoNousResearch:mainfrom
Bartok9 wants to merge 2 commits intoNousResearch:mainfrom
Conversation
added 2 commits
March 29, 2026 03:33
Telegram channels post messages through update.channel_post instead of update.message. Previously the adapter only registered handlers for regular messages, causing channel content to be silently dropped even when the bot was a channel admin. Changes: - Add handlers for channel_post and edited_channel_post update types - Handle text, command, and media messages from channels - Extract sender info from sender_chat (channels don't have from_user) - Reuse existing batching/caching logic for consistency The channel directory and session routing should now correctly include channels where the bot is an admin. Fixes NousResearch#3634
- Use 'platform' not '_platform' (matches base adapter) - Remove invalid 'name' setter (name is a read-only property)
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
Telegram channels post messages through
update.channel_postinstead ofupdate.message. Previously the adapter only registered handlers for regular messages, causing channel content to be silently dropped even when the bot was a channel admin.Changes
channel_postandedited_channel_postupdate typessender_chat(channels don't havefrom_user)Technical Details
The fix adds three new handlers that mirror the existing message handlers:
_handle_channel_text_message- batched text message handling_handle_channel_command- immediate command processing_handle_channel_media_message- photo/video/audio/document handling with cachingThe
_build_message_eventmethod was updated to extract user info fromsender_chatwhenfrom_useris None (which is the case for channel posts).Testing
Added
test_telegram_channel_posts.pywith tests for:Fixes #3634