Skip to content

Forward chat attachments to Telegram as native files#72

Open
mysubcult wants to merge 1 commit into
LiveHelperChat:masterfrom
mysubcult:patch-1
Open

Forward chat attachments to Telegram as native files#72
mysubcult wants to merge 1 commit into
LiveHelperChat:masterfrom
mysubcult:patch-1

Conversation

@mysubcult

@mysubcult mysubcult commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

This improves how Live Helper Chat attachments are forwarded to Telegram operator topics.

Previously, visitor attachments were sent to Telegram as internal [file=...] placeholders/links inside a text message. This PR forwards accepted LHC chat files as native Telegram media/documents instead.

Changes:

  • Sends images as Telegram photos.
  • Sends audio/video with the matching Telegram media methods where possible.
  • Sends all other files as Telegram documents.
  • Preserves the operator topic/thread.
  • Uses message text as the media caption when a message has both text and an attachment.
  • Avoids duplicate text messages for attachment-only or attachment-with-caption messages.
  • Keeps a fallback to the old [file=...] link if Telegram upload fails.

Tested with:

  • image-only messages
  • image + caption messages
  • multiple image messages
  • new chat initial messages with attachments
  • fallback behavior when native file sending is not possible

This improves attachment forwarding to Telegram operator topics.

When a chat message contains both text and an attachment, the text is now sent as the Telegram media caption instead of as a separate text message. Attachment-only messages are forwarded as native Telegram files/media with a sender caption, so operators can still see who sent the file.

This also avoids exposing internal `[file=...]` placeholders or technical upload names as user-visible messages.
@mysubcult mysubcult changed the title Use message text as attachment caption and avoid duplicate text messages Forward chat attachments to Telegram as native files Jun 14, 2026
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