Skip to content

Support two-way message replies and quotes for Telegram forum topics and webhooks - #78

Open
mysubcult wants to merge 13 commits into
LiveHelperChat:masterfrom
mysubcult:feature/telegram-topic-reply-sync
Open

Support two-way message replies and quotes for Telegram forum topics and webhooks#78
mysubcult wants to merge 13 commits into
LiveHelperChat:masterfrom
mysubcult:feature/telegram-topic-reply-sync

Conversation

@mysubcult

@mysubcult mysubcult commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

This PR adds reliable two-way reply and quote synchronization for Telegram forum topics and webhook messages.

What changed:

  • Store Telegram message IDs and text/caption mappings per bot and group-chat namespace, preventing collisions between bots or destinations.
  • Preserve local LHC quotes for every explicit Telegram reply, while only sending iwh_msg_id to REST when the target has a valid external ID.
  • Read reply and quote data from both raw Telegram updates and installed telegram-core entities.
  • Retry stale reply targets without losing multipart file payloads; reopen local files before retrying.
  • Split long HTML/plain messages on UTF-16 limits without breaking UTF-8 characters, and keep the reply target only on the first chunk.
  • Keep captions and media metadata available for later quote fallback, including legacy records.

Validation:

  • PHP 8.4 lint passed for the extension files.
  • tests/TelegramReplyContractTest.php passed, including namespace isolation, captions, UTF-16 splitting, stale-reply multipart retry, and compatibility fixtures.
  • No Live Helper Chat core files are changed by this PR.

@mysubcult
mysubcult force-pushed the feature/telegram-topic-reply-sync branch from 2c08ba5 to dd2f64e Compare August 21, 2026 12:46
@mysubcult

Copy link
Copy Markdown
Contributor Author

Hi @remdex,

Apologies for the previous branch state — some leftover static paths from an older dev commit accidentally slipped in earlier.

I have completely cleaned up the branch and rebased it directly onto clean master as a single commit:

  • Removed all static/hardcoded paths: uses standard LHC $file->file_path_server and Longman\TelegramBot\Request::encodeFile().
  • Cleaned quote formatting: uses standard LHC [quote=ID] BBCode without any extra emojis or decorators.
  • Thoroughly tested live: verified both operator-to-visitor and visitor-to-operator quotes/replies in real Telegram forum topics, web widget, and webhooks. Everything works seamlessly.
  • Updated default templates (doc/telegram/): added message_id_reply and reply_parameters so new imports work out of the box.

Please take a look when you have a moment. Thanks!

@mysubcult
mysubcult force-pushed the feature/telegram-topic-reply-sync branch 9 times, most recently from 0178ea3 to eee54a8 Compare August 22, 2026 10:09
@mysubcult
mysubcult force-pushed the feature/telegram-topic-reply-sync branch from eee54a8 to 5ff450d Compare August 22, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant