Skip to content

Send and download media #22

Closed
Closed

Description

@neoromantic

tg send sends text only. tg api can't take file bytes, so it can't practically send or fetch a photo, a document or a voice note. The cache keeps only has_media and message_type. File names, sizes and types are only inside raw_json, and history sync writes voice messages, videos and stickers as document. telegram-mcp sends files, albums, voice and stickers, and downloads media.

Scope

  • Attachment metadata (kind, file name, MIME type, size, duration, dimensions, album ID, uniqueFileId):
  • tg media download --chat <peer> --id <message> [--out <path|dir|->] [--thumb]:
    • Saves the file into the account's media cache (accounts/<id>/media, one copy per file) and prints its path as JSON.
    • --out copies the file out; - writes it to stdout. --thumb fetches a small preview.
    • Fetches the message again for a fresh file reference and resumes a partial download.
    • A file already in the cache needs no network and no credentials.
  • Media from chats and messages with content protection is not downloaded (CONTENT_PROTECTED), as Telegram's content protection rules require.
  • tg send --file <path> [--caption <text>] sends one file.
  • tg status --sizes shows the media cache; tg media clean removes cached files.
  • The daemon stays read-only and downloads nothing.

Done when the live smoke suite sends a file to Saved Messages and downloads it back.

Follow-ups

Out of scope

  • One media cache shared by several accounts.
  • The daemon sending or uploading anything.
  • An HTML export like Telegram Desktop's.
  • A media server or gallery.
  • Sending stickers and GIFs.
  • Editing media.
  • Secret chats.
  • Stories.

Activity

  1. added
    enhancement
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions