feat(msg): msg gif — list and send saved GIFs#24
Merged
Conversation
`tg msg gif list` lists saved GIFs (messages.getSavedGifs), each with a self-contained `gif_` ref handle. `msg send --gif <ref>` sends a gif by that handle or by a <msg-ref> of an existing gif; it's mutually exclusive with text, --file, and --sticker, and refreshes an expired ref from the saved-gifs list. The ref-token codec is shared with stickers via a prefix. Also fix document media-kind detection to prefer Animated over Video, so an mp4 gif (which carries both attributes) reads as "gif", not "video" (in msg list / msg info, regardless of attribute order). Verified real-env: gif list; send by ref lands as type "gif" with detail; a non-gif message ref is rejected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tg msg gifadds GIF support, mirroringmsg sticker.msg gif list— lists saved GIFs (messages.getSavedGifs), each row carrying a self-containedgif_ref handle (id + access_hash + file_reference).msg send --gif <ref>— sends a GIF by amsg gif listref or by a<msg-ref>of an existing gif. Mutually exclusive with text,--file, and--sticker. On an expired ref it refreshes from the saved-gifs list and retries once. Stays on the local send path (media isn't daemon-routed).stk_/gif_), so a gif ref can't be mistaken for a sticker ref.Incidental fix
Document media-kind detection now prefers
AnimatedoverVideo. A Telegram gif is an mp4 carrying both attributes; the previous return-on-first-attribute logic could read it asvideodepending on attribute order. Nowmsg list/msg inforeport it asgif.Test plan
gofmt -l .,go build ./...,go vet ./...,go test ./...greengolangci-lint run(default +GOOS=linux) — 0 issues--gifresolves a ref/msg-ref; rejects text/--file/--sticker.msg gif list(2 saved gifs);send --gif <ref>lands astype: gifwithduration/dimensions/file_name; a non-gif<msg-ref>→ usage error. Test message deleted.