Files
lyuksovannyyandClaude Opus 5.5 9ae1b7fc3a
Publish plugin / publish (push) Successful in 4s
[no bump] Move technical docs to docs/, add icon and PNG export tool
README now carries the icon, TL;DR, description and features; the
technical sections live in docs/. tools/icon_png.py renders
images/icon.svg to a square PNG (512x512 by default, --resolution N).
plugin.json points at the plugin's own icon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 14:16:37 +02:00

1.7 KiB

How Unlocked Restrictions works

How copying works

Telegram refuses to forward protected content, and also to re-send its media by file id, so a copy is sent the same way as a message you wrote:

  • text keeps its formatting; photos, videos, files, voice messages and GIFs are downloaded (or taken from the local cache) and uploaded again; stickers, locations and contacts are sent directly;
  • albums are sent as media groups again (at most 10 items per group);
  • bot-only parts are dropped: reply and inline keyboards, games, invoices; content that can't be reproduced (polls, dice, stories, giveaways, paid media) is skipped, and only its text is sent if there is any;
  • the selection is sent once every item is ready, so one large download delays the batch;
  • items that can't be copied are reported in a bulletin.

Copied videos have no preview thumbnail. The lock covers groups and channels, not private chats where the other person enabled content protection.

Runtime notes

Things the on-device runtime does differently from the SDK docs, all handled in src/:

  • Java lists are not iterable from Python; use hooking.java_list().
  • param.setResult() in a before-hook does not skip the original method, so the forward hook empties the message list instead.
  • threading.local state is not shared between a before-hook and its after-hook.
  • Java String values arrive as Python str, other CharSequences as Java objects.
  • Fields named like java.lang.Object methods (SendMessageParams.notify) must be set with hook_utils.set_private_field.
  • Exceptions escaping a Python thread vanish silently, so the copy worker catches everything.
  • Shared TL objects (TLRPC.Chat and friends) are never modified for display purposes.