← Back to PRs

#17432: fix(telegram): skip message_thread_id for private chats in sticker/poll sends

by clawinho open 2026-02-15 19:02 View on GitHub →
channel: telegram size: S
## Summary Private chats (chatId > 0) don't support `message_thread_id`. This was fixed for `sendMessageTelegram` but not for `sendStickerTelegram` and `sendPollTelegram`, causing 'message thread not found' errors in DMs. ## Changes Now all three functions check if chatId is positive (private chat) and use scope `'dm'` instead of `'forum'` so `buildTelegramThreadParams` returns undefined and skips the thread parameter. This is a **proactive fix** that prevents the error entirely, rather than relying on the `sendWithThreadFallback` retry mechanism. ## Test Plan - Updated existing tests to use negative chatIds (group chats) for testing thread fallback - Added new test `skips message_thread_id for private chats` in poll tests - All 65 telegram send tests pass ## Related Completes the fix from PR #17252 which only addressed `sendMessageTelegram`. <!-- greptile_comment --> <h3>Greptile Summary</h3> Extends the private chat fix from a previous PR to cover `sendStickerTelegram` and `sendPollTelegram`. These functions now correctly skip `message_thread_id` for private chats (positive chatId) by setting scope to `'dm'`, preventing 'message thread not found' errors in DMs. Tests updated to use negative chatIds for group chat scenarios and new tests added to verify private chat behavior. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no risk - The fix is straightforward, follows established patterns, has comprehensive test coverage, and completes a previously incomplete fix. The logic correctly distinguishes private chats from groups using Telegram's chatId convention (positive for private, negative for groups). - No files require special attention <sub>Last reviewed commit: 4d4865e</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs