# 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 `CharSequence`s 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.