Skip to content

feat(msg): Add msg sticker add / remove to install sticker sets#30

Merged
cuiko merged 2 commits into
vika2603:mainfrom
cuiko:feat/msg-sticker-set
Jun 4, 2026
Merged

feat(msg): Add msg sticker add / remove to install sticker sets#30
cuiko merged 2 commits into
vika2603:mainfrom
cuiko:feat/msg-sticker-set

Conversation

@cuiko

@cuiko cuiko commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • tg msg sticker add <set> installs a sticker set; tg msg sticker remove <set> uninstalls it.
  • <set> is a set short name or an https://t.me/addstickers/<name> link (link forms are stripped to the short name).
  • The set is fetched first (messages.getStickerSet) to validate it exists and to surface its title/count in the result. add reports archived: true when Telegram archives the set instead of installing it (e.g. at the installed-set limit).
  • Friendly-map STICKERSET_INVALID (an unknown set short name) to a usage error (exit 2) instead of the raw rpc error code 400: STICKERSET_INVALID.

Test plan

  • go build ./..., go vet, golangci-lint run, go test ./...
  • Unit: short-name/link parsing (bare, addstickers/, t.me/..., https://t.me/..., trailing query), remove pass-through, empty-ref rejection; STICKERSET_INVALID added to the usage-family mapping test.
  • Live (round-trip, original state restored): remove an installed set → gone from sticker list --installed; add https://t.me/addstickers/<name> → back in the list (also exercises link parsing). Bogus set name → friendly {"code":"usage","message":"no such sticker set ...","rpc_error":"STICKERSET_INVALID"} (exit 2).
  • Live (send after install): after add, a sticker from that set sends and lands as media.type: sticker.
  • Live (send after uninstall): after remove, the same self-contained stk_ token still sends successfully — install state governs listing, not sendability (the token carries the document ref; Telegram allows sending stickers from sets you're not subscribed to).

cuiko added 2 commits June 4, 2026 18:56
`tg msg sticker add <set>` installs a sticker set and `remove` uninstalls it.
<set> is a set short name or an https://t.me/addstickers/<name> link. The set
is fetched first to validate it and surface its title/count; install reports
when Telegram archived the set instead of installing it.

Also friendly-map STICKERSET_INVALID (an unknown set short name) to a usage
error instead of the raw "rpc error code 400: STICKERSET_INVALID".
Rename the action dispatcher from the noun StickerSet to the verb
InstallStickerSet, matching the verb-first action-entry convention and the
FaveSticker precedent (a positive verb that covers its inverse via a flag).
No behavior change.
@cuiko
cuiko merged commit d956fb8 into vika2603:main Jun 4, 2026
1 check passed
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